Examples of Vector3d


Examples of javax.vecmath.Vector3d

          bounds.getUpper(upper);
         
          // Translate model to center
          Transform3D translation = new Transform3D ();
          translation.setTranslation(
              new Vector3d(-lower.x - (upper.x - lower.x) / 2,
                           -lower.y - (upper.y - lower.y) / 2,
                           -lower.z - (upper.z - lower.z) / 2));
          // Scale model to make it fit in a 1.8 unit wide box
          Transform3D modelTransform = new Transform3D();
          modelTransform.setScale (1.8 / Math.max (Math.max (upper.x -lower.x, upper.y - lower.y),
View Full Code Here

Examples of javax.vecmath.Vector3d

      bounds.getUpper(upper);
   
      // Translate model to center
      Transform3D translation = new Transform3D ();
      translation.setTranslation(
          new Vector3d(-lower.x - (upper.x - lower.x) / 2,
                       -lower.y - (upper.y - lower.y) / 2,
                       -lower.z - (upper.z - lower.z) / 2));
      // Apply model rotation
      Transform3D rotationTransform = new Transform3D();
      if (modelRotation != null) {
View Full Code Here

Examples of javax.vecmath.Vector3d

      bounds.getUpper(upper);
     
      // Translate model to center
      Transform3D translation = new Transform3D ();
      translation.setTranslation(
          new Vector3d(-lower.x - (upper.x - lower.x) / 2,
                       -lower.y - (upper.y - lower.y) / 2,
                       -lower.z - (upper.z - lower.z) / 2));
      // Scale model to make it fill a 1 unit wide box
      Transform3D scaleOneTransform = new Transform3D();
      scaleOneTransform.setScale (
          new Vector3d(1 / Math.max(0.0001, upper.x -lower.x),
              1 / Math.max(0.0001, upper.y - lower.y),
              1 / Math.max(0.0001, upper.z - lower.z)));
      scaleOneTransform.mul(translation);
      // Apply model rotation
      Transform3D rotationTransform = new Transform3D();
      if (modelRotation != null) {
        Matrix3f modelRotationMatrix = new Matrix3f(modelRotation [0][0], modelRotation [0][1], modelRotation [0][2],
            modelRotation [1][0], modelRotation [1][1], modelRotation [1][2],
            modelRotation [2][0], modelRotation [2][1], modelRotation [2][2]);
        rotationTransform.setRotation(modelRotationMatrix);
      }
      rotationTransform.mul(scaleOneTransform);
      // Scale model to its size
      Transform3D scaleTransform = new Transform3D();
      if (width != 0 && depth != 0 && height != 0) {
        scaleTransform.setScale(new Vector3d(width, height, depth));
      }
      scaleTransform.mul(rotationTransform);
      // Scale model to make it fit in a 1.8 unit wide box     
      Transform3D modelTransform = new Transform3D();
      if (width != 0 && depth != 0 && height != 0) {
View Full Code Here

Examples of javax.vecmath.Vector3d

    modelBounds.getUpper(upper);
   
    // Translate model to its center
    Transform3D translation = new Transform3D();
    translation.setTranslation(
        new Vector3d(-lower.x - (upper.x - lower.x) / 2,
            -lower.y - (upper.y - lower.y) / 2,
            -lower.z - (upper.z - lower.z) / 2));     
    // Scale model to make it fill a 1 unit wide box
    Transform3D scaleOneTransform = new Transform3D();
    scaleOneTransform.setScale (
        new Vector3d(width / Math.max(MINIMUM_SIZE, upper.x -lower.x),
            width / Math.max(MINIMUM_SIZE, upper.y - lower.y),
            width / Math.max(MINIMUM_SIZE, upper.z - lower.z)));
    scaleOneTransform.mul(translation);
    Transform3D modelTransform = new Transform3D();
    if (modelRotation != null) {
View Full Code Here

Examples of javax.vecmath.Vector3d

    float pieceWidth = piece.getWidth();
    // If piece model is mirrored, inverse its width
    if (piece.isModelMirrored()) {
      pieceWidth *= -1;
    }
    scale.setScale(new Vector3d(pieceWidth, piece.getHeight(), piece.getDepth()));
    // Change its angle around y axis
    Transform3D orientation = new Transform3D();
    orientation.rotY(-piece.getAngle());
    orientation.mul(scale);
    // Translate it to its location
View Full Code Here

Examples of javax.vecmath.Vector3d

//        this.translation.addLocal(rotation.mult(in.translation).multLocal(in.scale));
//        this.rotation.multLocal(in.rotation);

        // Correctly calculate the multiplication.
        Quat4d q = new Quat4d(rotation.x, rotation.y, rotation.z, rotation.w);
        Vector3d t = new Vector3d(translation.x, translation.y, translation.z);
        Matrix4d m = new Matrix4d(q,t,scale);

        Quat4d q1 = new Quat4d(in.rotation.x, in.rotation.y, in.rotation.z, in.rotation.w);
        Vector3d t1 = new Vector3d(in.translation.x, in.translation.y, in.translation.z);
        Matrix4d m1 = new Matrix4d(q1,t1,in.scale);

        m.mul(m1);

        m.get(q);
View Full Code Here

Examples of javax.vecmath.Vector3d

//        rotation.fromRotationMatrix(rot);

        // Correctly compute the inversion, use Vecmath as the matrix invert
        // in JME does not function when scale!=1
        Quat4d q = new Quat4d(rotation.x, rotation.y, rotation.z, rotation.w);
        Vector3d t = new Vector3d(translation.x, translation.y, translation.z);
        Matrix4d m = new Matrix4d(q,t,scale);
        m.invert();

        m.get(q);
        m.get(t);
View Full Code Here

Examples of net.wigis.graph.dnv.utilities.Vector3D

          {
            Map<Integer, DNVNode> nodes = node.getNodesAtDistance( distance );
            if( nodes != null && nodes.size() > 0 )
            {
              anyNodes = true;
              Vector3D color = new Vector3D( LIGHT_GREEN );
              Vector3D difference = new Vector3D( LIGHT_RED );
              difference.subtract( color );
              difference.dotProduct( (float)( distance - 1 ) / (float)maxDistance );
              color.add( difference );
              Vector3D outlineColor = new Vector3D( color );
              outlineColor.setX( (float)Math.max( 0, outlineColor.getX() - 0.3 ) );
              outlineColor.setY( (float)Math.max( 0, outlineColor.getY() - 0.3 ) );
              outlineColor.setZ( (float)Math.max( 0, outlineColor.getZ() - 0.3 ) );
              int drawn = drawBoxAround( distance, subgraph.getNodes(), nodes, g2d, width, height, minXPercent, minYPercent,
                  maxXPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, color, outlineColor, pb, overview, node, drawnHeadings,
                  drawNumberOfNodesInBox, drawNeighborHighlightAsBoxes, drawAllNeighborsHighlight, alignBoxInfoRelativeToBox,
                  headerAlignment );
View Full Code Here

Examples of org.apache.commons.math.geometry.Vector3D

    checkVector(v.scalarMultiply(0.5), 1.5, 3, 4.5);

  }

  public void testVectorialProducts() {
    Vector3D v1 = new Vector3D(2, 1, -4);
    Vector3D v2 = new Vector3D(3, 1, -1);

    assertTrue(Math.abs(Vector3D.dotProduct(v1, v2) - 11) < 1.0e-12);

    Vector3D v3 = Vector3D.crossProduct(v1, v2);
    checkVector(v3, 3, -10, -1);

    assertTrue(Math.abs(Vector3D.dotProduct(v1, v3)) < 1.0e-12);
    assertTrue(Math.abs(Vector3D.dotProduct(v2, v3)) < 1.0e-12);
View Full Code Here

Examples of org.apache.commons.math3.geometry.euclidean.threed.Vector3D

        double closest = tolerance;
        Edge following = null;
        for (final BSPTree<Sphere2D> node : candidates) {
            for (final Edge edge : nodeToEdgesList.get(node)) {
                if (edge != previous && edge.getStart().getIncoming() == null) {
                    final Vector3D edgeStart = edge.getStart().getLocation().getVector();
                    final double gap         = Vector3D.angle(point.getVector(), edgeStart);
                    if (gap <= closest) {
                        closest   = gap;
                        following = edge;
                    }
                }
            }
        }

        if (following == null) {
            final Vector3D previousStart = previous.getStart().getLocation().getVector();
            if (Vector3D.angle(point.getVector(), previousStart) <= tolerance) {
                // the edge connects back to itself
                return previous;
            }
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.