|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.math.LineSegment
public class LineSegment
LineSegment represents a segment in the space. This is a portion of a Line that has a limited start and end points.
A LineSegment is defined by an origin, a direction and an extent (or length). Direction should be a normalized vector. It is not internally normalized.
This class provides methods to calculate distances between LineSegments, Rays and Vectors.
It is also possible to retrieve both end points of the segment getPositiveEnd(Vector3f)
and getNegativeEnd(Vector3f)
. There are also methods to check whether
a point is within the segment bounds.
Ray
,
Serialized FormConstructor Summary | |
---|---|
LineSegment()
|
|
LineSegment(LineSegment ls)
|
|
LineSegment(Vector3f start,
Vector3f end)
Creates a new LineSegment with a given origin and end. |
|
LineSegment(Vector3f origin,
Vector3f direction,
float extent)
Creates a new LineSegment with the given origin, direction and extent. |
Method Summary | |
---|---|
LineSegment |
clone()
|
float |
distance(LineSegment ls)
|
float |
distance(Ray r)
|
float |
distance(Vector3f point)
|
float |
distanceSquared(LineSegment test)
|
float |
distanceSquared(Ray r)
|
float |
distanceSquared(Vector3f point)
|
java.lang.Class<? extends LineSegment> |
getClassTag()
|
Vector3f |
getDirection()
|
float |
getExtent()
|
Vector3f |
getNegativeEnd(Vector3f store)
|
Vector3f |
getOrigin()
|
Vector3f |
getPositiveEnd(Vector3f store)
|
boolean |
isPointInsideBounds(Vector3f point)
Evaluates whether a given point is contained within the axis aligned bounding box that contains this LineSegment. |
boolean |
isPointInsideBounds(Vector3f point,
float error)
Evaluates whether a given point is contained within the axis aligned bounding box that contains this LineSegment. |
void |
read(JMEImporter e)
|
void |
set(LineSegment ls)
|
void |
setDirection(Vector3f direction)
|
void |
setExtent(float extent)
|
void |
setOrigin(Vector3f origin)
|
void |
write(JMEExporter e)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LineSegment()
public LineSegment(LineSegment ls)
public LineSegment(Vector3f origin, Vector3f direction, float extent)
Creates a new LineSegment with the given origin, direction and extent.
Note that the origin is not one of the ends of the LineSegment, but its center.
public LineSegment(Vector3f start, Vector3f end)
Creates a new LineSegment with a given origin and end. This constructor will calculate the center, the direction and the extent.
Method Detail |
---|
public void set(LineSegment ls)
public float distance(Vector3f point)
public float distance(LineSegment ls)
public float distance(Ray r)
public float distanceSquared(Vector3f point)
public float distanceSquared(LineSegment test)
public float distanceSquared(Ray r)
public Vector3f getDirection()
public void setDirection(Vector3f direction)
public float getExtent()
public void setExtent(float extent)
public Vector3f getOrigin()
public void setOrigin(Vector3f origin)
public Vector3f getPositiveEnd(Vector3f store)
public Vector3f getNegativeEnd(Vector3f store)
public void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
java.io.IOException
public java.lang.Class<? extends LineSegment> getClassTag()
getClassTag
in interface Savable
public LineSegment clone()
clone
in class java.lang.Object
public boolean isPointInsideBounds(Vector3f point)
Evaluates whether a given point is contained within the axis aligned bounding box that contains this LineSegment.
This function is float error aware.
public boolean isPointInsideBounds(Vector3f point, float error)
Evaluates whether a given point is contained within the axis aligned bounding box that contains this LineSegment.
This function accepts an error parameter, which is added to the extent of the bounding box.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |