com.jme.math
Class Ray

java.lang.Object
  extended bycom.jme.math.Ray

public class Ray
extends java.lang.Object

Ray defines a line segment which has an origin and a direction. That is, a point and an infinite ray is cast from this point. The ray is defined by the following equation: R(t) = origin + t*direction for t >= 0.

Version:
$Id: Ray.java,v 1.6 2004/10/05 23:38:19 mojomonkey Exp $
Author:
Mark Powell

Field Summary
 Vector3f direction
          The direction of the ray.
 Vector3f origin
          The ray's begining point.
 
Constructor Summary
Ray()
          Constructor instantiates a new Ray object.
Ray(Vector3f origin, Vector3f direction)
          Constructor instantiates a new Ray object.
 
Method Summary
 Vector3f getDirection()
          getDirection retrieves the direction vector of the ray.
 Vector3f getOrigin()
          getOrigin retrieves the origin point of the ray.
 boolean intersect(Vector3f v0, Vector3f v1, Vector3f v2)
           
 void setDirection(Vector3f direction)
          setDirection sets the direction vector of the ray.
 void setOrigin(Vector3f origin)
          setOrigin sets the origin of the ray.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

origin

public Vector3f origin
The ray's begining point.


direction

public Vector3f direction
The direction of the ray.

Constructor Detail

Ray

public Ray()
Constructor instantiates a new Ray object. As default, the origin is (0,0,0) and the direction is (0,0,0).


Ray

public Ray(Vector3f origin,
           Vector3f direction)
Constructor instantiates a new Ray object. The origin and direction are given.

Parameters:
origin - the origin of the ray.
direction - the direction the ray travels in.
Method Detail

intersect

public boolean intersect(Vector3f v0,
                         Vector3f v1,
                         Vector3f v2)

getOrigin

public Vector3f getOrigin()
getOrigin retrieves the origin point of the ray.

Returns:
the origin of the ray.

setOrigin

public void setOrigin(Vector3f origin)
setOrigin sets the origin of the ray.

Parameters:
origin - the origin of the ray.

getDirection

public Vector3f getDirection()
getDirection retrieves the direction vector of the ray.

Returns:
the direction of the ray.

setDirection

public void setDirection(Vector3f direction)
setDirection sets the direction vector of the ray.

Parameters:
direction - the direction of the ray.