Jazz3D API


com.sygem.jazz3d3
Class HitPoint

java.lang.Object
  |
  +--com.sygem.jazz3d3.HitPoint

public class HitPoint
extends java.lang.Object

Utility class for Ray-based collision detection. HitPoint holds details of the last known collision - no more than that.

NOTE: There is no constructor - all the methods are static so you never create an instance of a HitPoint, just call the methods directly.

Version:
3.0a
Author:
SyGem Software
See Also:
World.pick(Vertex, Vertex, int)

Method Summary
static int getFaceId()
          Gets the number of the face the ray collided with.
static Vertex getNormalVertex()
          Gets a Vertex representing the normal of the collided face.
static double getNormalX()
          Gets the X component of the face normal.
static double getNormalY()
          Gets the Y component of the face normal.
static double getNormalZ()
          Gets the Z component of the face normal.
static int getObjectId()
          Gets the ID of the object the ray collided with.
static java.lang.String getObjectName()
          Gets the name of the object the ray collided with.
static double getT()
          Returns the value of 't' at the collision point.
static Vertex getVertex()
          Gets the exact position of the last collision.
static double getX()
          Get the X position of the last collision.
static double getY()
          Get the Y position of the last collision.
static double getZ()
          Get the Z position of the last collision.
static void setRecordNormals(boolean record)
          Sets whether or not face normals should be stored
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFaceId

public static final int getFaceId()
Gets the number of the face the ray collided with. You can then get a handle on this face by using the getFace() method of an Object3d.
Returns:
The face number
See Also:
Object3d.getFace(int)

getObjectId

public static final int getObjectId()
Gets the ID of the object the ray collided with. You can then get a handle on this object by using the getObject() method of the World.
Returns:
The object identifier
See Also:
World.getObject(int)

getObjectName

public static final java.lang.String getObjectName()
Gets the name of the object the ray collided with. You can then get a handle on this object by using the getObject() method of the World.
Returns:
The object name
See Also:
World.getObject(String)

getVertex

public static final Vertex getVertex()
Gets the exact position of the last collision. The position is returned as a Vertex.
Returns:
A Vertex containing the position
See Also:
Vertex

getX

public static final double getX()
Get the X position of the last collision. This coordinate is in world-space.
Returns:
The X position of the collision

getY

public static final double getY()
Get the Y position of the last collision. This coordinate is in world-space.
Returns:
The Y position of the collision

getZ

public static final double getZ()
Get the Z position of the last collision. This coordinate is in world-space.
Returns:
The Z position of the collision

getT

public static final double getT()
Returns the value of 't' at the collision point. This will be a value between zero and 1 - it represents the position along the Ray where the collision occured. So, if 't' equals 0.5, the collision occured exactly halfway along the testing Ray.
Returns:
The position along the Ray where the collision happened

getNormalVertex

public static final Vertex getNormalVertex()
Gets a Vertex representing the normal of the collided face. NOTE: If normal-recording has not been activated, this Vertex will just represent (0,0,0)
Returns:
A Vertex containing the face normal
See Also:
Vertex

getNormalX

public static final double getNormalX()
Gets the X component of the face normal. Will return zero if normal-recording has not been switched on.
Returns:
The X component of the face normal

getNormalY

public static final double getNormalY()
Gets the Y component of the face normal. Will return zero if normal-recording has not been switched on.
Returns:
The Y component of the face normal

getNormalZ

public static final double getNormalZ()
Gets the Z component of the face normal. Will return zero if normal-recording has not been switched on.
Returns:
The Z component of the face normal

setRecordNormals

public static final void setRecordNormals(boolean record)
Sets whether or not face normals should be stored
Parameters:
record - True if face normals should be recorded, false if not

©2001 SyGem Software