Package com.jme3.math

Examples of com.jme3.math.Spline


  }
 
  private ParticleEmitter getEmitter(String name) {
    ParticleEmitter flame = new ParticleEmitter(name, Type.Triangle, 32);
        flame.setSelectRandomImage(true);
        flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, 1f));
        flame.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f));
        flame.setStartSize(1.3f);
        flame.setEndSize(2f);
        flame.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
        flame.setParticlesPerSec(0);
        flame.setGravity(-5f);
View Full Code Here


  public void startDemoMotion(Ship ship) {
    motionPath = new ShipDemoMotion();
    motionTrack = new ShipMotionTrack(ship, motionPath);
    //motionTrack.setDirectionType(Direction.Path);
    motionTrack.setDirectionType(Direction.PathAndRotation);
    motionTrack.setRotation(new Quaternion().fromAngles(0, 0, 0));
    motionTrack.setSpeed(0.5f);
    motionTrack.setLoopMode(LoopMode.Loop);
    motionTrack.pause();
    timeLeft = 10;
  }
View Full Code Here

            }
        }

        newUp.set(newDirection).crossLocal(newLeft).normalizeLocal();
       
    Quaternion r = new Quaternion().fromAxes(newLeft, newUp, newDirection);
    r.normalize();
    this.setLocalRotation(r);   
  }
View Full Code Here

              ar.cleanup();
                stop();
            } else if (name.equals("SIMPLEAPP_CameraPos")) {
                if (cam != null) {
                    Vector3f loc = cam.getLocation();
                    Quaternion rot = cam.getRotation();
                    System.out.println("Camera Position: ("
                            + loc.x + ", " + loc.y + ", " + loc.z + ")");
                    System.out.println("Camera Rotation: " + rot);
                    System.out.println("Camera Direction: " + cam.getDirection());
                }
View Full Code Here

     *
     * @param controlPoints the control points to use to create this curve
     * @param nbSubSegments the number of subsegments between the control points
     */
    public Curve(Vector3f[] controlPoints, int nbSubSegments) {
        this(new Spline(Spline.SplineType.CatmullRom, controlPoints, 10, false), nbSubSegments);
    }
View Full Code Here

                controlPoints.remove(0);
                controlPoints.remove(controlPoints.size() - 1);

                // return the first taper curve that has more than 3 control points
                if (controlPoints.size() > 3) {
                    return new Spline(SplineType.Bezier, controlPoints, 0, false);
                }
            }
        }
        return null;
    }
View Full Code Here

                conrtolPoints.add(new Vector3f(-handlerLength, 0, bevelDepth + extrude));

                conrtolPoints.add(new Vector3f(-bevelDepth, 0, handlerLength + extrude));
                conrtolPoints.add(new Vector3f(-bevelDepth, 0, extrude));

                Spline bevelSpline = new Spline(SplineType.Bezier, conrtolPoints, 0, false);
                Curve bevelCurve = new Curve(bevelSpline, bevResol);
                bevelObject = new ArrayList<Geometry>(1);
                bevelObject.add(new Geometry("", bevelCurve));
            } else if (extrude > 0.0f) {
                Spline bevelSpline = new Spline(SplineType.Linear, new Vector3f[] { new Vector3f(0, 0, -extrude), new Vector3f(0, 0, extrude) }, 1, false);
                Curve bevelCurve = new Curve(bevelSpline, bevResol);
                bevelObject = new ArrayList<Geometry>(1);
                bevelObject.add(new Geometry("", bevelCurve));
            }
        }

        // getting taper object
        Spline taperObject = null;
        Pointer pTaperObject = (Pointer) curveStructure.getFieldValue("taperobj");
        if (bevelObject != null && pTaperObject.isNotNull()) {
            Pointer pTaperStructure = (Pointer) pTaperObject.fetchData().get(0).getFieldValue("data");
            Structure taperStructure = pTaperStructure.fetchData().get(0);
            taperObject = this.loadTaperObject(taperStructure);
View Full Code Here

                int triplesCount = controlPoints.size() / 3;
                List<Vector3f> taperControlPoints = new ArrayList<Vector3f>(triplesCount);
                for (int i = 0; i < triplesCount; ++i) {
                    taperControlPoints.add(new Vector3f(controlPoints.get(i * 3 + 1).x, bezierCurve.getRadius(i), 0));
                }
                taperObject = new Spline(SplineType.Linear, taperControlPoints, 0, false);
            }

            if (cyclic) {
                // copy the first three points at the end
                for (int i = 0; i < 3; ++i) {
                    controlPoints.add(controlPoints.get(i));
                }
            }
            // removing the first and last handles
            controlPoints.remove(0);
            controlPoints.remove(controlPoints.size() - 1);

            // creating curve
            Spline spline = new Spline(SplineType.Bezier, controlPoints, 0, false);
            Curve curve = new Curve(spline, resolution);
            if (bevelObject == null) {// creating a normal curve
                Geometry curveGeometry = new Geometry(null, curve);
                result.add(curveGeometry);
                // TODO: use front and back flags; surface excluding algorithm for bezier circles should be added
View Full Code Here

        }

        int resolu = ((Number) nurb.getFieldValue("resolu")).intValue() + 1;
        List<Geometry> result;
        if (knots[1] == null) {// creating the curve
            Spline nurbSpline = new Spline(controlPoints.get(0), knots[0]);
            Curve nurbCurve = new Curve(nurbSpline, resolu);
            if (bevelObject != null) {
                result = this.applyBevelAndTaper(nurbCurve, bevelObject, taperObject, true, blenderContext);// TODO: smooth
            } else {
                result = new ArrayList<Geometry>(1);
View Full Code Here

    ti.onNew(0, 0, 0);
    gestureSystem.update(1);
    ti.onRelease(0);
    gestureSystem.update(1);
    //printList(clickVectors);
    Assert.assertTrue(clickVectors.get(0).equals(new Vector2f(0,0)));
    Assert.assertTrue(zoomValues.isEmpty());
  }
View Full Code Here

TOP

Related Classes of com.jme3.math.Spline

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.