public final class Line
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static Vec4[] |
clipToFrustum(Vec4 pa,
Vec4 pb,
Frustum frustum)
Clip a line segment to a frustum, returning the end points of the portion of the segment that is within the
frustum.
|
double |
distanceTo(Vec4 p)
Calculate the shortests distance between this line and a specified
Vec4 . |
static double |
distanceToSegment(Vec4 p0,
Vec4 p1,
Vec4 p) |
boolean |
equals(java.lang.Object o)
Performs a comparison to test whether this Object is internally identical to the other Object
o . |
static Line |
fromSegment(Vec4 pa,
Vec4 pb)
Create the line containing a line segement between two points.
|
Vec4 |
getDirection() |
Vec4 |
getOrigin() |
Vec4 |
getPointAt(double t) |
int |
hashCode() |
boolean |
isPointBehindLineOrigin(Vec4 point)
Determine if a point is behind the
Line 's origin. |
Vec4 |
nearestIntersectionPoint(Intersection[] intersections) |
static Vec4 |
nearestPointOnSegment(Vec4 p0,
Vec4 p1,
Vec4 p)
Finds the closest point to a third point of a segment defined by two points.
|
Vec4 |
nearestPointTo(Vec4 p) |
double |
selfDot() |
java.lang.String |
toString() |
public static Vec4[] clipToFrustum(Vec4 pa, Vec4 pb, Frustum frustum)
pa
- the first point of the segment.pb
- the second point of the segment.frustum
- the frustum.public final double distanceTo(Vec4 p)
Vec4
. This method returns a
positive distance.p
- the Vec4
whose distance from this Line
will be calculatedLine
and the specified Vec4
java.lang.IllegalArgumentException
- if p
is nullpublic final boolean equals(java.lang.Object o)
o
.
This method takes into account both direction and origin, so two lines which may be equivalent may not be
considered equal.equals
in class java.lang.Object
o
- the object to be compared against.public static Line fromSegment(Vec4 pa, Vec4 pb)
pa
- the first point of the line segment.pb
- the second point of the line segment.java.lang.IllegalArgumentException
- if either point is null or they are coincident.public final Vec4 getDirection()
public final Vec4 getOrigin()
public final Vec4 getPointAt(double t)
public final int hashCode()
hashCode
in class java.lang.Object
public boolean isPointBehindLineOrigin(Vec4 point)
Line
's origin.point
- The point to test.point
is behind this Line
's origin, false otherwise.public Vec4 nearestIntersectionPoint(Intersection[] intersections)
public static Vec4 nearestPointOnSegment(Vec4 p0, Vec4 p1, Vec4 p)
p0
- The first endpoint of the segment.p1
- The second endpoint of the segment.p
- The point outside the segment whose closest point on the segment is desired.public final double selfDot()
public java.lang.String toString()
toString
in class java.lang.Object