4 vertice shape3d object (2D rectangle) is created around the origin (0,0,0). Through the use of the program, the rectangle is translated and rotated. I need to be able to retrieve the current coordinates of a specified vertex at any time.
I can retrieve the vertex coordinates and the vector of the movement of the object. I can get a Matrix3d object of the rotation of the object, but I do not know how to apply that to get the current coordinate of the vertex.
Here's what I've got so far...
1 2 3 4 5 6 7 8 9 10
| Point3f p = new Point3f(); Shape3D s = * retrieved shape *; GeometryArray geom = (GeometryArray) s.getGeometry(); geom.getCoordinate( corner, p ); Transform3D tmp= new Transform3D(); s.getLocalToVworld(tmp); Vector3d trans = new Vector3d(); Matrix3d rot = new Matrix3d(); tmp.get(rot, trans); |
trans gives me the vector
(-9.0, -1.8125, -14.0)
rot gives me the matrix
-1.0, 0.0, 1.2246467991473532E-16
0.0, 1.0, 0.0
-1.2246467991473532E-16, 0.0, -1.0
Any help will be much appreciated.