public Matrix4d readMatrix4d( DataInput in ) throws IOException { double elements[] = new double[16]; for(int c=0; c<16; c++) elements[ c ] = in.readDouble(); return new Matrix4d(elements); }
/** Creates a transform with the 4 given vectors: X, Y, Z and translation of origin. */ static public Transform3D createTransform(final Vector3d[] o) { return new Transform3D(new Matrix4d( // X Y Z Trans o[0].x, o[1].x, o[2].x, o[3].x, o[0].y, o[1].y, o[2].y, o[3].y, o[0].z, o[1].z, o[2].z, o[3].z, 0, 0, 0, 1)); }
/** * Processes the built-in command (Translate x y z). * * @param elements ArrayList containing Doubles wrapping x, y, and z * translation components at indices 1, 2, and 3 respectively * * @return matrix that translates by the given x, y, and z components */ private Matrix4d makeTranslate(ArrayList elements) { if (elements.size() != 4) { throw new IllegalArgumentException ("Incorrect number of arguments to Translate") ; } if (!(elements.get(1) instanceof Double) || !(elements.get(2) instanceof Double) || !(elements.get(3) instanceof Double)) { throw new IllegalArgumentException ("All arguments to Translate must be numbers") ; } Matrix4d m4d = new Matrix4d() ; m4d.set(new Vector3d(((Double)elements.get(1)).doubleValue(), ((Double)elements.get(2)).doubleValue(), ((Double)elements.get(3)).doubleValue())) ; return m4d ; }
Matrix4d m4d = new Matrix4d((Matrix4d)elements.get(2)) ; m4d.mul((Matrix4d)elements.get(1)) ;
static FastMatrix toFastMatrix(final Transform3D t3d) { final Matrix4d m = new Matrix4d(); t3d.get(m); return new FastMatrix(new double[][] { { m.m00, m.m01, m.m02, m.m03 }, { m.m10, m.m11, m.m12, m.m13 }, { m.m20, m.m21, m.m22, m.m23 } }); }
public void writeTransform3D( DataOutput out, Transform3D tran ) throws IOException { Matrix4d matrix = new Matrix4d(); tran.get( matrix ); writeMatrix4d( out, matrix ); }
t3d.setEuler(new Vector3d(x, y, z)) ; Matrix4d m4d = new Matrix4d() ; t3d.get(m4d) ;
syntaxError(st, file, "All rows must have four elements") ; return new Matrix4d(((Point4d)elements.get(0)).x, ((Point4d)elements.get(0)).y, ((Point4d)elements.get(0)).z, syntaxError(st, file, "All rows must have four elements") ; return new Matrix4d(((Point4d)elements.get(0)).x, ((Point4d)elements.get(0)).y, ((Point4d)elements.get(0)).z,
/** * Sets the given matrix to contain the orientation for this keyframe */ void setRotationMatrix(Matrix4d mat) { debugOutputLn(TRACE, "setRotMat()"); debugOutputLn(VALUES, " p, h, b = " + pitch + ", " + heading + ", " + bank); Matrix4d pitchMat = new Matrix4d(); pitchMat.rotX(-pitch); Matrix4d bankMat = new Matrix4d(); bankMat.rotZ(bank); mat.rotY(-heading); mat.mul(pitchMat); mat.mul(bankMat); debugOutputLn(VALUES, "setRotMat(), mat = " + mat); }
TextureAttributes attr = (TextureAttributes)node; Color4f clr = new Color4f(); Matrix4d mat = new Matrix4d(); Transform3D trans = new Transform3D(); int tableComponents = attr.getNumTextureColorTableComponents();
/** * Sets the given matrix to contain the position, orientation, and * scale values for the keyframe */ void setMatrix(Matrix4d mat) { setRotationMatrix(mat); mat.setTranslation(new Vector3d(x, y, z)); Matrix4d m = new Matrix4d(); m.setColumn(0, xScale, 0, 0, 0); // setScale not yet implemented m.setColumn(1, 0, yScale, 0, 0); m.setColumn(2, 0, 0, zScale, 0); m.setColumn(3, 0, 0, 0, 1); mat.mul(m); }
Matrix4d mat = new Matrix4d(); mat.setIdentity();
Matrix4d mat = new Matrix4d();
public void readObject( DataInput in, Canvas3D canvas ) throws IOException { int mtgSize = in.readInt(); // MultiTransformGroup size if ( canvas!=null) { universe = new ConfiguredUniverse( canvas, mtgSize); } else { universe = new ConfiguredUniverse( ConfiguredUniverse.getConfigURL(), mtgSize); } MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup(); // Read and set the matrix for each MTG transfrom Matrix4d matrix = new Matrix4d(); for(int i=0; i<mtgSize; i++) { TransformGroup tg = mtg.getTransformGroup( i ); matrix = control.readMatrix4d( in ); Transform3D trans = new Transform3D( matrix ); tg.setTransform( trans ); } SceneGraphObjectState tmp = control.readObject(in); if (tmp instanceof PlatformGeometryState) platformGeom = (PlatformGeometryState)tmp; else platformGeom = null; tmp = control.readObject(in); if (tmp instanceof ViewerAvatarState) viewerAvatar = (ViewerAvatarState)tmp; else viewerAvatar = null; readLocales( in ); }
public void writeObject( DataOutput out ) throws IOException { MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup(); int mtgSize = mtg.getNumTransforms(); out.writeInt( mtgSize ); // Store the matrix from each MTG transform Transform3D trans = new Transform3D(); Matrix4d matrix = new Matrix4d(); for(int i=0; i<mtgSize; i++) { TransformGroup tg = mtg.getTransformGroup( i ); tg.getTransform( trans ); trans.get( matrix ); control.writeMatrix4d( out, matrix ); } control.writeObject( out, control.createState( universe.getViewingPlatform().getPlatformGeometry() )); control.writeObject( out, control.createState( universe.getViewer().getAvatar() )); writeLocales( out ); }
Point3f[] scales = new Point3f[numFrames]; Transform3D yAxis = new Transform3D(); Matrix4d mat = new Matrix4d(); KBKeyFrame[] keyFrames = new KBKeyFrame[numFrames];
Matrix4d mat = new Matrix4d(); mat.setIdentity();
Point3f[] scales = new Point3f[numFrames]; Transform3D yAxis = new Transform3D(); Matrix4d mat = new Matrix4d(); KBKeyFrame[] keyFrames = new KBKeyFrame[numFrames];