Examples of Vec2D


Examples of toxi.geom.Vec2D

      mousePos.x = newX + ((chairCentreOfMass.x) / GLOBAL.jBullet.scale);
      mousePos.y = newY + ((chairCentreOfMass.y) / GLOBAL.jBullet.scale);
      //mousePos.z = centreMouseDeltaZ + chairCentreOfMass.Z;
    }

    Vec2D intersect2D = null;
    if (mousePos != null) {
      intersect2D = new Vec2D(mousePos.x, mousePos.y);
      //intersect2D = new Vec2D(mousePoint.x, mousePoint.y);

    } else {
      intersect2D = new Vec2D(mousePoint.x, mousePoint.y);
    }
    if (intersect2D == null)
      intersect2D = new Vec2D(mousePoint.x, mousePoint.y);

    return intersect2D;

  }
View Full Code Here

Examples of toxi.geom.Vec2D

  }

  public Vec2D getPointTranslated(Vec2D mousePoint) {

    Vec2D mouseRayPos = new Vec2D(mousePoint.x, mousePoint.y); // this only works for planes perpendicular to the screen

    Vec2D focusCentre = new Vec2D(
        ((GLOBAL.windowWidth / 2) - (float)GLOBAL.CAM_OFFSET_X),
        ((GLOBAL.windowHeight / 2) - (float)GLOBAL.CAM_OFFSET_Y));

    mouseRayPos.x -= (GLOBAL.windowWidth / 2);
    mouseRayPos.y -= (GLOBAL.windowHeight / 2);
View Full Code Here

Examples of toxi.geom.Vec2D

  }

  Vec2D getPointTranslatedFromWorld(Vec2D mousePoint) {

    Vec2D mouseRayPos = new Vec2D(mousePoint.x, mousePoint.y); // this only works for planes perpendicular to the screen

    Vec2D focusCentre = new Vec2D(
        ((GLOBAL.windowWidth / 2) - (float)GLOBAL.CAM_OFFSET_X),
        ((GLOBAL.windowHeight / 2) - (float)GLOBAL.CAM_OFFSET_Y));

    mouseRayPos.subSelf(focusCentre);
View Full Code Here

Examples of toxi.geom.Vec2D

          || this.SketchTools.getCurrentTool() == SketchTools.DRAW_TOOL
          || this.SketchTools.getCurrentTool() == SketchTools.SELECT_TOOL
          && !GLOBAL.gui.overComponent()
          && !GLOBAL.sketchChairs.getCurChair().overSelectPoint(
              GLOBAL.uiTools.mouseX, GLOBAL.uiTools.mouseY)) {
        Vec2D mousePos = this.getPointTranslated(new Vec2D(this.mouseX,
            this.mouseY));
        GLOBAL.jBullet.mouseDragged(mousePos.x, mousePos.y);
      }

      if ((GLOBAL.uiTools.getCurrentTool() == UITools.SCALE_TOOL)
          && !GLOBAL.gui.overComponent()) {
        //GLOBAL.person.dragScale(mouseX,mouseX); 
      }

      // middle click
      if (mouseButton == UITools.MOUSE_RIGHT
          || this.getCurrentTool() == UITools.MOVE_CAM_TOOL) {

        if (SETTINGS.render_chairs
            && GLOBAL.uiTools.currentView == UITools.VIEW_CHAIR_EDIT) {
         
          if(this.prevMouseWasMove){
           
          moveView((UI.mouseX - UI.pmouseX)
              * (float)(1 / GLOBAL.ZOOM),
              (UI.mouseY - UI.pmouseY)
              * (float)(1 / GLOBAL.ZOOM));     
          }else{
            this.prevMouseWasMove = true;
          }
         
         
          }

       
       
        if (GLOBAL.uiTools.currentView == UITools.VIEW_SHAPE_PACK) {
          GLOBAL.shapePack.CAM_OFFSET_X += (UI.mouseX - UI.pmouseX)
              * (1 / GLOBAL.shapePack.ZOOM);
          GLOBAL.shapePack.CAM_OFFSET_Y += (UI.mouseY - UI.pmouseY)
              * (1 / GLOBAL.shapePack.ZOOM);

        }
       
       
       
      }

      if (!GLOBAL.gui.overComponent()) {
        if (this.getCurrentTool() == UITools.ZOOM_CAM_TOOL) {

          if (SETTINGS.render_chairs
              && GLOBAL.uiTools.currentView == UITools.VIEW_CHAIR_EDIT){
           
            this.zoomView(((UI.mouseY - UI.pmouseY) * .01f));
           
           
          }

          if (SETTINGS.render_chairs
              && GLOBAL.uiTools.currentView == UITools.VIEW_SHAPE_PACK) {
            GLOBAL.shapePack.zoomView((UI.mouseY - UI.pmouseY) * .01f, this.mouseX, this.mouseY) ;

          }

        }

        if (this.getCurrentTool() == UITools.ROTATE_CAM_TOOL
            || mouseButton == UITools.MOUSE_MIDDLE) {
          if (SETTINGS.render_chairs
              && GLOBAL.uiTools.currentView == UITools.VIEW_CHAIR_EDIT) {
            GLOBAL.rotateModelsY -= (UI.pmouseX - UI.mouseX) / 90f;
            GLOBAL.rotateModelsX += (UI.pmouseY - UI.mouseY) / 90f;
          }
        }

        if (this.getCurrentTool() == UITools.SELECT_TOOL
            && GLOBAL.uiTools.currentView == UITools.VIEW_CHAIR_EDIT) {
          updateVecMove();
        }

      }

      if (this.getCurrentTool() != UITools.ROTATE_CAM_TOOL && GLOBAL.uiTools.currentView == UITools.VIEW_CHAIR_EDIT)
        GLOBAL.person.mouseDown(mouseX, mouseY);

      Vec2D mousePos = this.getPointTranslated(new Vec2D(this.mouseX,
          this.mouseY));

      GLOBAL.measuretTool.mousePressed(mousePos.x, mousePos.y);

   
