|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.j3d.utils.pickfast.PickIntersection
public class PickIntersection
Holds information about an intersection of a PickShape with a Node as part of a PickInfo.IntersectionInfo. Information about the intersected geometry, intersected primitive, intersection point, and closest vertex can be inquired.
The intersected primitive indicates which primitive out of the GeometryArray
was intersected (where the primitive is a point, line, triangle or quad,
not a
com.sun.j3d.utils.geometry.Primitive)
.
For example, the intersection would indicate which triangle out of a
triangle strip was intersected.
The methods which return primitive data will have one value if the primitive
is
a point, two values if the primitive is a line, three values if the primitive
is a triangle and four values if the primitive is quad.
The primitive's VWorld coordinates are saved when then intersection is calculated. The local coordinates, normal, color and texture coordinates for the primitive can also be inquired if they are present and readable.
The intersection point is the location on the primitive which intersects the pick shape closest to the center of the pick shape. The intersection point's location in VWorld coordinates is saved when the intersection is calculated. The local coordinates, normal, color and texture coordiantes of at the intersection can be interpolated if they are present and readable.
The closest vertex is the vertex of the primitive closest to the intersection point. The vertex index, VWorld coordinates and local coordinates of the closest vertex can be inquired. The normal, color and texture coordinate of the closest vertex can be inquired from the geometry array:
Vector3f getNormal(PickIntersection pi, int vertexIndex) { int index; Vector3d normal = new Vector3f(); GeometryArray ga = pickIntersection.getGeometryArray(); if (pickIntersection.geometryIsIndexed()) { index = ga.getNormalIndex(vertexIndex); } else { index = vertexIndex; } ga.getNormal(index, normal); return normal; }
The color, normal and texture coordinate information for the intersected primitive and the intersection point can be inquired the geometry includes them and the corresponding READ capibility bits are set.
Field Summary | |
---|---|
private Point3d |
closestVertexCoordinates
Coordinates of the closest vertex |
private Point3d |
closestVertexCoordinatesVW
Coordinates of the closest vertex (World coordinates) |
private int |
closestVertexIndex
Index of the closest vertex |
private static boolean |
debug
|
private double |
distance
|
private Geometry |
geometry
|
private boolean |
geometryIsIndexed
|
private boolean |
hasColors
|
private boolean |
hasNormals
|
private boolean |
hasTexCoords
|
private PickInfo.IntersectionInfo |
iInfo
|
private double[] |
interpWeights
Weight factors for interpolation, values correspond to vertex indices, sum == 1 |
private Transform3D |
l2vw
|
private Color4f |
pointColor
Color at the intersection point |
private Point3d |
pointCoordinates
Local Coordinates of the intersection point |
private Point3d |
pointCoordinatesVW
VWorld Coordinates of the intersection point |
private Vector3f |
pointNormal
Normal at the intersection point |
private TexCoord3f |
pointTexCoord
TexCoord at the intersection point |
private int[] |
primitiveColorIndices
|
private Color4f[] |
primitiveColors
|
private int[] |
primitiveCoordinateIndices
|
private Point3d[] |
primitiveCoordinates
|
private Point3d[] |
primitiveCoordinatesVW
VWorld coordinates of intersected primitive |
private int[] |
primitiveNormalIndices
|
private Vector3f[] |
primitiveNormals
|
private int[] |
primitiveTexCoordIndices
|
private TexCoord3f[] |
primitiveTexCoords
|
private int[] |
primitiveVertexIndices
Indices of the intersected primitive |
(package private) static double |
TOL
|
private static int |
X_AXIS
|
private static int |
Y_AXIS
|
private static int |
Z_AXIS
|
Constructor Summary | |
---|---|
PickIntersection(Transform3D localToVWorld,
PickInfo.IntersectionInfo intersectionInfo)
Constructor |
Method Summary | |
---|---|
(package private) double |
abs(double value)
|
boolean |
geometryIsIndexed()
Returns true if the geometry is indexed |
Point3d |
getClosestVertexCoordinates()
Get coordinates of closest vertex (local) |
Point3d |
getClosestVertexCoordinatesVW()
Get coordinates of closest vertex (world) |
int |
getClosestVertexIndex()
Get index of closest vertex |
double |
getDistance()
Get the distance from the PickShape start point to the intersection point |
(package private) int |
getInterleavedColorOffset(GeometryArray geo)
|
(package private) int |
getInterleavedStride(GeometryArray geo)
|
(package private) int |
getInterleavedVertexOffset(GeometryArray geo)
Helper methods |
private static float |
getInterpFactor(Point3d p,
Point3d p1,
Point3d p2,
int axis)
Calculate the interpolation factor for point p by projecting it along an axis (x,y,z) onto the edge between p1 and p2. |
private static float |
getInterpFactorForBase(Point3d p,
Point3d p1,
Point3d p2,
int axis)
Calculate the interpolation factor for point p by projecting it along an axis (x,y,z) onto the edge between p1 and p2. |
(package private) double[] |
getInterpWeights()
|
PickInfo.IntersectionInfo |
getIntersectionInfo()
Gets the IntersectionInfo this intersection is part of. |
Color4f |
getPointColor()
Returns the color of the intersection point. |
Point3d |
getPointCoordinates()
Returns the coordinates of the intersection point (local coordinates), if available. |
Point3d |
getPointCoordinatesVW()
Returns the coordinates of the intersection point (world coordinates), if available. |
Vector3f |
getPointNormal()
Returns the normal of the intersection point. |
TexCoord3f |
getPointTextureCoordinate(int index)
Returns the texture coordinate of the intersection point at the specifed index in the specified texture coordinate set. |
int[] |
getPrimitiveColorIndices()
Get the color indices for the intersected primitive. |
Color4f[] |
getPrimitiveColors()
Get the colors of the intersected primitive. |
int[] |
getPrimitiveCoordinateIndices()
Get the coordinates indices for the intersected primitive. |
Point3d[] |
getPrimitiveCoordinates()
Get the local coordinates intersected primitive |
Point3d[] |
getPrimitiveCoordinatesVW()
Get VWorld coordinates of the intersected primitive |
int[] |
getPrimitiveNormalIndices()
Get the normal indices for the intersected primitive. |
Vector3f[] |
getPrimitiveNormals()
Get the normals of the intersected primitive. |
int[] |
getPrimitiveTexCoordIndices(int index)
Get the texture coordinate indices for the intersected primitive at the specifed index in the specified texture coordinate set. |
TexCoord3f[] |
getPrimitiveTexCoords(int index)
Get the texture coordinates of the intersected primitive at the specifed index in the specified texture coordinate set. |
int[] |
getPrimitiveVertexIndices()
Get vertex indices of the intersected primitive |
(package private) boolean |
interpTriangle(int index0,
int index1,
int index2,
Point3d[] coords,
Point3d intPt)
|
(package private) int |
maxAxis(Vector3d delta)
|
java.lang.String |
toString()
String representation of this object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private double[] interpWeights
private static final boolean debug
private static final int X_AXIS
private static final int Y_AXIS
private static final int Z_AXIS
static final double TOL
private PickInfo.IntersectionInfo iInfo
private Transform3D l2vw
private Geometry geometry
private boolean geometryIsIndexed
private double distance
private boolean hasColors
private boolean hasNormals
private boolean hasTexCoords
private int[] primitiveCoordinateIndices
private int[] primitiveNormalIndices
private int[] primitiveColorIndices
private int[] primitiveTexCoordIndices
private int[] primitiveVertexIndices
private Point3d[] primitiveCoordinates
private Point3d[] primitiveCoordinatesVW
private Vector3f[] primitiveNormals
private Color4f[] primitiveColors
private TexCoord3f[] primitiveTexCoords
private Point3d pointCoordinatesVW
private Point3d pointCoordinates
private Vector3f pointNormal
private Color4f pointColor
private TexCoord3f pointTexCoord
private int closestVertexIndex
private Point3d closestVertexCoordinates
private Point3d closestVertexCoordinatesVW
Constructor Detail |
---|
public PickIntersection(Transform3D localToVWorld, PickInfo.IntersectionInfo intersectionInfo)
intersectionInfo
- The IntersectionInfo this intersection is part of.Method Detail |
---|
public boolean geometryIsIndexed()
public Point3d getClosestVertexCoordinates()
public Point3d getClosestVertexCoordinatesVW()
public int getClosestVertexIndex()
public double getDistance()
public Color4f getPointColor()
public Point3d getPointCoordinates()
public Point3d getPointCoordinatesVW()
public Vector3f getPointNormal()
public TexCoord3f getPointTextureCoordinate(int index)
public int[] getPrimitiveColorIndices()
public Color4f[] getPrimitiveColors()
public int[] getPrimitiveCoordinateIndices()
public Point3d[] getPrimitiveCoordinates()
public Point3d[] getPrimitiveCoordinatesVW()
public int[] getPrimitiveNormalIndices()
public Vector3f[] getPrimitiveNormals()
public int[] getPrimitiveTexCoordIndices(int index)
public TexCoord3f[] getPrimitiveTexCoords(int index)
public int[] getPrimitiveVertexIndices()
public PickInfo.IntersectionInfo getIntersectionInfo()
public java.lang.String toString()
toString
in class java.lang.Object
int getInterleavedVertexOffset(GeometryArray geo)
int getInterleavedStride(GeometryArray geo)
int getInterleavedColorOffset(GeometryArray geo)
double abs(double value)
int maxAxis(Vector3d delta)
boolean interpTriangle(int index0, int index1, int index2, Point3d[] coords, Point3d intPt)
double[] getInterpWeights()
private static float getInterpFactor(Point3d p, Point3d p1, Point3d p2, int axis)
private static float getInterpFactorForBase(Point3d p, Point3d p1, Point3d p2, int axis)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |