public class PickIntersection
extends java.lang.Object
The intersected geometry is indicated by an index into the list of geometry arrays on the PickResult. It can also be inquired from this object.
The intersected primitive indicates which primitive out of the GeometryArray
was intersected (where the primitive is a point, line, triangle or quad,
not a
org.jogamp.java3d.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.
PickTool.setCapabilties(Node, int)
can be used to set the capability bits
to allow this data to be inquired.
Modifier and Type | Method and Description |
---|---|
boolean |
geometryIsIndexed()
Returns true if the geometry is indexed
|
org.jogamp.vecmath.Point3d |
getClosestVertexCoordinates()
Get coordinates of closest vertex (local)
|
org.jogamp.vecmath.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
|
org.jogamp.java3d.GeometryArray |
getGeometryArray()
Returns the GeometryArray for the intersection
|
int |
getGeometryArrayIndex()
Returns the index of the intersected GeometryArray into the geometry
arrays in the PickResult
|
org.jogamp.vecmath.Color4f |
getPointColor()
Returns the color of the intersection point.
|
org.jogamp.vecmath.Point3d |
getPointCoordinates()
Returns the coordinates of the intersection point (local coordinates),
if available.
|
org.jogamp.vecmath.Point3d |
getPointCoordinatesVW()
Returns the coordinates of the intersection point (world coordinates),
if available.
|
org.jogamp.vecmath.Vector3f |
getPointNormal()
Returns the normal of the intersection point.
|
org.jogamp.vecmath.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.
|
org.jogamp.vecmath.Color4f[] |
getPrimitiveColors()
Get the colors of the intersected primitive.
|
int[] |
getPrimitiveCoordinateIndices()
Get the coordinates indices for the intersected primitive.
|
org.jogamp.vecmath.Point3d[] |
getPrimitiveCoordinates()
Get the local coordinates intersected primitive
|
org.jogamp.vecmath.Point3d[] |
getPrimitiveCoordinatesVW()
Get VWorld coordinates of the intersected primitive
|
int[] |
getPrimitiveNormalIndices()
Get the normal indices for the intersected primitive.
|
org.jogamp.vecmath.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.
|
org.jogamp.vecmath.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
|
java.lang.String |
toString()
String representation of this object
|
public java.lang.String toString()
toString
in class java.lang.Object
public org.jogamp.vecmath.Point3d getPointCoordinatesVW()
public double getDistance()
public org.jogamp.vecmath.Point3d[] getPrimitiveCoordinatesVW()
public int[] getPrimitiveVertexIndices()
public int getGeometryArrayIndex()
public org.jogamp.java3d.GeometryArray getGeometryArray()
public boolean geometryIsIndexed()
public org.jogamp.vecmath.Point3d getClosestVertexCoordinates()
public org.jogamp.vecmath.Point3d getClosestVertexCoordinatesVW()
public int getClosestVertexIndex()
public int[] getPrimitiveCoordinateIndices()
public org.jogamp.vecmath.Point3d[] getPrimitiveCoordinates()
public int[] getPrimitiveNormalIndices()
public org.jogamp.vecmath.Vector3f[] getPrimitiveNormals()
public int[] getPrimitiveColorIndices()
public org.jogamp.vecmath.Color4f[] getPrimitiveColors()
public int[] getPrimitiveTexCoordIndices(int index)
public org.jogamp.vecmath.TexCoord3f[] getPrimitiveTexCoords(int index)
public org.jogamp.vecmath.Point3d getPointCoordinates()
public org.jogamp.vecmath.Vector3f getPointNormal()
public org.jogamp.vecmath.Color4f getPointColor()
public org.jogamp.vecmath.TexCoord3f getPointTextureCoordinate(int index)