View Full Code Here

Examples of toxi.geom.Vec2D

     
     
     
      GLOBAL.sketchChairs.mouseDragged(mouseX, mouseY);

      Vec2D MousePos = this.getPointTranslated(new Vec2D(this.mouseX,this.mouseY));

      GLOBAL.environments.mouseDragged(MousePos.x, MousePos.y);
    }

    if (GLOBAL.gui.overComponent())
View Full Code Here

Examples of toxi.geom.Vec2D

      for (Clickable obj : this.clickables) {
        obj.mouseClicked();
      }

      Vec2D MousePosPerson = this.getPointTranslated(new Vec2D(
          this.mouseX, this.mouseY));
      GLOBAL.person.mouseClicked(MousePosPerson.x, MousePosPerson.y);

      if (this.getCurrentTool() == UITools.SCALE_TOOL
          && GLOBAL.sketchChairs.getCurChair() != null) {
        GLOBAL.sketchChairs.getCurChair().mousePressed(
            MousePosPerson.x, MousePosPerson.y);
      }

      if (this.getCurrentTool() == UITools.MOVE_2D_TOOL
          && GLOBAL.sketchChairs.getCurChair() != null) {
        GLOBAL.sketchChairs.getCurChair().mousePressed(
            MousePosPerson.x, MousePosPerson.y);
      }

      if (this.getCurrentTool() == UITools.SELECT_TOOL
          || this.SketchTools.getCurrentTool() == SketchTools.SELECT_BEZIER_TOOL
          && !GLOBAL.person.clickedOnPerson) {
        //getVecOver();
        if (GLOBAL.sketchChairs.getCurChair() != null) {
          GLOBAL.sketchChairs.getCurChair().mousePressed(
              MousePosPerson.x, MousePosPerson.y);
        }
      }

      if (this.getCurrentTool() == UITools.MOVE_OBJECT
          || GLOBAL.person.clickedOnPerson) {
        Vec2D mousePos = this.getPointTranslated(new Vec2D(this.mouseX,
            this.mouseY));
        GLOBAL.jBullet.mouseDown(mousePos.x, mousePos.y);
      }

      if (this.SketchTools.getCurrentTool() == SketchTools.SELECT_TOOL
          && GLOBAL.sketchChairs.getCurChair() != null
          && GLOBAL.sketchChairs.getCurChair().countSelectedNodes() <= 0) {
        Vec2D mousePos = this.getPointTranslated(new Vec2D(this.mouseX,
            this.mouseY));

        if (GLOBAL.jBullet.physics_on)
          GLOBAL.jBullet.mouseDown(mousePos.x, mousePos.y);
      }

      if (this.getCurrentTool() == UITools.SELECT_TOOL
          && GLOBAL.sketchChairs.getCurChair() == null) {
        Vec2D mousePos = this.getPointTranslated(new Vec2D(this.mouseX,
            this.mouseY));
        GLOBAL.jBullet.mouseDown(mousePos.x, mousePos.y);
      }

      if (this.getCurrentTool() == UITools.ADD_DOLL_TOOL) {
        /*new SittingDoll(GLOBAL.jBullet.myWorld, new Vector3f(
            GLOBAL.applet.mouseX, GLOBAL.applet.mouseY, 0), 1);
        selectedVec = null;
        selectedVecPlane = null;
        */
      }

      Vec2D MousePos = this.getPointTranslated(new Vec2D(this.mouseX,
          this.mouseY));

      if (!GLOBAL.sketchChairs.getCurChair().mouseOver(MousePos.x,
          MousePos.y))
        GLOBAL.environments.mousePressed(MousePos.x, MousePos.y);
