public class Line
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Vec3 |
direction
This line's direction.
|
Vec3 |
origin
This line's origin.
|
Constructor and Description |
---|
Line()
Constructs a line with origin and direction both zero.
|
Line(Line line)
Constructs a line with the origin and direction from a specified line.
|
Line(Vec3 origin,
Vec3 direction)
Constructs a line with a specified origin and direction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
Vec3 |
pointAt(double distance,
Vec3 result)
Computes a Cartesian point a specified distance along this line.
|
Line |
set(Vec3 origin,
Vec3 direction)
Sets this line to a specified origin and direction.
|
Line |
setToSegment(Vec3 pointA,
Vec3 pointB)
Sets this line to the specified segment.
|
java.lang.String |
toString() |
boolean |
triStripIntersection(float[] points,
int stride,
short[] elements,
int count,
Vec3 result)
Computes the first intersection of a triangle strip with this line.
|
public final Vec3 origin
public final Vec3 direction
public Line()
public Line(Vec3 origin, Vec3 direction)
origin
- the line's origindirection
- the line's directionjava.lang.IllegalArgumentException
- If either the origin or the direction are nullpublic Line(Line line)
line
- the line specifying origin and directionjava.lang.IllegalArgumentException
- If the line is nullpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public Line set(Vec3 origin, Vec3 direction)
origin
- the line's new origindirection
- the line's new directionjava.lang.IllegalArgumentException
- If either the origin or the direction are nullpublic Line setToSegment(Vec3 pointA, Vec3 pointB)
pointA
- the segment's first endpointpointB
- the segment's second endpointjava.lang.IllegalArgumentException
- If either endpoint is nullpublic Vec3 pointAt(double distance, Vec3 result)
distance
- The distance from this line's origin at which to compute the point.result
- A pre-allocated Vec3
instance in which to return the computed point.java.lang.IllegalArgumentException
- If the specified result argument is null or undefined.public boolean triStripIntersection(float[] points, int stride, short[] elements, int count, Vec3 result)
points
- an array of points containing XYZ tuplesstride
- the number of coordinates between the first coordinate of adjacent points - must be at least 3elements
- an array of indices into the points defining the triangle strip organizationcount
- the number of indices to considerresult
- a pre-allocated Vec3 in which to return the nearest intersection point, if anyjava.lang.IllegalArgumentException
- If either array is null or empty, if the stride is less than 3, if the count is
less than 0, or if the result argument is null