|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.j3d.utils.picking.PickResult
public class PickResult
Stores information about a pick hit.
Detailed information about the pick and each intersection of the PickShape
with the picked Node can be inquired. The PickResult is constructed with
basic information and more detailed information is generated as needed. The
additional information is only available if capability bits on the scene
graph Nodes are set properly;
PickTool.setCapabilties(Node, int)
can
be used to ensure correct capabilites are set. Inquiring data which is not
available due to capabilties not being set will generate a
CapabilityNotSet
exception.
A PickResult can be used to calculate intersections on Node which is not part of a live scene graph using the constructor which takes a local to VWorld transformation for the Node.
Pick hits on TriangleStrip primitives will store the triangle points in the PickIntersection with the verticies in counter-clockwise order. For triangles which start with an odd numbered vertex this will be the the opposite of the order of the points in the TriangleStrip. This way the triangle in the PickIntersection will display the same was as the triangle in the strip.
If the Shape3D being picked has multiple geometry arrays, the arrays are stored in the PickResult and referred to by a geometry index.
If the Shape3D refers to a CompressedGeometry, the geometry is decompressed into an array of Shape3D nodes which can be inquired. The geometry NodeComponents for the Shape3D nodes are stored and used as if the Shape3D had multiple geometries. If there are multiple CompressedGeometries on the Shape3D, the decompressed Shape3Ds and GeometryArrays will be stored sequentially.
The intersection point for Morph nodes cannot be calculated using the displayed geometry due to limitations in the current Java3D core API (the current geometry of the the Morph cannot be inquired). Instead the geometry at index 0 in the Morph is used. This limitation may be eliminated in a future release of Java3D.
Field Summary | |
---|---|
static int |
BRANCH_GROUP
Flag to pass to getNode(int)
to return a
BranchGroup node from
the SceneGraphPath . |
private Shape3D[] |
compressGeomShape3Ds
Shape3Ds from CompressedGeometry on the picked node |
(package private) static boolean |
debug
|
(package private) static double |
EPS
|
private boolean |
firstIntersectOnly
if true, find only the first intersection |
(package private) static double |
FUZZ
|
private GeometryArray[] |
geometryArrays
GeometryArray(s) of the picked node |
static int |
GROUP
Flag to pass to getNode(int)
to return a
Group node from
the SceneGraphPath . |
(package private) java.util.ArrayList |
intersections
ArrayList to store intersection results Used in PickTool |
static int |
LINK
Flag to pass to getNode(int)
to return a
Link node from
the SceneGraphPath . |
private Transform3D |
localToVWorld
Transform to World Coordinates |
static int |
MORPH
Flag to pass to getNode(int)
to return a
Morph node from
the SceneGraphPath . |
(package private) static int |
PICK_SHAPE_BOUNDING_BOX
|
(package private) static int |
PICK_SHAPE_BOUNDING_POLYTOPE
|
(package private) static int |
PICK_SHAPE_BOUNDING_SPHERE
|
(package private) static int |
PICK_SHAPE_CONE
|
(package private) static int |
PICK_SHAPE_CYLINDER
|
(package private) static int |
PICK_SHAPE_POINT
|
(package private) static int |
PICK_SHAPE_RAY
|
(package private) static int |
PICK_SHAPE_SEGMENT
|
private Node |
pickedNode
Picked node: shape3d, text3d, etc. |
private SceneGraphPath |
pickedSceneGraphPath
Stored SceneGraphPath |
private PickShape |
pickShape
the pick shape to use for intersections |
private Bounds |
pickShapeBounds
|
private Vector3d |
pickShapeDir
|
private Point3d |
pickShapeEnd
|
private Point3d |
pickShapeStart
|
private int |
pickShapeType
|
static int |
PRIMITIVE
Flag to pass to getNode(int)
to return a
Primitive node from
the SceneGraphPath . |
static int |
SHAPE3D
Flag to pass to getNode(int)
to return a
Shape3D node from
the SceneGraphPath . |
static int |
SWITCH
Flag to pass to getNode(int)
to return a
Switch node from
the SceneGraphPath . |
static int |
TRANSFORM_GROUP
Flag to pass to getNode(int)
to return a
TransformGroup node from
the SceneGraphPath . |
(package private) static Point3d |
zeroPnt
|
Constructor Summary | |
---|---|
PickResult()
Default constructor. |
|
PickResult(Node pn,
Transform3D l2vw,
PickShape ps)
Construct a PickResult using the Node and localToVWorld transform |
|
PickResult(SceneGraphPath sgp,
PickShape ps)
Construct a PickResult using a SceneGraphPath |
Method Summary | |
---|---|
(package private) static double |
det2D(Point2d a,
Point2d b,
Point2d p)
|
(package private) static boolean |
edgeIntersectPlane(Vector3d normal,
Point3d pnt,
Point3d start,
Point3d end,
Point3d iPnt)
|
(package private) static boolean |
edgeIntersectPolygon2D(Vector3d normal,
Point3d[] coord,
Point3d[] seg)
|
(package private) static boolean |
edgeIntersectSphere(BoundingSphere sphere,
Point3d start,
Point3d end)
|
(package private) static double |
generalStandardSimplexSolver(double[][] problemTableau,
double stopingValue)
|
(package private) boolean |
generateIntersections()
Fill in the intersections of the Node with the PickShape |
PickIntersection |
getClosestIntersection(Point3d pt)
Gets the PickIntersection in this PickResult that is closest to a point |
Shape3D[] |
getCompressedGeometryShape3Ds()
Get the array of Shape3Ds that came from decompressing a CompressedGeometry on the picked node. |
boolean |
getFirstPickEnable()
Return the "first intersection only" value. |
GeometryArray |
getGeometryArray()
Get the GeometryArray at index 0 for the picked node |
GeometryArray[] |
getGeometryArrays()
Get the array of GeometryArrays for the picked node |
PickIntersection |
getIntersection(int index)
Returns a specific PickIntersection object |
Transform3D |
getLocalToVworld()
Get the localToVworld transform for the Node |
Node |
getNode(int flags)
Get the first node of a certain type up the SceneGraphPath |
Node |
getObject()
Get the picked node |
PickShape |
getPickShape()
Get the PickShape used for intersections |
SceneGraphPath |
getSceneGraphPath()
Get the SceneGraphPath. |
(package private) void |
initPickShape()
|
(package private) static boolean |
inside(Point3d[] coordinates,
PickPoint point,
int ccw)
Return true if point is on the inside of halfspace test. |
(package private) boolean |
intersect(int geomIndex,
boolean firstpick)
|
(package private) static boolean |
intersectBoundingBox(Point3d[] coordinates,
BoundingBox box)
|
(package private) static boolean |
intersectBoundingPolytope(Point3d[] coordinates,
BoundingPolytope polytope)
|
(package private) static boolean |
intersectBoundingSphere(Point3d[] coordinates,
BoundingSphere sphere)
|
(package private) static boolean |
intersectCone(Point3d[] coordinates,
PickCone cone,
PickIntersection pi)
Return true if triangle or quad intersects with cone. |
(package private) static boolean |
intersectCone(Point3d pt,
PickCone cone,
PickIntersection pi)
Return true if point intersects with cone and the distance is stored in pi. |
(package private) static boolean |
intersectCylinder(Point3d[] coordinates,
PickCylinder cyl,
PickIntersection pi)
Return true if triangle or quad intersects with cylinder and the distance is stored in pr. |
(package private) static boolean |
intersectCylinder(Point3d pt,
PickCylinder cyl,
PickIntersection pi)
Return true if point intersects with cylinder and the distance is stored in pi. |
(package private) boolean |
intersectILA(IndexedLineArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for IndexedLineArray |
(package private) boolean |
intersectILSA(IndexedLineStripArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for IndexedLineStripArray |
(package private) boolean |
intersectIPA(IndexedPointArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for IndexedPointArray |
(package private) boolean |
intersectIQA(IndexedQuadArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for IndexedQuadArray |
(package private) boolean |
intersectITA(IndexedTriangleArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for IndexedTriangleArray |
(package private) boolean |
intersectITFA(IndexedTriangleFanArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for IndexedTriangleFanArray |
(package private) boolean |
intersectITSA(IndexedTriangleStripArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for IndexedTriangleStripArray |
(package private) boolean |
intersectLA(LineArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for LineArray |
(package private) boolean |
intersectLine(int[] vertidx,
int[] coordidx,
int geomIndex,
Point3d[] pnts,
PickIntersection pi)
|
(package private) static boolean |
intersectLineAndRay(Point3d start,
Point3d end,
Point3d ori,
Vector3d dir,
PickIntersection pi)
|
(package private) boolean |
intersectLSA(LineStripArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for LineStripArray |
(package private) boolean |
intersectPA(PointArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for PointArray |
(package private) static boolean |
intersectPntAndPnt(Point3d pnt1,
Point3d pnt2,
PickIntersection pi)
|
(package private) static boolean |
intersectPntAndRay(Point3d pnt,
Point3d ori,
Vector3d dir,
PickIntersection pi)
|
(package private) boolean |
intersectPoint(int[] vertidx,
int[] coordidx,
int geomIndex,
Point3d[] pnts,
PickIntersection pi)
|
(package private) static boolean |
intersectPolygon(Point3d[] coord1,
Point3d[] coord2,
boolean doTrivialTest)
|
(package private) boolean |
intersectQA(QuadArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for QuadArray |
(package private) boolean |
intersectQuad(int[] vertidx,
int[] coordidx,
int geomIndex,
Point3d[] pnts,
PickIntersection pi)
|
(package private) static boolean |
intersectRay(Point3d[] coordinates,
PickRay ray,
PickIntersection pi)
|
(package private) static boolean |
intersectRayOrSegment(Point3d[] coordinates,
Vector3d direction,
Point3d origin,
PickIntersection pi,
boolean isSegment)
Return true if triangle or quad intersects with ray and the distance is stored in pr. |
(package private) static boolean |
intersectSegment(Point3d[] coordinates,
PickSegment segment,
PickIntersection pi)
Return true if triangle or quad intersects with segment and the distance is stored in dist. |
(package private) boolean |
intersectTA(TriangleArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for TriangleArray |
(package private) boolean |
intersectTFA(TriangleFanArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for TriangleFanArray |
(package private) boolean |
intersectTri(int[] vertidx,
int[] coordidx,
int geomIndex,
Point3d[] pnts,
PickIntersection pi)
|
(package private) boolean |
intersectTSA(TriangleStripArray geom,
int geomIndex,
Point3d[] pnts,
boolean firstpick,
PickIntersection pi)
Intersect method for TriangleStripArray |
(package private) static boolean |
isNonZero(double v)
|
int |
numCompressedGeometryShape3Ds()
Get the number of Shape3Ds that came from decompressing a CompressedGeometry on the picked node. |
int |
numGeometryArrays()
Get the number of GeometryArrays for the picked node |
int |
numIntersections()
Returns the number of PickIntersections in the PickResult. |
(package private) static boolean |
pointIntersectPolygon2D(Vector3d normal,
Point3d[] coord,
Point3d point)
|
void |
setFirstIntersectOnly(boolean flag)
Set the PickResult to find only the first intersection of the PickShape with the Node. |
(package private) void |
setObject(Node n)
Set the picked node |
private void |
storeGeometry()
Store the geometry for the node in this PickResult |
(package private) void |
storeNode()
Extract the picked node from the SceneGraphPath |
java.lang.String |
toString()
Returns String representation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SHAPE3D
getNode(int)
to return a
Shape3D
node from
the SceneGraphPath
.
public static final int MORPH
getNode(int)
to return a
Morph
node from
the SceneGraphPath
.
public static final int PRIMITIVE
getNode(int)
to return a
Primitive
node from
the SceneGraphPath
.
public static final int LINK
getNode(int)
to return a
Link
node from
the SceneGraphPath
.
public static final int GROUP
getNode(int)
to return a
Group
node from
the SceneGraphPath
.
public static final int TRANSFORM_GROUP
getNode(int)
to return a
TransformGroup
node from
the SceneGraphPath
.
public static final int BRANCH_GROUP
getNode(int)
to return a
BranchGroup
node from
the SceneGraphPath
.
public static final int SWITCH
getNode(int)
to return a
Switch
node from
the SceneGraphPath
.
static boolean debug
private boolean firstIntersectOnly
private SceneGraphPath pickedSceneGraphPath
private Node pickedNode
private GeometryArray[] geometryArrays
private Shape3D[] compressGeomShape3Ds
private Transform3D localToVWorld
private PickShape pickShape
private int pickShapeType
private Vector3d pickShapeDir
private Point3d pickShapeStart
private Point3d pickShapeEnd
private Bounds pickShapeBounds
static final Point3d zeroPnt
java.util.ArrayList intersections
static final double FUZZ
static final int PICK_SHAPE_RAY
static final int PICK_SHAPE_SEGMENT
static final int PICK_SHAPE_POINT
static final int PICK_SHAPE_BOUNDING_BOX
static final int PICK_SHAPE_BOUNDING_SPHERE
static final int PICK_SHAPE_BOUNDING_POLYTOPE
static final int PICK_SHAPE_CYLINDER
static final int PICK_SHAPE_CONE
static final double EPS
Constructor Detail |
---|
PickResult()
public PickResult(SceneGraphPath sgp, PickShape ps)
sgp
- SceneGraphPath associated with this PickResultps
- The pickShape to intersect againstpublic PickResult(Node pn, Transform3D l2vw, PickShape ps)
pn
- The picked node.l2vw
- The local to VWorld transformation for the nodeps
- The PickShape to intersect against
java.lang.IllegalArgumentException
- If the node is not a Morph or Shape3D.Method Detail |
---|
void initPickShape()
public SceneGraphPath getSceneGraphPath()
public Transform3D getLocalToVworld()
public GeometryArray getGeometryArray()
public GeometryArray[] getGeometryArrays()
public int numGeometryArrays()
public int numCompressedGeometryShape3Ds()
public Shape3D[] getCompressedGeometryShape3Ds()
public PickShape getPickShape()
public void setFirstIntersectOnly(boolean flag)
false
(all intersections are
found)
public boolean getFirstPickEnable()
public int numIntersections()
public PickIntersection getIntersection(int index)
index
- the index number
public PickIntersection getClosestIntersection(Point3d pt)
pt
- the point to use for distance calculations
public java.lang.String toString()
toString
in class java.lang.Object
private void storeGeometry()
public Node getObject()
void setObject(Node n)
public Node getNode(int flags)
flags
- the type of node we are interested in
void storeNode()
boolean generateIntersections()
final boolean intersect(int geomIndex, boolean firstpick)
boolean intersectPoint(int[] vertidx, int[] coordidx, int geomIndex, Point3d[] pnts, PickIntersection pi)
boolean intersectLine(int[] vertidx, int[] coordidx, int geomIndex, Point3d[] pnts, PickIntersection pi)
boolean intersectTri(int[] vertidx, int[] coordidx, int geomIndex, Point3d[] pnts, PickIntersection pi)
boolean intersectQuad(int[] vertidx, int[] coordidx, int geomIndex, Point3d[] pnts, PickIntersection pi)
boolean intersectPA(PointArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectIPA(IndexedPointArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectLA(LineArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectLSA(LineStripArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectILA(IndexedLineArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectILSA(IndexedLineStripArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectTA(TriangleArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectITA(IndexedTriangleArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectTSA(TriangleStripArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectITSA(IndexedTriangleStripArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectTFA(TriangleFanArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectITFA(IndexedTriangleFanArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
boolean intersectQA(QuadArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
final boolean intersectIQA(IndexedQuadArray geom, int geomIndex, Point3d[] pnts, boolean firstpick, PickIntersection pi)
static boolean intersectBoundingBox(Point3d[] coordinates, BoundingBox box)
static boolean intersectBoundingSphere(Point3d[] coordinates, BoundingSphere sphere)
static boolean intersectBoundingPolytope(Point3d[] coordinates, BoundingPolytope polytope)
static double generalStandardSimplexSolver(double[][] problemTableau, double stopingValue)
static boolean edgeIntersectSphere(BoundingSphere sphere, Point3d start, Point3d end)
static double det2D(Point2d a, Point2d b, Point2d p)
static boolean pointIntersectPolygon2D(Vector3d normal, Point3d[] coord, Point3d point)
static boolean edgeIntersectPlane(Vector3d normal, Point3d pnt, Point3d start, Point3d end, Point3d iPnt)
static boolean edgeIntersectPolygon2D(Vector3d normal, Point3d[] coord, Point3d[] seg)
static boolean intersectPolygon(Point3d[] coord1, Point3d[] coord2, boolean doTrivialTest)
static final boolean isNonZero(double v)
static boolean intersectRay(Point3d[] coordinates, PickRay ray, PickIntersection pi)
static boolean intersectRayOrSegment(Point3d[] coordinates, Vector3d direction, Point3d origin, PickIntersection pi, boolean isSegment)
static boolean intersectSegment(Point3d[] coordinates, PickSegment segment, PickIntersection pi)
static boolean inside(Point3d[] coordinates, PickPoint point, int ccw)
static boolean intersectPntAndPnt(Point3d pnt1, Point3d pnt2, PickIntersection pi)
static boolean intersectPntAndRay(Point3d pnt, Point3d ori, Vector3d dir, PickIntersection pi)
static boolean intersectLineAndRay(Point3d start, Point3d end, Point3d ori, Vector3d dir, PickIntersection pi)
static boolean intersectCylinder(Point3d[] coordinates, PickCylinder cyl, PickIntersection pi)
static boolean intersectCone(Point3d[] coordinates, PickCone cone, PickIntersection pi)
static boolean intersectCylinder(Point3d pt, PickCylinder cyl, PickIntersection pi)
static boolean intersectCone(Point3d pt, PickCone cone, PickIntersection pi)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |