org.openmali.spatial.bodies
Class Line

java.lang.Object
  extended by org.openmali.spatial.bodies.Line

public class Line
extends java.lang.Object

Line is L(t) = P+t*D for any real-valued t.
D is not necessarily unit length.

Thanks to magic software for this one.


Constructor Summary
Line()
          Creates a new Line.
Line(float origX, float origY, float origZ, float direcX, float direcY, float direcZ)
          Creates a new Line.
Line(Line template)
          Clone constructor.
Line(Point3f origin, Vector3f direction)
          Creates a new Line.
 
Method Summary
 Line clone()
          Creates a clone.
 boolean equals(Line line)
          Checks if the given line equals this one.
 boolean equals(java.lang.Object o)
          
 Vector3f getDirection()
           
 float getLength()
           
 Point3f getOrigin()
           
 float length()
           
 void set(Line line)
          Sets this line to be equal to the passed one.
 void set(Point3f origin, Vector3f direction)
          Sets this line to the passed parameters.
 void setDirection(float x, float y, float z)
          Sets the line's direction.
 void setDirection(Tuple3f direction)
          Sets the line's direction.
 void setOrigin(float x, float y, float z)
          Sets the line's origin.
 void setOrigin(Tuple3f origin)
          Sets the line's origin.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Line

public Line(float origX,
            float origY,
            float origZ,
            float direcX,
            float direcY,
            float direcZ)
Creates a new Line.

Parameters:
origX -
origY -
origZ -
direcX -
direcY -
direcZ -

Line

public Line(Point3f origin,
            Vector3f direction)
Creates a new Line.

Parameters:
origin - the new origin point
direction - the new direction vector

Line

public Line()
Creates a new Line.


Line

public Line(Line template)
Clone constructor.

Method Detail

getOrigin

public Point3f getOrigin()
Returns:
the line's origin

setOrigin

public void setOrigin(float x,
                      float y,
                      float z)
Sets the line's origin.

Parameters:
x -
y -
z -

setOrigin

public void setOrigin(Tuple3f origin)
Sets the line's origin.

Parameters:
origin - new origin

getDirection

public Vector3f getDirection()
Returns:
the line's direction

setDirection

public void setDirection(float x,
                         float y,
                         float z)
Sets the line's direction.

Parameters:
x -
y -
z -

setDirection

public void setDirection(Tuple3f direction)
Sets the line's direction.

Parameters:
direction - new direction

getLength

public float getLength()
Returns:
the line's length same as length()

length

public float length()
Returns:
the line's length same as getLength()

clone

public Line clone()
Creates a clone.

Overrides:
clone in class java.lang.Object

set

public void set(Point3f origin,
                Vector3f direction)
Sets this line to the passed parameters.

Parameters:
origin - the new origin point
direction - the new direction vector

set

public void set(Line line)
Sets this line to be equal to the passed one.


equals

public boolean equals(Line line)
Checks if the given line equals this one.

Parameters:
line - the ray to test for equality

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this ray