View Full Code Here

Examples of toxi.geom.Vec2D

   

    g.fill(255);
    g.ellipseMode(PApplet.CENTER);

    Vec2D physicsMousePos = this.getPointTranslated(new Vec2D(this.mouseX,
        this.mouseY));

    //
    if ((this.SketchTools.getCurrentTool() == SketchTools.SELECT_TOOL
        || this.SketchTools.getCurrentTool() == SketchTools.DRAW_TOOL)
View Full Code Here

Examples of toxi.geom.Vec2D

  public void updateMouseWorld() {

    GLOBAL.uiTools.pmouseXworld = GLOBAL.uiTools.mouseXworld;
    GLOBAL.uiTools.pmouseYworld = GLOBAL.uiTools.mouseYworld;

    Vec2D MouseWorld = this.getPointTranslated(new Vec2D(this.mouseX,
        this.mouseY));

    GLOBAL.uiTools.mouseXworld = MouseWorld.x;
    GLOBAL.uiTools.mouseYworld = MouseWorld.y;
View Full Code Here

Examples of toxi.geom.Vec2D

    float dist = -1;

    for (int i = 0; i < this.getList().size(); i++) {
      SlicePlane curPlane = this.getList().get(i);

      Vec2D pointOnPlan = GLOBAL.uiTools.getPointOnPlane(new Vec2D(x, y),
          curPlane.getPlane());

      p = curPlane.getOverSelectPoint(pointOnPlan.x, pointOnPlan.y);
      if (p != null
          && (dist == -1 || p.distanceTo(new Vec2D(pointOnPlan.x,
              pointOnPlan.y)) < dist)) {
        closest = p;
        dist = p.distanceTo(new Vec2D(pointOnPlan.x, pointOnPlan.y));
      }

    }
    return closest;
  }
View Full Code Here

Examples of toxi.geom.Vec2D

  public SketchShapes getOverShapes(float x, float y) {
    SketchShapes overShapes = new SketchShapes(null);

    for (int i = 0; i < this.getList().size(); i++) {
      SlicePlane curPlane = this.getList().get(i);
      Vec2D pointOnPlan = GLOBAL.uiTools.getPointOnPlane(new Vec2D(x, y),
          curPlane.getPlane());
      overShapes.addAll(curPlane.getOverShape(pointOnPlan.x,
          pointOnPlan.y));
    }
    return overShapes;
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.