Package org.mt4j.util.math

Examples of org.mt4j.util.math.BezierVertex


     
      if (this.isTextureEnabled())
        g.vertex(v.x, v.y, v.z, v.getTexCoordU(), v.getTexCoordV());
      else{
        if (v.getType() == Vector3D.BEZIERVERTEX){
          BezierVertex b = (BezierVertex)v;
          g.bezierVertex(
              b.getFirstCtrlPoint().x,  b.getFirstCtrlPoint().y,  b.getFirstCtrlPoint().z,
              b.getSecondCtrlPoint().x, b.getSecondCtrlPoint().y, b.getSecondCtrlPoint().z,
              b.x, b.y, b.z  );
        }
        else
          g.vertex(v.x, v.y, v.z);
      }
View Full Code Here


  private void drawP5Vertex(PApplet p, Vertex v, boolean useTexture){
    if (this.isTextureEnabled() && useTexture){
      p.vertex(v.x, v.y, v.z, v.getTexCoordU(), v.getTexCoordV());
    }else{
      if (v.getType() == Vector3D.BEZIERVERTEX){
        BezierVertex b = (BezierVertex)v;
        p.bezierVertex(
            b.getFirstCtrlPoint().x,  b.getFirstCtrlPoint().y,  b.getFirstCtrlPoint().z,
            b.getSecondCtrlPoint().x, b.getSecondCtrlPoint().y, b.getSecondCtrlPoint().z,
            b.x, b.y, b.z  );
      }
      else{
        p.vertex(v.x, v.y, v.z);
      }
View Full Code Here

    if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
      Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());
      Vertex quadControlPoint = new Vertex(x1,y1,0);
      //Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo
      BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(lastEndPoint, quadControlPoint , new Vertex(x, y, 0));

      cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);

      pathPoints.add(b5);
      currentSubPath.add(b5);
View Full Code Here

     
      Vertex lastEndPoint = new Vertex(lastPoint.getX(), lastPoint.getY(), lastPoint.getZ());
      Vertex quadControlPoint = new Vertex(lastPoint.getX() + x1, lastPoint.getY()+ y1, 0);
     
      //Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo
      BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
          lastEndPoint,
          quadControlPoint ,
          new Vertex(lastPoint.getX() + x, lastPoint.getY()+ y, 0));

      cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
View Full Code Here

      //Rotate that controlpoint around the end point of the last QuadTo
      lastQuadControlPoint.rotateZ(lastEndPoint, 180);

      //Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo
      BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(lastEndPoint, lastQuadControlPoint , new Vertex(x, y, 0));

      //Save last quad control point
      cubicBezVertTOQuadricControlPoint.put(b5, lastQuadControlPoint);
     
      pathPoints.add(b5);
      currentSubPath.add(b5);
    }else{
      if (verbose)
        System.out.println("Couldnt get last controlpoint at: curvetoQuadraticSmoothAbs - using last point as controlpoint");
     
      //If we couldnt retrieve the controlpoint of the current point,
      //we use the current point as the new controlpoint
      Vertex lastEndPoint   = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
      Vertex quadControlPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
     
      BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
          lastEndPoint,
          quadControlPoint ,
          new Vertex(x, y, 0));
     
      cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
