public class PickContext extends TransformContext
A pick context has a pick segment, which is a line segment in a local coordinate system. During a pick traversal of the scene graph, nodes compute points of intersection, if any, between their geometry and the pick segment. For efficiency, only nodes with bounding spheres that intersect the pick segment will perform intersection computations.
The pick segment in a pick context has two endpoints. One endpoint lies on the near clipping plane, with specified pixel (x,y) coordinates and pixel z coordinate 0.0. This endpoint is called the near endpoint of the pick segment. The far endpoint lies on the far clipping plane. It has the same specified pixel (x,y) coordinates as the near endpoint, but has pixel z coordinate 1.0. With these pick segment endpoints, only geometry between the near and far clipping planes can be picked.
Constructor and Description |
---|
PickContext(java.awt.event.MouseEvent event)
Constructs a pick context for the specified mouse event.
|
Modifier and Type | Method and Description |
---|---|
void |
addResult(Point3 point)
Adds a pick result with specified pick point to this context.
|
PickResult |
getClosest()
Gets the pick result closest to the origin of the pick segment.
|
java.awt.event.MouseEvent |
getMouseEvent()
Gets the mouse event for which this context was constructed.
|
Segment |
getPickSegment()
Gets the pick segment for this context.
|
void |
popLocalToWorld()
Restores the most recently saved (pushed) local-to-world transform.
|
void |
pushLocalToWorld(Matrix44 transform)
Saves the local-to-world transform before appending a transform.
|
boolean |
segmentIntersectsSphereOf(Node node)
Determines whether the pick segment intersects the bounding sphere
of the specified node.
|
getCubeToLocal, getCubeToPixel, getCubeToView, getCubeToWorld, getLocalToCube, getLocalToPixel, getLocalToView, getLocalToWorld, getPixelToCube, getPixelToLocal, getPixelToView, getPixelToWorld, getView, getViewCanvas, getViewToCube, getViewToLocal, getViewToPixel, getViewToWorld, getWorld, getWorldToCube, getWorldToLocal, getWorldToPixel, getWorldToView
countNodes, getNode, getNode, getNodes, popNode, pushNode
public PickContext(java.awt.event.MouseEvent event)
event
- the mouse event.public java.awt.event.MouseEvent getMouseEvent()
public Segment getPickSegment()
public boolean segmentIntersectsSphereOf(Node node)
node
- the node with a bounding sphere.public void addResult(Point3 point)
point
- the pick point, in local coordinates.public PickResult getClosest()
public void pushLocalToWorld(Matrix44 transform)
pushLocalToWorld
in class TransformContext
transform
- the transform to append.public void popLocalToWorld()
popLocalToWorld
in class TransformContext