> Date: Fri, 17 May 2002 14:07:12 -0700 > From: Kovalan Muniandy <[EMAIL PROTECTED]> > > I have a volume rendering application that uses polygon slices that are > perpendicular to the view direction. How do I get the view vector in Java3D?
The view vector points along the -Z axis of the view platform transform. So to get the view vector in the virtual world, transform the vector (0, 0, -1) by the view platform transform: TransformGroup tg = universe.getViewingPlatform().getViewPlatformTransform() ; Transform3D t3d = new Transform3D() ; tg.getTransform(t3d) ; Vector3d v3d = new Vector3d(0.0, 0.0, -1.0) ; t3d.transform(v3d) ; Assumptions: 1) universe is an instance of SimpleUniverse or ConfiguredUniverse. If you're constructing the view side of the virtual universe yourself, you should have access to the actual ViewPlatform node and you can call its getLocalToVworld() method to get the view transform. 2) There is only one TransformGroup in the ViewingPlatform. The getViewPlatformTransform() retrieves the TransformGroup directly above the ViewPlatform. If there are multiple TransformGroups between it and the locale, use getLocalToVworld() on the ViewPlatform node itself. (Note: ViewingPlatform is a utility class and ViewPlatform is the J3D core class). 3) You're using the default view attach policy and window eyepoint policy. The view platform origin is not necessarily the eyepoint if the default policies are overridden. Look in the archive for the discussion on getting the actual eyepoint. HTH -- 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".
