16.7 VRML picking example The (Free web host) VrmlPickingTestexample illustrates how
16.7 VRML picking example The VrmlPickingTestexample illustrates how the PickCanvasand PickResultclasses can be used. The example loads a VRML format data file and allows the user to rotate, translate, and scale the loaded model. When the mouse is clicked, a list is generated of the intersections of the model with a PickCylinderRaythat passes perpendicularly through the clicked screen location into the 3D scene. All the intersections with the model are reported, as well as the closest intersection. When a mouse click occurs, VrmlPickingTestproduces the following output (which corresponds to clicking the mouse in the position shown in figure 16.1. The output is a list of the PickResultobjects (sorted from nearest to farthest): *** MouseClick *** First, the path through the scenegraph to the intersected node is displayed. In this case, the path is the VirtualUniverse s Locale, a BranchGroup, the Sphereprimitive (user data is Sphere ), then finally a Shape3Dcontaining a TriangleStripArray. Figure 16.1 A VRML scene loaded into the VrmlPickingTest example. Note the position of the cursor (the hand icon), which corresponds to the scene intersections in the code which follows 271
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.