Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vertex


   */
  public void linetoVerticalAbs(float y) throws ParseException {
    if (verbose)
      System.out.println("linetoVerticalAbs y:" + y);
   
    Vertex vert = new Vertex(pathPoints.getLast().getX(), y, 0);
    pathPoints.add(vert);
    currentSubPath.add(vert);
  }
View Full Code Here


   */
  public void linetoVerticalRel(float y) throws ParseException {
    if (verbose)
      System.out.println("linetoVerticalRel: " + y);
   
    Vertex vert = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY() + y, 0);
    pathPoints.add(vert);
    currentSubPath.add(vert);
  }
View Full Code Here

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

    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

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

    if (!pathPoints.isEmpty() && pathPoints.getLast() != null){
      Vertex lastPoint = pathPoints.getLast();
     
      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);
      pathPoints.add(b5);
      currentSubPath.add(b5);
    }else{
View Full Code Here

   */
  public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException {
    if (verbose)
      System.out.println("curvetoQuadraticSmoothAbs " + " x:" + x+ " y:" + y);

    Vertex lastPoint = pathPoints.getLast();
    if (lastPoint instanceof BezierVertex && cubicBezVertTOQuadricControlPoint.get(lastPoint) != null){
      Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());

      //Get control point of last QuadTo
      Vertex lastQuadControlPoint = cubicBezVertTOQuadricControlPoint.get(lastPoint);
      cubicBezVertTOQuadricControlPoint.remove(lastPoint);

      //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);
      pathPoints.add(b5);
      currentSubPath.add(b5);
    }
View Full Code Here

   */
  public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException {
    if (verbose)
      System.out.println("curvetoQuadraticSmoothRel: " + x + "," + y);
   
    Vertex lastPoint = pathPoints.getLast();
    if (lastPoint instanceof BezierVertex && cubicBezVertTOQuadricControlPoint.get(lastPoint) != null){
      Vertex lastEndPoint = new Vertex(pathPoints.getLast().getX(), pathPoints.getLast().getY(), pathPoints.getLast().getZ());

      //Get control point of last QuadTo
      Vertex lastQuadControlPoint = cubicBezVertTOQuadricControlPoint.get(lastPoint);
      cubicBezVertTOQuadricControlPoint.remove(lastPoint);

      //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);
      pathPoints.add(b5);
      currentSubPath.add(b5);
    }
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

   */
  public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException {
    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);
      currentSubPath.add(b);
View Full Code Here

   */
  public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException {
    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);
      currentSubPath.add(b);
    }
  }
View Full Code Here

    this.setStrokeColor(new MTColor(0,0,0));
    this.setFillColor(new MTColor(50,50,50,200));
//    this.setNoFill(true);
   
    //Create movieclip child
    Vertex movieClipUpperLeft = new Vertex(upperLeft);
    movieClipUpperLeft.y += topBarHeight;
    movieClipUpperLeft.x += sideBarWidth;
    this.movieClip = new MovieClip(movieFile, movieClipUpperLeft, ifps, pApplet);
    this.movieClip.setStrokeColor(new MTColor(0,0,0));
    this.movieClip.setStrokeWeight(0.5f);
View Full Code Here

TOP

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

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.