Examples of Matrix3d


Examples of javax.vecmath.Matrix3d

        if (delta == null) delta = new Vector3d();
        delta.sub(n, p);
        delta.normalize();
        System.err.println("p->n direction: " + delta);
        Matrix3d hMatrix = new Matrix3d();
        // check using the the javax.vecmath routine
        hMatrix.m00 = h11;
        hMatrix.m01 = h12;
        hMatrix.m02 = h13;
        hMatrix.m10 = h12; // h21 = h12
        hMatrix.m11 = h22;
        hMatrix.m12 = h23;
        hMatrix.m20 = h13; // h31 = h13
        hMatrix.m21 = h23; // h32 = h22
        hMatrix.m22 = h33;
        hMatrix.invert();
        Point3d check = new Point3d(b1, b2, b3);
        hMatrix.transform(check);

        System.err.println("check point = " + check.x+" " +
      check.y+" " + check.z);
    }
View Full Code Here

Examples of javax.vecmath.Matrix3d

  }

  public BranchGroup createSceneGraph2()
  {
      Java3DFactory objectFactory = new Java3DFactory();
    Matrix3d rot = new Matrix3d();
    rot.setIdentity();
    rot.rotZ(1.5);
    Transform3D zRotation = new Transform3D(rot, new Vector3d(), 1);
    TransformGroup objTrans3 = new TransformGroup(zRotation);
    objTrans3.addChild(objectFactory.createCylinder(0.5, 3, 2, 0, 0));
   
    Entry<BoundingSphere, BranchGroup> entry = Java3DUtils.createDefaultBranchGroup(
View Full Code Here

Examples of javax.vecmath.Matrix3d

/*     */       }
/* 243 */       if ((!(this.elements.get(1) instanceof Point3d)) || (!(this.elements.get(2) instanceof Point3d)))
/*     */       {
/* 245 */         syntaxError(st, file, "All rows must have three elements");
/*     */       }
/* 247 */       return new Matrix3d(((Point3d)this.elements.get(0)).x, ((Point3d)this.elements.get(0)).y, ((Point3d)this.elements.get(0)).z, ((Point3d)this.elements.get(1)).x, ((Point3d)this.elements.get(1)).y, ((Point3d)this.elements.get(1)).z, ((Point3d)this.elements.get(2)).x, ((Point3d)this.elements.get(2)).y, ((Point3d)this.elements.get(2)).z);
/*     */     }
/*     */
/* 259 */     if ((this.elements.get(0) instanceof Point4d)) {
/* 260 */       if (this.elements.size() == 3) {
/* 261 */         if ((!(this.elements.get(1) instanceof Point4d)) || (!(this.elements.get(2) instanceof Point4d)))
View Full Code Here

Examples of javax.vecmath.Matrix3d

/*     */   {
/* 246 */     Point3d n = new Point3d();
/* 247 */     Point3d p = new Point3d();
/* 248 */     Vector3d delta = null;
/*     */
/* 251 */     Matrix3d hMatrix = new Matrix3d();
/*     */
/* 313 */     double w = 100000000.0D;
/*     */
/* 316 */     int count = 0;
/* 317 */     p.set(g);
View Full Code Here

Examples of javax.vecmath.Matrix3d

                TransformGroup transformGroup = (TransformGroup) leafBranchGroup.getChild(0);

                // test translation and rotation
                Transform3D transform3D = new Transform3D();
                transformGroup.getTransform(transform3D);
                Matrix3d rotationMatrix = new Matrix3d();
                Vector3d translationVector = new Vector3d();
                transform3D.get(rotationMatrix, translationVector);
                Matrix3d expectedRotationMatrix = new Matrix3d();
                TreeLeaf treeLeaf = mockBranchPart.getLeaves().get(nbLeavesFound);
                double rotation = treeLeaf.getTreeLeaf3D().getState().getRotation();
                expectedRotationMatrix.rotY(rotation);
                MatrixTestHelper.assertMatrixEquals(expectedRotationMatrix, rotationMatrix);
                Point3d leafAttachPoint = treeLeaf.getTreeLeaf3D().getState().getLeafAttachPoint().toPointValue();
                Vector3d expectedTranslationVector = new Vector3d(leafAttachPoint);
                VectorTestHelper.assertVectorEquals(expectedTranslationVector, translationVector);
View Full Code Here

Examples of javax.vecmath.Matrix3d

    /**
     * {@inheritDoc}
     */
    public final void multiply(final Matrix matrix) {
        final Matrix3d m;
        if (matrix instanceof Matrix3d) {
            m = (Matrix3d) matrix;
        } else {
            m = new Matrix3(matrix);
        }
View Full Code Here

Examples of javax.vecmath.Matrix3d

                TransformGroup transformGroup = (TransformGroup) leafBranchGroup.getChild(0);

                // test translation and rotation
                Transform3D transform3D = new Transform3D();
                transformGroup.getTransform(transform3D);
                Matrix3d rotationMatrix = new Matrix3d();
                Vector3d translationVector = new Vector3d();
                transform3D.get(rotationMatrix, translationVector);
                Matrix3d expectedRotationMatrix = new Matrix3d();
                TreeLeaf treeLeaf = mockBranchPart.getLeaves().get(nbLeavesFound);
                double rotation = treeLeaf.getTreeLeaf3D().getState().getRotation();
                expectedRotationMatrix.rotY(rotation);
                MatrixTestHelper.assertMatrixEquals(expectedRotationMatrix, rotationMatrix);
                Point3d leafAttachPoint = treeLeaf.getTreeLeaf3D().getState().getLeafAttachPoint().toPointValue();
                Vector3d expectedTranslationVector = new Vector3d(leafAttachPoint);
                VectorTestHelper.assertVectorEquals(expectedTranslationVector, translationVector);
View Full Code Here

Examples of org.nlogo.api.Matrix3D

      }

      if (!myTies.isEmpty()) {
        // create a matrix transform for translating the location
        // of leaf turtles
        Matrix3D htrans = new Matrix3D();
        Matrix3D ptrans = new Matrix3D();
        Matrix3D rtrans = new Matrix3D();
        double dh = Turtle.subtractHeadings(newHeading, oldHeading);
        double dp = Turtle.subtractHeadings(newPitch, oldPitch);
        double dr = Turtle.subtractHeadings(newRoll, oldRoll);


        htrans.zrot(-dh); // this transform method takes degrees, not radians
        Vect[] vects = Vect.toVectors(newHeading, oldPitch, 0);
        ptrans.vrot(0, 0, 0,
            vects[1].x(), vects[1].y(), vects[1].z(), StrictMath.toRadians(dp));
        vects = Vect.toVectors(newHeading, newPitch, oldRoll);
        rtrans.vrot(0, 0, 0,
            vects[0].x(), vects[0].y(), vects[0].z(), StrictMath.toRadians(dr));


        double[] out = new double[3];
        for (Turtle t1 : myTies) {
          try {
            Turtle3D t = (Turtle3D) t1;
            Link link = linkManager.findLink(root, t, world3D.links(), true);
            boolean rigid = link.mode().equals(Link.MODE_FIXED);

            // In order to get wrapping and line drawing to work properly
            // we have to compute our transform in coordinates relative to the
            // root turtle -- CLB 05/11/06
            double[] leaf = ((Protractor3D) (world3D.protractor())).towardsVector
                (root.xcor(), root.ycor(), root.zcor(),
                    t.xcor(), t.ycor(), t.zcor(), true);
            htrans.transform(leaf, out, 1);
            ptrans.transform(out, out, 1);
            rtrans.transform(out, out, 1);
            double nx = t.xcor + (out[0] - leaf[0]);
            double ny = t.ycor + (out[1] - leaf[1]);
            double nz = t.zcor + (out[2] - leaf[2]);

            Set<Turtle3D> snapshot = seenTurtles;
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.