Package javax.vecmath

Examples of javax.vecmath.Matrix4d


        // 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);
        scale = (float)m.getScale();
        rotation.set((float)q.x, (float)q.y, (float)q.z, (float)q.w);
        translation.set((float)t.x, (float)t.y, (float)t.z);

        return this;
    }
View Full Code Here


/* 260 */       if (this.elements.size() == 3) {
/* 261 */         if ((!(this.elements.get(1) instanceof Point4d)) || (!(this.elements.get(2) instanceof Point4d)))
/*     */         {
/* 263 */           syntaxError(st, file, "All rows must have four elements");
/*     */         }
/* 265 */         return new Matrix4d(((Point4d)this.elements.get(0)).x, ((Point4d)this.elements.get(0)).y, ((Point4d)this.elements.get(0)).z, ((Point4d)this.elements.get(0)).w, ((Point4d)this.elements.get(1)).x, ((Point4d)this.elements.get(1)).y, ((Point4d)this.elements.get(1)).z, ((Point4d)this.elements.get(1)).w, ((Point4d)this.elements.get(2)).x, ((Point4d)this.elements.get(2)).y, ((Point4d)this.elements.get(2)).z, ((Point4d)this.elements.get(2)).w, 0.0D, 0.0D, 0.0D, 1.0D);
/*     */       }
/*     */
/* 279 */       if (this.elements.size() != 4) {
/* 280 */         syntaxError(st, file, "Matrix must have three or four rows");
/*     */       }
/* 282 */       if ((!(this.elements.get(1) instanceof Point4d)) || (!(this.elements.get(2) instanceof Point4d)) || (!(this.elements.get(3) instanceof Point4d)))
/*     */       {
/* 285 */         syntaxError(st, file, "All rows must have four elements");
/*     */       }
/* 287 */       return new Matrix4d(((Point4d)this.elements.get(0)).x, ((Point4d)this.elements.get(0)).y, ((Point4d)this.elements.get(0)).z, ((Point4d)this.elements.get(0)).w, ((Point4d)this.elements.get(1)).x, ((Point4d)this.elements.get(1)).y, ((Point4d)this.elements.get(1)).z, ((Point4d)this.elements.get(1)).w, ((Point4d)this.elements.get(2)).x, ((Point4d)this.elements.get(2)).y, ((Point4d)this.elements.get(2)).z, ((Point4d)this.elements.get(2)).w, ((Point4d)this.elements.get(3)).x, ((Point4d)this.elements.get(3)).y, ((Point4d)this.elements.get(3)).z, ((Point4d)this.elements.get(3)).w);
/*     */     }
/*     */
/* 306 */     syntaxError(st, file, "Syntax error");
/* 307 */     return null;
/*     */   }
View Full Code Here

/* 405 */     if ((!(elements.get(1) instanceof Double)) || (!(elements.get(2) instanceof Double)) || (!(elements.get(3) instanceof Double)))
/*     */     {
/* 408 */       throw new IllegalArgumentException("All arguments to Translate must be numbers");
/*     */     }
/*     */
/* 412 */     Matrix4d m4d = new Matrix4d();
/* 413 */     m4d.set(new Vector3d(((Double)elements.get(1)).doubleValue(), ((Double)elements.get(2)).doubleValue(), ((Double)elements.get(3)).doubleValue()));
/*     */
/* 417 */     return m4d;
/*     */   }
View Full Code Here

/* 446 */     double z = Math.toRadians(((Double)elements.get(3)).doubleValue());
/*     */
/* 448 */     Transform3D t3d = new Transform3D();
/* 449 */     t3d.setEuler(new Vector3d(x, y, z));
/*     */
/* 451 */     Matrix4d m4d = new Matrix4d();
/* 452 */     t3d.get(m4d);
/*     */
/* 454 */     return m4d;
/*     */   }
View Full Code Here

/* 478 */     if ((!(elements.get(1) instanceof Matrix4d)) || (!(elements.get(2) instanceof Matrix4d)))
/*     */     {
/* 480 */       throw new IllegalArgumentException("Both arguments to " + functionName + " must be Matrix4d");
/*     */     }
/*     */
/* 488 */     Matrix4d m4d = new Matrix4d((Matrix4d)elements.get(2));
/* 489 */     m4d.mul((Matrix4d)elements.get(1));
/*     */
/* 491 */     return m4d;
/*     */   }
View Full Code Here