View Full Code Here

      //Rotate that controlpoint around the end point of the last QuadTo
      lastQuadControlPoint.rotateZ(lastEndPoint, 180);

      //Put in startPoint = last QuadTo Endpoint of this smoothQuadTo, the calculated control point, and the endpoint of smoothQuadTo
      BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
          lastEndPoint,
          lastQuadControlPoint ,
          new Vertex(lastPoint.getX() + x, lastPoint.getY() + y, 0));

      //Save last quad control point
      cubicBezVertTOQuadricControlPoint.put(b5, lastQuadControlPoint);
      pathPoints.add(b5);
      currentSubPath.add(b5);
    }else{
      if (verbose)
        System.out.println("couldnt get last control point at curvetoQuadraticSmoothRel - using last point as the control point");
     
      Vertex lastEndPoint   = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
      Vertex quadControlPoint =  new Vertex(lastPoint.getX(),lastPoint.getY(),0);
     
      BezierVertex b5 = ToolsGeometry.getCubicFromQuadraticCurve(
          lastEndPoint,
          quadControlPoint ,
          new Vertex(lastPoint.getX() + x, lastPoint.getY() + y, 0));
     
      cubicBezVertTOQuadricControlPoint.put(b5, quadControlPoint);
View Full Code Here

   */
  public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException {
    if (verbose)
      System.out.println("curvetoCubicAbs x1:" + x1 + " y1:" + y1 + " x2:" + x2 + " y2:" + y2 +  " x:" + x+ " y:" + y);

    BezierVertex b = new BezierVertex(x1,y1,0, x2,y2,0, x,y,0);
    pathPoints.add(b);
    currentSubPath.add(b);
  }
View Full Code Here

  public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException {
    if (verbose)
      System.out.println("curvetoCubicSmoothRel: " + x1 + "," + y1 + "  " + x2 + "," + y2 + "  "  + x + "," + y);

    Vertex lastPoint = pathPoints.getLast();
    BezierVertex b = new BezierVertex(
        lastPoint.getX()+ x1, lastPoint.getY() + y1,0,
        lastPoint.getX()+ x2, lastPoint.getY() + y2,0,
        lastPoint.getX()+ x, lastPoint.getY() + y,0);
    pathPoints.add(b);
    currentSubPath.add(b);
View Full Code Here

    if (verbose)
      System.out.println("curvetoCubicSmoothAbs x2:" + x2 + " y2:" + y2 + " x:" + x+ " y:" + y);

    Vertex lastPoint = pathPoints.getLast();
    if (lastPoint instanceof BezierVertex){
      BezierVertex lastBez = (BezierVertex)lastPoint;

      Vertex lastConPointCopy = (Vertex)lastBez.getSecondCtrlPoint().getCopy();
      //reflect the last controlpoint at the current point
      lastConPointCopy.rotateZ(lastPoint, 180);
      BezierVertex b = new BezierVertex(lastConPointCopy.getX(),lastConPointCopy.getY(),0, x2,y2,0, x,y,0);

      pathPoints.add(b);
      currentSubPath.add(b);
    }else{
      if (verbose)
        System.out.println("Couldnt get last controlpoint at: curvetoCubicSmoothAbs - using last point as first controlpoint");
     
      Vertex lastEndPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
      BezierVertex b = new BezierVertex(
          lastEndPoint.getX(),lastEndPoint.getY(),0,
          x2,y2,0,
          x,y,0);
     
      pathPoints.add(b);
View Full Code Here

    if (verbose)
      System.out.println("curvetoCubicSmoothRel: " + x2 + "," + y2 + "  " + x + "," + y);
   
    Vertex lastPoint = pathPoints.getLast();
    if (lastPoint instanceof BezierVertex){
      BezierVertex lastBez = (BezierVertex)lastPoint;

      Vertex lastConPointCopy = (Vertex)lastBez.getSecondCtrlPoint().getCopy();
      //reflect the last controlpoint at the current point
      lastConPointCopy.rotateZ(lastPoint, 180);
     
      BezierVertex b = new BezierVertex(
          lastConPointCopy.getX()  ,  lastConPointCopy.getY()0,
          lastPoint.getX() + x2,    lastPoint.getY() + y2,    0,
          lastPoint.getX() + x,     lastPoint.getY() + y,      0);

      pathPoints.add(b);
      currentSubPath.add(b);
    }else{
      if (verbose)
        System.out.println("Couldnt get last controlpoint at: curvetoCubicSmoothRel - using last point as first controlpoint");
     
      Vertex lastEndPoint = new Vertex(lastPoint.getX(),lastPoint.getY(),0);
      BezierVertex b     = new BezierVertex(
          lastEndPoint.getX(),lastEndPoint.getY(),0,
          lastEndPoint.getX()+ x2, lastEndPoint.getY()+ y2, 0,
          lastEndPoint.getX()+ x, lastEndPoint.getY()+ y, 0);
     
      pathPoints.add(b);
View Full Code Here

TOP

Related Classes of org.mt4j.util.math.BezierVertex

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.