开发者

Java 3D Canvas To Virtual World Mapping

开发者 https://www.devze.com 2023-01-05 06:40 出处:网络
I have a 3d Scene set up and can navigate my scene etc (I am fairly experienced in Java 3D) but i still need ways to achive the following four operations in Java 3D:

I have a 3d Scene set up and can navigate my scene etc (I am fairly experienced in Java 3D) but i still need ways to achive the following four operations in Java 3D:

  • map the viewing area of my Canvas3D into the virtual world (with this mapping i should be able to draw an outline (rectangle) in the virtual world around the viewing canvas).
  • translate from a mouse point on the canvas to a point in the virtual world (if i have this i should also be able to achieve the above objective)
  • translate from开发者_运维百科 a point in the virtual world to a point on the Canvas3D object
  • i want to be able to zoom my scene to fit into the viewing area of the Canvas3D object (hopefully without trial and error. Ie. hopefully without zooming in a little, then testing points again, then repeating)

All of the above are very closely related so any help would be greatly apreciated.


To convert from Canvas3D coordinates to Virtual world coordinates, you should use the getVworldToImagePlate and getImagePlateToVworld methods of Canvas3D. That will get you a mapping from imagePlate coordinates to virtual world coordinates.

To convert a pixel location to virtual world coordinates, you need to chain the above transform with the return from getPixelLocationInImagePlate

The reverse of the above, getPixelLocationFromImagePlate, will answer your third point.

One you have everything in the same coordinate space, you can start figuring out the proper transformations that you need for your specific application.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号