Placing Objects in the Scene
Knowing where to place something in the scene at scene creation time is a question of knowing the height of the ground at a particular (x, z) location. This is problematic because most ground positions will have been extrapolated by Java 3D from the corner points of quads. Picking is useless in this case since we want to position objects before the complete scene is made live.
If a quad is coplanar (i.e., positioned in a single plane), then calculating interior points is straightforward. Unfortunately, most quads are not coplanar. Furthermore, because the underlying graphics hardware works with triangles, the geometry in a Shape3D will have been triangulated, and the shape of those triangles is hard to predict when their vertices are highly noncoplanar.
Java 3D uses a subset of the FIST triangulation algorithm (see http://www.cosy.sbg.ac.at/~held/projects/triang/triang.html for a nontechnical discussion of the algorithm). Each polygon is projected onto a plane, and the 2D projected points are considered using a range of heuristics. One aim is to avoid long, skinny triangles by maximizing the angles within the triangles. The presence of heuristics means that it's sometimes difficult to know how a polygon will be divided.
The example is Figure 26-11, which shows a single quad with two equally likely triangulations. A division along PR will give point pt a height of 0, but if the SQ line is used then the same point will have a height of 5 units.
Figure 26-11. A ...