Package toxi.geom
Class Line3D
java.lang.Object
toxi.geom.Line3D
- Direct Known Subclasses:
DLASegment
,WingedEdge
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionLine3D
(float x1, float y1, float z1, float x2, float y2, float z2) Line3D
(ReadonlyVec3D a, ReadonlyVec3D b) -
Method Summary
Modifier and TypeMethodDescriptionCalculates the line segment that is the shortest route between this line and the given one.Computes the closest point on this line to the given one.copy()
boolean
Returns the line's axis-aligned bounding box.float
float
boolean
hasEndPoint
(Vec3D p) int
hashCode()
Computes a hash code ignoring the directionality of the line.int
Computes the hash code for this instance taking directionality into account.offsetAndGrowBy
(float offset, float scale, Vec3D ref) scaleLength
(float scale) set
(ReadonlyVec3D a, ReadonlyVec3D b) splitIntoSegments
(List<Vec3D> segments, float stepLength, boolean addFirst) splitIntoSegments
(Vec3D a, Vec3D b, float stepLength, List<Vec3D> segments, boolean addFirst) Splits the line between A and B into segments of the given length, starting at point A.toRay3D()
toString()
-
Field Details
-
a
-
b
-
-
Constructor Details
-
Line3D
public Line3D(float x1, float y1, float z1, float x2, float y2, float z2) -
Line3D
-
Line3D
-
-
Method Details
-
splitIntoSegments
public static final List<Vec3D> splitIntoSegments(Vec3D a, Vec3D b, float stepLength, List<Vec3D> segments, boolean addFirst) Splits the line between A and B into segments of the given length, starting at point A. The tweened points are added to the given result list. The last point added is B itself and hence it is likely that the last segment has a shorter length than the step length requested. The first point (A) can be omitted and not be added to the list if so desired.- Parameters:
a
- start pointb
- end point (always added to results)stepLength
- desired distance between pointssegments
- existing array list for results (or a new list, if null)addFirst
- false, if A is NOT to be added to results- Returns:
- list of result vectors
-
closestLineTo
Calculates the line segment that is the shortest route between this line and the given one. Also calculates the coefficients where the end points of this new line lie on the existing ones. If these coefficients are within the 0.0 .. 1.0 interval the endpoints of the intersection line are within the given line segments, if not then the intersection line is outside.Code based on original by Paul Bourke:
http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline3d/ -
closestPointTo
Computes the closest point on this line to the given one.- Parameters:
p
- point to check against- Returns:
- closest point on the line
-
copy
-
equals
-
getBounds
Returns the line's axis-aligned bounding box.- Returns:
- aabb
- See Also:
-
getDirection
-
getLength
public float getLength() -
getLengthSquared
public float getLengthSquared() -
getMidPoint
-
getNormal
-
hasEndPoint
-
hashCode
public int hashCode()Computes a hash code ignoring the directionality of the line. -
hashCodeWithDirection
public int hashCodeWithDirection()Computes the hash code for this instance taking directionality into account. A->B will produce a different hash code than B->A. If directionality is not required or desired use the defaulthashCode()
method.- Returns:
- hash code
- See Also:
-
offsetAndGrowBy
-
scaleLength
-
set
-
set
-
splitIntoSegments
-
toRay3D
-
toString
-