org.odejava
Class GeomRay

java.lang.Object
  extended by org.odejava.Geom
      extended by org.odejava.GeomRay

public class GeomRay
extends Geom

A ray is different from all the other geom classes in that it does not represent a solid object. It is an infinitely thin line that starts from the geom's position and extends in the direction of the geom's local Z-axis. Calling dCollide() between a ray and another geom will result in at most one contact point. Rays have their own conventions for the contact information in the dContactGeom structure (thus it is not useful to create contact joints from this information): pos - This is the point at which the ray intersects the surface of the other geom, regardless of whether the ray starts from inside or outside the geom. normal - This is the surface normal of the other geom at the contact point. if dCollide() is passed the ray as its first geom then the normal will be oriented correctly for ray reflection from that surface (otherwise it will have the opposite sign). depth - This is the distance from the start of the ray to the contact point. Rays are useful for things like visibility testing, detemining the path of projectiles or light rays, and for object placement. Created 16.12.2003 (dd.mm.yyyy)

Author:
Jani Laakso E-mail: jani.laakso@itmill.com see http://odejava.dev.java.net

Field Summary
 
Fields inherited from class org.odejava.Geom
geomId, isEncapsulated, spaceId
 
Constructor Summary
GeomRay(float length)
           
GeomRay(String name, float length)
          Create ray geometry to specific space.
 
Method Summary
 float[] getDirection()
          Get the direction (dir) of the ray.
 float[] getStartingPos()
          Get the starting position (start) of the ray.
 void setStartPosAndDirection(float px, float py, float pz, float dx, float dy, float dz)
          Set the starting position (px,py,pz) and direction (dx,dy,dz) of the given ray.
 
Methods inherited from class org.odejava.Geom
addToSpace, delete, finalize, getGeomFromNativeAddr, getId, getID, getName, getNativeAddr, getUserData, isEnabled, removeFromSpace, setCategoryBits, setCollideBits, setEnabled, setName, setUserData, updateNativeAddr
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeomRay

public GeomRay(String name,
               float length)
Create ray geometry to specific space.

Parameters:
name -
length -

GeomRay

public GeomRay(float length)
Method Detail

setStartPosAndDirection

public void setStartPosAndDirection(float px,
                                    float py,
                                    float pz,
                                    float dx,
                                    float dy,
                                    float dz)
Set the starting position (px,py,pz) and direction (dx,dy,dz) of the given ray. The ray's rotation matrix will be adjusted so that the local Z-axis is aligned with the direction. Note that this does not adjust the ray's length.

Parameters:
px -
py -
pz -
dx -
dy -
dz -

getStartingPos

public float[] getStartingPos()
Get the starting position (start) of the ray.

Returns:
starting position coordinates

getDirection

public float[] getDirection()
Get the direction (dir) of the ray. The returned direction will be a unit length vector.

Returns:
direction vector