|
JSR-184 Public Review Draft - Apr. 30, 2003. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.m3d.RayIntersection
A RayIntersection object is filled in by the pick
methods in Group
and Camera. RayIntersection stores a reference to the intersected Mesh or Sprite and
information about the intersection point. RayIntersection is a strictly run-time object;
it cannot be loaded from a file by Loader.
Constructor Summary | |
RayIntersection()
Constructs a new RayIntersection object with default values. |
Method Summary | |
float |
getDistance()
Retrieves the distance from the pick ray origin to the intersection point. |
Node |
getIntersected()
Retrieves the picked Mesh or Sprite object. |
int |
getSubmeshIndex()
Retrieves the index of the submesh where the intersection point is located within the intersected Mesh. |
float |
getTextureS(int index)
Retrieves the S texture coordinate at the intersection point on the picked Mesh or Sprite. |
float |
getTextureT(int index)
Retrieves the T texture coordinate at the intersection point on the picked Mesh or Sprite. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RayIntersection()
Constructs a new RayIntersection object with default values. The default values are as follows:
Method Detail |
public Node getIntersected()
Retrieves the picked Mesh or Sprite object. Other types of Nodes are not pickable and hence can not be returned by this method.
public float getDistance()
Retrieves the distance from the pick ray origin to the intersection point. The
distance is normalized to the length of the given pick ray (1.0 = ray length). The
length of the pick ray is defined as sqrt(dx2 + dy2 +
dz2)
, where (dx dy dz)
is the direction vector given
at the pick method. The normalized distance is independent of the transformations of
the intersected Node and its ancestors, including any non-uniform scales and other
non-length preserving transformations. Distance to the intersection point can be used
for simple collision detection, for instance.
public int getSubmeshIndex()
Retrieves the index of the submesh where the intersection point is located within the intersected Mesh. This allows the application to identify, for example, the texture image that is present on the intersection point. The submesh index is only applicable to Meshes; its value is always set to zero if the picked object is a Sprite.
public float getTextureS(int index)
Retrieves the S texture coordinate at the intersection point on the picked Mesh or Sprite. For meshes, there can be between zero and N texture coordinates, where N is the number of texturing units supported by the implementation. If a texturing unit is disabled, the corresponding texture coordinates are undefined. For sprites, there is always exactly one pair of valid texture coordinates (at index zero); the rest of the coordinates are undefined.
If the picked object is a Mesh, the returned coordinates are after texture transformation, but before possible clamping. In the case of a Sprite object, the returned coordinates are always between [0, 1], where (0, 0) is the upper left corner of the Sprite's Image2D. Note that the Sprite crop rectangle has no effect on the returned values.
index
- index of the texturing unit to get the texture coordinate of
java.lang.IndexOutOfBoundsException
- if index != [0, N]
where N
is the implementation specific maximum texture unit index (typically 1)public float getTextureT(int index)
Retrieves the T texture coordinate at the intersection point on the picked Mesh
or Sprite. See getTextureS(int)
for more information.
index
- index of the texturing unit to get the texture coordinate of
java.lang.IndexOutOfBoundsException
- if index != [0, N]
where N
is the implementation specific maximum texture unit index (typically 1)
|
JSR-184 Public Review Draft - Apr. 30, 2003. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |