Examples of Vec3D


Examples of toxi.geom.Vec3D

   * @return
   */
  public Vec3D getPhysicsOrigin() {

    if (currentWorldTransform == null || rigidBody == null)
      return new Vec3D(0, 0, 0);

    float scaleBy = 1f / GLOBAL.jBullet.getScale();
    Transform myTransform = new Transform();
    myTransform = rigidBody.getMotionState().getWorldTransform(myTransform);

    Vector3f center = new Vector3f();
    rigidBody.getCenterOfMassPosition(center);

    return new Vec3D(center.x, center.y, center.z);
  }
View Full Code Here

Examples of toxi.geom.Vec3D

      GLOBAL.jBullet.myWorld.removeRigidBody(this.rigidBody);
      GLOBAL.jBullet.rigidBodies.remove(this.rigidBody);
      GLOBAL.jBullet.myWorld.stepSimulation(1);
    }

    Vec3D centreOfMass = this.getCentreOfMass();
    this.centreOfMass = centreOfMass;
    indexVertexArrays = this.getVertexArray(centreOfMass.x, centreOfMass.y,
        centreOfMass.z);
    //this.buildCoverMesh(indexVertexArrays, centreOfMass);
View Full Code Here

Examples of toxi.geom.Vec3D

   
   

    for (float i = (-this.getWidth() / 2); i < (this.getWidth() / 2); i += spacing) {
      SlicePlane slicePlane = new SlicePlane(new Plane(
          new Vec3D(0, 0, i), new Vec3D(0, 0, -1)));
      this.getSlicePlanesY().add(slicePlane);
    }

    //this.updateCollisionShape();
    this.selectedPlanes.empty();
View Full Code Here

Examples of toxi.geom.Vec3D

  /**
   * Flip the design around the Z Axis.
   */
  public void flipDesign() {
    Vec3D centre = this.getCentreOfMass();
    this.getSlicePlanesY().flipHorizontal(centre);
    this.buildLen();
  }
View Full Code Here

Examples of toxi.geom.Vec3D

  /**
   * Return the center of mass for the current design.
   * @return
   */
  private Vec3D getCentreOfMass() {
    Vec3D centre = new Vec3D();
    int planeCount = 0;
    for (int i = 0; i < this.getSlicePlanesY().size(); i++) {
      SlicePlane slicePlane = this.getSlicePlanesY().get(i);
      if (slicePlane.getCentreOfMass() != null) {
        centre.addSelf(slicePlane.getCentreOfMass());
        planeCount++;
      }
    }

    centre.x /= planeCount;
View Full Code Here

Examples of toxi.geom.Vec3D

    return slicePlanesY;
  }

  //translates into model space
  public Vec3D getTranslated(Vec3D pIn) {
    Vec3D p = pIn.copy();
    if (this.built == true) {

      if (rigidBody == null) {
        LOGGER.debug("no rigid body in get Translated");
        return p;
View Full Code Here

Examples of toxi.geom.Vec3D

      // return;
    }

    this.hybernate();

    Vec3D thisCentre = this.getCentreOfMass();

    Transform worldTransform = new Transform();
    rigidBody.getMotionState().getWorldTransform(worldTransform);
    // worldTransform.origin.setX(
    // this.startWorldTransform.origin.x-worldTransform.origin.x );

    // worldTransform.origin.y - this.startWorldTransform.origin.y,
    // worldTransform.origin.z - this.startWorldTransform.origin.z

    // ));
    Vec3D thatCentre = newChair.getCentreOfMass();
    // System.out.println("ORIGIN" + worldTransform.origin.y+ " : " +
    // (thisCentre.y) + ": " + thatCentre.y);

    worldTransform.origin.x = (worldTransform.origin.x + (thatCentre.x - thisCentre.x));
    worldTransform.origin.y = (worldTransform.origin.y + ((thatCentre.y - thisCentre.y)));
View Full Code Here

Examples of toxi.geom.Vec3D

      if (deltaMx > maxMouse || deltaMx < -maxMouse || deltaMy > maxMouse
          || deltaMy < -maxMouse)
        return;

      this.drag(new Vec3D(deltaMx, deltaMy, 0));
    }
  }
View Full Code Here

Examples of toxi.geom.Vec3D

  /**
   * Scale the current design.
   * @param scale
   */
  private void scale(float scale) {
    Vec3D centre = this.getCentreOfMass();
    centre.scaleSelf(1 / GLOBAL.jBullet.scale);
    this.getSlicePlanesY().scale(scale, centre);
    this.scale += scale;
  }
View Full Code Here

Examples of toxi.geom.Vec3D

      return;
    }
    // if (this.rigidBody != null)
    // GLOBAL.jBullet.myWorld.removeRigidBody(this.rigidBody);

    Vec3D centreOfMassOld = this.centreOfMass.copy();
    Vec3D centreOfMassTemp = this.getCentreOfMass();

    LOGGER.debug("current centre" + centreOfMassOld);
    LOGGER.debug("current centre Translated "
        + getTranslated(centreOfMassOld));

    LOGGER.debug("new centre" + centreOfMassTemp);
    LOGGER.debug("new centre Translated" + getTranslated(centreOfMassTemp));

    this.centreOfMass = centreOfMassTemp;
    Vec3D deltaCentreOfmass = getTranslated(this.centreOfMass).sub(
        getTranslated(centreOfMassOld));

    //  this.centreOfMass = centreOfMassTemp;
    // create trimesh
    indexVertexArrays = this.getVertexArray(centreOfMass.x, centreOfMass.y,
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.