/*     */
/*     */   void createJava3dObject(LwsObject cloneObject, int loadBehaviors)
/*     */     throws IncorrectFormatException, ParsingErrorException, FileNotFoundException
/*     */   {
/* 407 */     String seqToken = new String("_sequence_");
/* 408 */     Matrix4d mat = new Matrix4d();
/* 409 */     mat.setIdentity();
/*     */
/* 412 */     LwsFrame firstFrame = this.motion.getFirstFrame();
/* 413 */     firstFrame.setMatrix(mat);
/* 414 */     Transform3D t1 = new Transform3D();
/* 415 */     t1.set(mat);
View Full Code Here

/*     */
/*     */   void setMatrix(Matrix4d mat)
/*     */   {
/* 269 */     setRotationMatrix(mat);
/* 270 */     mat.setTranslation(new Vector3d(this.x, this.y, this.z));
/* 271 */     Matrix4d m = new Matrix4d();
/* 272 */     m.setColumn(0, this.xScale, 0.0D, 0.0D, 0.0D);
/* 273 */     m.setColumn(1, 0.0D, this.yScale, 0.0D, 0.0D);
/* 274 */     m.setColumn(2, 0.0D, 0.0D, this.zScale, 0.0D);
/* 275 */     m.setColumn(3, 0.0D, 0.0D, 0.0D, 1.0D);
/* 276 */     mat.mul(m);
/*     */   }
View Full Code Here

/*     */   void setRotationMatrix(Matrix4d mat)
/*     */   {
/* 284 */     debugOutputLn(1, "setRotMat()");
/* 285 */     debugOutputLn(2, " p, h, b = " + this.pitch + ", " + this.heading + ", " + this.bank);
/*     */
/* 289 */     Matrix4d pitchMat = new Matrix4d();
/* 290 */     pitchMat.rotX(-this.pitch);
/* 291 */     Matrix4d bankMat = new Matrix4d();
/* 292 */     bankMat.rotZ(this.bank);
/* 293 */     mat.rotY(-this.heading);
/* 294 */     mat.mul(pitchMat);
/* 295 */     mat.mul(bankMat);
/* 296 */     debugOutputLn(2, "setRotMat(), mat = " + mat);
/*     */   }
View Full Code Here

/* 173 */     return this.parent;
/*     */   }
/*     */
/*     */   void createJava3dObject(int loadBehaviors)
/*     */   {
/* 180 */     Matrix4d mat = new Matrix4d();
/* 181 */     mat.setIdentity();
/*     */
/* 184 */     LwsFrame firstFrame = this.motion.getFirstFrame();
/* 185 */     firstFrame.setMatrix(mat);
/* 186 */     debugOutputLn(2, "Light transform = " + mat);
/* 187 */     Transform3D t1 = new Transform3D();
View Full Code Here

/* 106 */     return this.parent;
/*     */   }
/*     */
/*     */   void createJava3dObject(int loadBehaviors)
/*     */   {
/* 116 */     Matrix4d mat = new Matrix4d();
/* 117 */     mat.setIdentity();
/*     */
/* 120 */     LwsFrame firstFrame = this.motion.getFirstFrame();
/* 121 */     firstFrame.setMatrix(mat);
/* 122 */     debugOutputLn(2, "  Camera Matrix = \n" + mat);
/* 123 */     Transform3D t1 = new Transform3D();
/* 124 */     Matrix4d m = new Matrix4d();
/* 125 */     double scale = 0.1D;
/* 126 */     m.setColumn(0, scale, 0.0D, 0.0D, 0.0D);
/* 127 */     m.setColumn(1, 0.0D, scale, 0.0D, 0.0D);
/* 128 */     m.setColumn(2, 0.0D, 0.0D, scale, 0.0D);
/* 129 */     m.setColumn(3, 0.0D, 0.0D, 0.0D, 1.0D);
/* 130 */     Transform3D scaleTrans = new Transform3D(m);
/* 131 */     TransformGroup scaleGroup = new TransformGroup(scaleTrans);
/* 132 */     scaleGroup.setCapability(18);
/* 133 */     scaleGroup.setCapability(17);
/*     */
View Full Code Here

TOP

Related Classes of javax.vecmath.Matrix4d

Copyright © 2018 www.massapicom. 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.