public class Line extends java.lang.Object implements Savable, java.lang.Cloneable, java.io.Serializable
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.Constructor and Description |
---|
Line()
Constructor instantiates a new
Line object. |
Line(Vector3f origin,
Vector3f direction)
Constructor instantiates a new
Line object. |
Modifier and Type | Method and Description |
---|---|
Line |
clone()
Create a copy of this line.
|
float |
distance(Vector3f point)
Calculate the distance from this line to the specified point.
|
float |
distanceSquared(Vector3f point)
Calculate the squared distance from this line to the specified point.
|
Vector3f |
getDirection()
getDirection returns the direction of the line. |
Vector3f |
getOrigin()
getOrigin returns the origin of the line. |
void |
orthogonalLineFit(java.nio.FloatBuffer points)
Fit this line to the specified 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)
De-serialize this line from the specified importer, for example when
loading from a J3O file.
|
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)
Serialize this line to the specified exporter, for example when
saving to a J3O file.
|
public Line()
Line
object. The origin and
direction both default to (0,0,0).public Vector3f getOrigin()
getOrigin
returns the origin of the line.public void setOrigin(Vector3f origin)
setOrigin
sets the origin of the line.origin
- the origin of the line.public Vector3f getDirection()
getDirection
returns the direction of the line.public void setDirection(Vector3f direction)
setDirection
sets the direction of the line.direction
- the direction of the line.public float distanceSquared(Vector3f point)
point
- location vector of the input point (not null, unaffected)public float distance(Vector3f point)
point
- location vector of the input point (not null, unaffected)public void orthogonalLineFit(java.nio.FloatBuffer points)
points
- a buffer containing location vectors, or nullpublic Vector3f random()
random
determines a random point along the line.public Vector3f random(Vector3f result)
random
determines a random point along the line.result
- Vector to store result inpublic void write(JmeExporter e) throws java.io.IOException
public void read(JmeImporter e) throws java.io.IOException
public Line clone()
clone
in class java.lang.Object