Intersections

Types

Link copied to clipboard
class CurveInterval(curve: Curve2, tLo: Double, tHi: Double, pLo: Vec2, pHi: Vec2)

Represents a parametric interval of a 2D curve, defined by a start and end parameter, and their corresponding geometric positions.

Link copied to clipboard
class FatLine

Represents a "fat line," which is a construct used in geometry for error-bounded approximations of parametric curves. A fat line is defined by a curve and a parametric range and can be subdivided recursively as needed for geometric computations like intersection testing.

Properties

Link copied to clipboard
Link copied to clipboard
const val FAT_LINE_SPATIAL_EPSILON: Double = 1.0E-5
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
const val PARAMETRIC_EPSILON: Double = 1.0E-5
Link copied to clipboard
const val SPATIAL_EPSILON: Double = 1.0E-5

Functions

Link copied to clipboard
Link copied to clipboard
fun clipHull(fatLine: Interval, hull: Array<Vec2>): Interval
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Determines the intersection points between two 2D parametric curves using the fat-line algorithm.

Link copied to clipboard
Link copied to clipboard

Computes the intersection points between two 2D curves.

Link copied to clipboard

Computes the intersections between a 2D line segment and a cubic Bézier curve.

Link copied to clipboard

Calculates the intersection points between a line and a curve in 2D space.

Link copied to clipboard
fun lineLine(a: Line2, b: Line2): Array<Vec2>

Computes the intersection points of two line segments, if any.

Link copied to clipboard

Finds the intersection points between a 2D line segment and a quadratic Bezier curve.

Link copied to clipboard
fun normalize(intersections: Array<Vec2>): Array<Vec2>

Normalizes a given array of Vec2 intersections. The method applies several operations to ensure that the intersections:

Link copied to clipboard
Link copied to clipboard
fun round(n: Double, epsilon: Double): Double

Adjusts a given double value based on comparison with specific thresholds (0.0 and 1.0) within a defined epsilon. If the value is within epsilon of 0.0, it is set to 0.0. If the value is within epsilon of 1.0, it is set to 1.0. Otherwise, it remains unchanged.

Link copied to clipboard