com.jme.math
Class Line

java.lang.Object
  extended by com.jme.math.Line
All Implemented Interfaces:
Savable, java.io.Serializable, java.lang.Cloneable

public class Line
extends java.lang.Object
implements java.io.Serializable, Savable, java.lang.Cloneable

Line defines a line. Where a line is defined as infinite along two points. The two points of the line are defined as the origin and direction.

Author:
Mark Powell, Joshua Slack
See Also:
Serialized Form

Constructor Summary
Line()
          Constructor instantiates a new Line object.
Line(Vector3f origin, Vector3f direction)
          Constructor instantiates a new Line object.
 
Method Summary
 Line clone()
           
 float distance(Vector3f point)
           
 float distanceSquared(Vector3f point)
           
 java.lang.Class<? extends Line> getClassTag()
           
 Vector3f getDirection()
          getDirection returns the direction of the line.
 Vector3f getOrigin()
          getOrigin returns the origin of the line.
 void orthogonalLineFit(java.nio.FloatBuffer points)
           
 Vector3f random()
          random determines a random point along the line.
 Vector3f random(Vector3f result)
          random determines a random point along the line.
 void read(JMEImporter e)
           
 void setDirection(Vector3f direction)
          setDirection sets the direction of the line.
 void setOrigin(Vector3f origin)
          setOrigin sets the origin of the line.
 void write(JMEExporter e)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Line

public Line()
Constructor instantiates a new Line object. The origin and direction are set to defaults (0,0,0).


Line

public Line(Vector3f origin,
            Vector3f direction)
Constructor instantiates a new Line object. The origin and direction are set via the parameters.

Parameters:
origin - the origin of the line.
direction - the direction of the line.
Method Detail

getOrigin

public Vector3f getOrigin()
getOrigin returns the origin of the line.

Returns:
the origin of the line.

setOrigin

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

Parameters:
origin - the origin of the line.

getDirection

public Vector3f getDirection()
getDirection returns the direction of the line.

Returns:
the direction of the line.

setDirection

public void setDirection(Vector3f direction)
setDirection sets the direction of the line.

Parameters:
direction - the direction of the line.

distanceSquared

public float distanceSquared(Vector3f point)

distance

public float distance(Vector3f point)

orthogonalLineFit

public void orthogonalLineFit(java.nio.FloatBuffer points)

random

public Vector3f random()
random determines a random point along the line.

Returns:
a random point on the line.

random

public Vector3f random(Vector3f result)
random determines a random point along the line.

Parameters:
result - Vector to store result in
Returns:
a random point on the line.

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

getClassTag

public java.lang.Class<? extends Line> getClassTag()
Specified by:
getClassTag in interface Savable

clone

public Line clone()
Overrides:
clone in class java.lang.Object