Package toxi.geom

Examples of toxi.geom.Vec2D.rotate()


  }

  public static Vec2D rotate(Vec2D curVec, Vec2D center, float r) {
    Vec2D returnVec = curVec.copy();
    returnVec.subSelf(center);
    returnVec.rotate(r);
    returnVec.addSelf(center);
    return returnVec;
   
   
  }
View Full Code Here


      // do we want to add a strenghtening beam to the leg
      if (crossSliceSelection.tieToLeg) {
        SketchPoint point1 = (SketchPoint) guideSpline.get(0);
        SketchPoint point2 = (SketchPoint) guideSpline.get(1);
        Vec2D dir2D = point1.sub(point2).normalize();
        dir2D.rotate((float) (Math.PI / 2));
        vecPos = new Vec3D(point2.x, point2.y, 0);
        vecDir = new Vec3D(dir2D.x, dir2D.y, 0);
      }

      SlicePlane slicePlane = new SlicePlane(new Plane(vecPos, vecDir));
View Full Code Here

      // do we want to add a strengthening beam to the leg
      if (crossSliceSelection.tieToLeg) {
        SketchPoint point1 = (SketchPoint) guideSpline.get(0);
        SketchPoint point2 = (SketchPoint) guideSpline.get(1);
        Vec2D dir2D = point1.sub(point2).normalize();
        dir2D.rotate((float) (Math.PI / 2));
        vecPos = new Vec3D(point1.x, point1.y, 0);
        vecDir = new Vec3D(dir2D.x, dir2D.y, 0);
      }

      SlicePlane slicePlane = new SlicePlane(new Plane(vecPos, vecDir));
View Full Code Here

                if (crossSliceSelection.flipSide) {
                  Vec2D slotPos = bottomIntersectX.copy();
                  Vec2D dirPerp = new Vec2D(vecDir.x,
                      vecDir.y);
                  dirPerp.rotate((float) (Math.PI / 2));
                  SliceSlot slot = new SliceSlot(slicePlane,
                      slotPos, new Vec2D(
                          -vecDir.x,
                          -vecDir.y),
                      (len / 2f),
View Full Code Here

                } else {
                  Vec2D slotPos = topIntersectX.copy();
                  Vec2D dirPerp = new Vec2D(vecDir.x,
                      vecDir.y);
                  dirPerp.rotate((float) (Math.PI / 2));
                  SliceSlot slot = new SliceSlot(slicePlane,
                      slotPos,
                      new Vec2D(vecDir.x,
                          vecDir.y),
                      (len / 2f),
View Full Code Here

    vecAfter = (Vec2D) vecAfter.sub(vecBefore);
    vecAfter.normalize();
    // SketchPoint newAn = vecAfter.getRotated((float)(Math.PI/2));

    if (WoundClockwise())
      vecAfter = vecAfter.rotate((float) Math.PI);

    return vecAfter;
  }

  // /-------------------------------------------------------------------------------------------------------
View Full Code Here

  }

  public static Vec2D rotate(Vec2D curVec, Vec2D center, float r) {
    Vec2D returnVec = curVec.copy();
    returnVec.subSelf(center);
    returnVec.rotate(r);
    returnVec.addSelf(center);
    return returnVec;
   
   
  }
View Full Code Here

      scale = gui.applet.constrain(scale, 0.1f, 0.15f);
      scale = 0.15f; //just keep one scale at the moment

     
      Vec2D v = new Vec2D(width/2,GLOBAL.sketchChairs.getCurChair().getWidth()/2.0f);
      v.rotate((float) (Math.PI/2));
      float rotatedWidth = -v.x*2;
      float totalWidth = ((rotatedWidth*scale)+(width*scale/2));

      float yBorder = 10;
     
View Full Code Here

      scale = gui.applet.constrain(scale, 0.1f, 0.15f);
      scale = 0.15f;//0.15f; //just keep one scale at the moment


      Vec2D v = new Vec2D(width/2,GLOBAL.sketchChairs.getCurChair().getWidth()/2.0f);
      v.rotate((float) (Math.PI/2));
      float rotatedWidth = -v.x*2;
     
      float yBorder =10;
      float totalWidth = ((rotatedWidth*scale)+(width*scale/2));
      //setting at 0 0 draws the chair in the top left corner of the fbo
View Full Code Here

            gfx.line(a, b);
        }
        if (type == Type.START || type == Type.BOTH) {
            Vec2D dir = b.sub(a).rotate(theta).normalizeTo(length);
            gfx.line(a, a.add(dir));
            dir.rotate(-theta * 2);
            gfx.line(a, a.add(dir));
        }
        if (type == Type.END || type == Type.BOTH) {
            Vec2D dir = b.sub(a).rotate(MathUtils.PI - theta)
                    .normalizeTo(length);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.