I GOT IT!!!!!! THANK YOU!!!!! :) > I'd call this either a bug in the Transform3D API design or the > documentation or possibly both. The Point3d variants of transform() > only apply 3D transforms; w is assumed to be 1.0 and the 4th row of the > transform matrix isn't used. You need to use the Vector4d variants and > divide by w yourself
API for Transform3D.transform(Point3d) "Transforms the point parameter with this transform and places the result back into point. The fourth element of the point input paramter is assumed to be one." Comparing the two methods (using just Transform3D.transform(Point3d), or Transform3D.transform(Vector4d) and dividing by w) the results are indeed different. I assumed it was doing what you show explicitly, I'll call this a bug in documentation and use your way. > You probably aren't making the same mistake again, but I don't see here > what the value of `initial' is. We'll presume the value is identity and > the view platform is at the origin, unrotated, or that the value is the > inverse of the view platform's local to vworld transform. I should've been more clear, sorry about that. I intentially didn't leave the view platform at identity because I wanted to make sure I was getting the correct effect for the entire matrix chain. The value of 'initial' was not identity, it was rather the translated and rotated transform between the locale and the view platform. So here's what happened: I changed the view platform transform to identity, and did the matrix multiplication the way you suggested. After doing this, everything worked, but only when the view platform transform was identity. I thought that the transform above the view platform was the world to view platform transform which would make it the inverse of the view platform's local to vworld transform. But I must've been thinking of it in reverse order, because when I inverted my w2vp matrix, everything started working even when the view platform transform was not identity! So problem solved, thank you so much for the time you put into helping me! -----Original Message----- From: Mark Hood [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 9:01 PM To: [EMAIL PROTECTED] Subject: Re: [JAVA3D] projection coordinates > Date: Mon, 30 Jun 2003 11:48:07 -0400 > From: "Young, Jason" <[EMAIL PROTECTED]> > > [cm1] = A B C D = [w2vp][vp2e][e2cc] > (inverse is cm1^-1) > [...] > so if I have my own projection matrix, I can apply these matrices to the > geometry vertices: > > [w2vp][vp2e][my_projection][cm1^-1] > > then the net effect is: > [w2vp][vp2e][my_projection][cm1^-1][cm1] = [w2vp][vp2e][my_projection] > > Which is my own custom projection matrix. > When rendered, transforming my geometry points by > > [w2vp][vp2e][my_projection][cm1^-1] > > should look the same as calling > > view.setCompatibilityModeEnable(true); > view.setVpcToEc(vp2e); > view.setLeftProjection(my_projection); > > But it doesn't. So obviously my assumptions or my thoughts are flawed. > What do I not yet understand about J3D or the matrix chain process? > _______________________________________________________ > Here is my code: > [..] > Transform3D w2vp = new Transform3D(initial); > [...] You probably aren't making the same mistake again, but I don't see here what the value of `initial' is. We'll presume the value is identity and the view platform is at the origin, unrotated, or that the value is the inverse of the view platform's local to vworld transform. > Point3d p3d = new Point3d(); > for(int i=0; i < count; i++) { > groundgeo.getCoordinate(i,p3d); > cheatProjection.transform(p3d); > groundgeo.setCoordinate(i,p3d); > } I'd call this either a bug in the Transform3D API design or the documentation or possibly both. The Point3d variants of transform() only apply 3D transforms; w is assumed to be 1.0 and the 4th row of the transform matrix isn't used. You need to use the Vector4d variants and divide by w yourself: Point3d p3d = new Point3d(); Vector4d v4d = new Vector4d(); for (int i = 0 ; i < count ; i++) { groundgeom.getCoordinate(i, p3d); v4d.set(p3d); v4d.w = 1.0; cheatProjection.transform(v4d); p3d.x = v4d.x / v4d.w; p3d.y = v4d.y / v4d.w; p3d.z = v4d.z / v4d.w; groundgeo.setCoordinate(1, p3d); } I think it oughta work... give it a try. -- Mark Hood ======================================================================== === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
