de.javagl.swogl.geometry
Class DefaultRay

java.lang.Object
  extended by de.javagl.swogl.geometry.DefaultRay
All Implemented Interfaces:
Ray

public final class DefaultRay
extends java.lang.Object
implements Ray

Default implementation of a Ray


Constructor Summary
DefaultRay(javax.vecmath.Tuple3f origin, javax.vecmath.Tuple3f direction)
          Creates a new DefaultRay with the given origin and direction.
 
Method Summary
 javax.vecmath.Vector3f getDirection()
          Returns a copy of the direction of the ray.
 javax.vecmath.Point3f getOrigin()
          Returns a copy of the origin of the ray.
static Ray normalize(Ray ray)
          Returns a copy of the given ray, where the direction is normalized.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultRay

public DefaultRay(javax.vecmath.Tuple3f origin,
                  javax.vecmath.Tuple3f direction)
Creates a new DefaultRay with the given origin and direction. The ray will contain copies of the given values.

Parameters:
origin - The origin
direction - The direction
Method Detail

normalize

public static Ray normalize(Ray ray)
Returns a copy of the given ray, where the direction is normalized.

Parameters:
ray - The ray
Returns:
The ray with the normalized direction

getOrigin

public javax.vecmath.Point3f getOrigin()
Description copied from interface: Ray
Returns a copy of the origin of the ray.

Specified by:
getOrigin in interface Ray
Returns:
The origin of the ray

getDirection

public javax.vecmath.Vector3f getDirection()
Description copied from interface: Ray
Returns a copy of the direction of the ray. This direction may not be assumed to be normalized.

Specified by:
getDirection in interface Ray
Returns:
The direction of the ray.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object