Package com.jme3.math
Class Line
java.lang.Object
com.jme3.math.Line
- All Implemented Interfaces:
Savable,Serializable,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.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Create a copy of this line.floatCalculate the distance from this line to the specified point.floatdistanceSquared(Vector3f point) Calculate the squared distance from this line to the specified point.getDirectionreturns the direction of the line.getOriginreturns the origin of the line.voidorthogonalLineFit(FloatBuffer points) Fit this line to the specified points.random()randomdetermines a random point along the line.randomdetermines a random point along the line.voidread(JmeImporter importer) De-serialize this line from the specified importer, for example when loading from a J3O file.voidsetDirection(Vector3f direction) setDirectionsets the direction of the line.voidsetOriginsets the origin of the line.voidwrite(JmeExporter e) Serialize this line to the specified exporter, for example when saving to a J3O file.
-
Constructor Details
-
Line
public Line()Constructor instantiates a newLineobject. The origin and direction both default to (0,0,0). -
Line
Constructor instantiates a newLineobject. The origin and direction are set via the parameters.- Parameters:
origin- the origin of the line.direction- the direction of the line.
-
-
Method Details
-
getOrigin
getOriginreturns the origin of the line.- Returns:
- the origin of the line.
-
setOrigin
setOriginsets the origin of the line.- Parameters:
origin- the origin of the line.
-
getDirection
getDirectionreturns the direction of the line.- Returns:
- the direction of the line.
-
setDirection
setDirectionsets the direction of the line.- Parameters:
direction- the direction of the line.
-
distanceSquared
Calculate the squared distance from this line to the specified point.- Parameters:
point- location vector of the input point (not null, unaffected)- Returns:
- the square of the minimum distance (≥0)
-
distance
Calculate the distance from this line to the specified point.- Parameters:
point- location vector of the input point (not null, unaffected)- Returns:
- the minimum distance (≥0)
-
orthogonalLineFit
Fit this line to the specified points.- Parameters:
points- a buffer containing location vectors, or null
-
random
randomdetermines a random point along the line.- Returns:
- a random point on the line.
-
random
randomdetermines a random point along the line.- Parameters:
result- Vector to store result in- Returns:
- a random point on the line.
-
write
Serialize this line to the specified exporter, for example when saving to a J3O file.- Specified by:
writein interfaceSavable- Parameters:
e- (not null)- Throws:
IOException- from the exporter
-
read
De-serialize this line from the specified importer, for example when loading from a J3O file.- Specified by:
readin interfaceSavable- Parameters:
importer- (not null)- Throws:
IOException- from the importer
-
clone
Create a copy of this line.
-