Path3D

@Serializable
class Path3D(val segments: List<Segment3D>, val closed: Boolean) : Path<Vector3> (source)

Represents a 3D path composed of multiple segments. The class supports operations on the path, such as transformations, sampling, sub-path extraction, and various geometric calculations. It also provides methods for creating paths from points or segments and combines functionality for both open and closed paths.

Constructors

Link copied to clipboard
constructor(segments: List<Segment3D>, closed: Boolean)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val bounds: Box

A computed property that calculates and returns the bounding box of the Path3D. The bounding box is determined by mapping and aggregating the individual bounding boxes of all segments in the path.

Link copied to clipboard
open override val closed: Boolean

Indicates whether the path is closed (i.e., the last point connects to the first point).

Link copied to clipboard
open override val empty: Boolean
Link copied to clipboard

A computed property that provides a list of individual Path3D instances, each wrapping a single segment from the segments property of the current Path3D. Each of these paths is not closed.

Link copied to clipboard
open override val infinity: Vector3
Link copied to clipboard
@Transient
open val length: Double
Link copied to clipboard

Retrieves a new Path3D instance where the order of the segments is reversed and each segment is individually reversed. The closed property of the path is preserved.

Link copied to clipboard
open override val segments: List<Segment3D>

A list of the segments forming the path.

Functions

Link copied to clipboard
open fun adaptivePositions(distanceTolerance: Double = 0.5): List<Vector3>

Recursively subdivides linear Segment2Ds to approximate Bézier curves.

Link copied to clipboard
open fun adaptivePositionsWithT(distanceTolerance: Double = 0.5): List<Pair<Vector3, Double>>
Link copied to clipboard
open fun curvature(ut: Double): Double
Link copied to clipboard
open fun direction(ut: Double): Vector3
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open fun equidistantPositions(pointCount: Int, distanceTolerance: Double = 0.5): List<Vector3>

Returns specified amount of points of equal distance from each other.

Link copied to clipboard
open fun equidistantPositionsWithT(pointCount: Int, distanceTolerance: Double = 0.5): List<Pair<Vector3, Double>>
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun map(closed: Boolean = this.closed, mapper: (Segment3D) -> Segment3D): Path3D

Transforms the segments of the current Path3D by applying a given mapping function, and optionally adjusts the connections between the segments to maintain continuity.

Link copied to clipboard
fun on(point: Vector3, error: Double = 5.0): Double?

Checks if a give point lies on the contour

Link copied to clipboard
operator fun plus(other: Path3D): Path3D
Link copied to clipboard
open fun pointAtLength(length: Double, distanceTolerance: Double = 0.5): Vector3

Calculates the point at a given distance along this ShapeContour.

Link copied to clipboard
open fun position(ut: Double): Vector3

Returns a point on the path of the ShapeContour.

Link copied to clipboard

Project a point on the contour

Link copied to clipboard
fun sampleEquidistant(pointCount: Int, distanceTolerance: Double = 0.5): Path3D

Sample the shape contour into line segments

Link copied to clipboard
fun sampleLinear(distanceTolerance: Double = 0.5): Path3D

Adaptively sample the contour into line segments while still approximating the original contour

Link copied to clipboard
open fun segment(ut: Double): Pair<Int, Double>

Returns segment number and segment offset in a ShapeContour for the given ut.

Link copied to clipboard
open override fun sub(t0: Double, t1: Double): Path3D

Sample a sub contour

Link copied to clipboard
open fun tForLength(length: Double): Double

Estimates the t value for a given length.

Link copied to clipboard
fun transform(transform: Matrix44): Path3D

Transforms the current Path3D using the provided transformation matrix.