Appearance
Query: Curve
Curve queries — read-only geometric questions about curves (lines and arcs) and the relationships between two curves. Every method takes opaque curve handles (CurveHandle / LineHandle) and point handles (Vec3Handle) and returns plain values — points as Vec3Components, lengths/distances/parameters as number, predicates as boolean. Relationship methods that produce a new curve return a CurveHandle (or null when there is no result). No query mutates its inputs. Lengths and distances are in Snaptrude units — convert with snaptrude.core.units.convert(value, from, to). Accessed via snaptrude.core.geom.query.curve.
Types
PluginGeomQueryCurveGetStartPointArgs
Arguments for getStartPoint, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
PluginGeomQueryCurveGetEndPointArgs
Arguments for getEndPoint, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
PluginGeomQueryCurveGetMidPointArgs
Arguments for getMidPoint, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
PluginGeomQueryCurveGetLengthArgs
Arguments for getLength, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
PluginGeomQueryCurveGetChordLengthArgs
Arguments for getChordLength, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
PluginGeomQueryCurveGetTangentArgs
Arguments for getTangent, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
point | Vec3Handle | Point on the curve |
PluginGeomQueryCurveGetNormalArgs
Arguments for getNormal, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
point | Vec3Handle | Point on the curve |
PluginGeomQueryCurveGetNearestPointArgs
Arguments for getNearestPoint, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
point | Vec3Handle | The reference point |
PluginGeomQueryCurveGetProjectionArgs
Arguments for getProjection, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to project onto |
point | Vec3Handle | The point to project |
PluginGeomQueryCurveGetPointAtDistanceArgs
Arguments for getPointAtDistance, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
referencePoint | Vec3Handle | Point on the curve to measure from |
distance | number | Distance along the curve from the reference point |
forward | boolean (optional, default true) | Direction along the curve |
PluginGeomQueryCurveGetParameterAtPointArgs
Arguments for getParameterAtPoint, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
point | Vec3Handle | Point on the curve |
PluginGeomQueryCurveGetCurvatureArgs
Arguments for getCurvature, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
point | Vec3Handle | Point on the curve |
PluginGeomQueryCurveGetDistanceToPointArgs
Arguments for getDistanceToPoint, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
point | Vec3Handle | The point to measure from |
PluginGeomQueryCurveGetDistanceAlongArgs
Arguments for getDistanceAlong, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
pointA | Vec3Handle | First point on the curve |
pointB | Vec3Handle | Second point on the curve |
PluginGeomQueryCurveListPointsArgs
Arguments for listPoints, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to sample |
resolution | number (optional, default 20) | Number of samples for arcs; ignored for lines |
PluginGeomQueryCurveListSubdivisionsArgs
Arguments for listSubdivisions, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to subdivide |
segments | number | Number of equal segments to divide the curve into |
PluginGeomQueryCurveIsLinearArgs
Arguments for isLinear, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
PluginGeomQueryCurveIsOnCurveArgs
Arguments for isOnCurve, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
point | Vec3Handle | The point to test |
threshold | number (optional, defaults to the engine default) | Distance tolerance |
PluginGeomQueryCurveHasPointArgs
Arguments for hasPoint, in positional order.
| Parameter | Type | Description |
|---|---|---|
curve | CurveHandle | The curve to query |
point | Vec3Handle | The point to test |
includeEndPoints | boolean (optional, default true) | Count endpoints as contained |
PluginGeomQueryCurveIsEqualArgs
Arguments for isEqual, in positional order.
| Parameter | Type | Description |
|---|---|---|
curveA | CurveHandle | First curve |
curveB | CurveHandle | Second curve |
PluginGeomQueryCurveIsOverlappingArgs
Arguments for isOverlapping, in positional order.
| Parameter | Type | Description |
|---|---|---|
curveA | CurveHandle | First curve |
curveB | CurveHandle | Second curve |
includeEndPoints | boolean (optional, default false) | Count endpoint contact as overlap |
PluginGeomQueryCurveGetCommonPartArgs
Arguments for getCommonPart, in positional order.
| Parameter | Type | Description |
|---|---|---|
curveA | CurveHandle | First curve |
curveB | CurveHandle | Second curve |
PluginGeomQueryCurveListIntersectionsArgs
Arguments for listIntersections, in positional order.
| Parameter | Type | Description |
|---|---|---|
curveA | CurveHandle | First curve |
curveB | CurveHandle | Second curve |
boundedA | boolean (optional, default true) | Bound intersections to curveA's extent |
boundedB | boolean (optional, default true) | Bound intersections to curveB's extent |
PluginGeomQueryCurveGetMergedCurveArgs
Arguments for getMergedCurve, in positional order.
| Parameter | Type | Description |
|---|---|---|
curveA | CurveHandle | First curve |
curveB | CurveHandle | Second curve |
PluginGeomQueryCurveIsContinuousArgs
Arguments for isContinuous, in positional order.
| Parameter | Type | Description |
|---|---|---|
curveA | CurveHandle | First curve |
curveB | CurveHandle | Second curve |
PluginGeomQueryCurveIsParallelArgs
Arguments for isParallel, in positional order.
| Parameter | Type | Description |
|---|---|---|
lineA | LineHandle | First line |
lineB | LineHandle | Second line |
tolerance | number (optional, defaults to the engine default) | Angular tolerance |
PluginGeomQueryCurveGetShortestGapArgs
Arguments for getShortestGap, in positional order.
| Parameter | Type | Description |
|---|---|---|
curveA | CurveHandle | First curve |
curveB | CurveHandle | Second curve |
includeEndPoints | boolean (optional, default false) | Include endpoints when measuring |
PluginGeomQueryCurveGetDistanceBetweenArgs
Arguments for getDistanceBetween, in positional order.
| Parameter | Type | Description |
|---|---|---|
lineA | LineHandle | First line |
lineB | LineHandle | Second line |
Functions
getStartPoint(curve)
Get the start point of a curve.
- Parameters:
curve:CurveHandle— The curve to query
- Returns:
Vec3Components— The start point
ts
const start = await snaptrude.core.geom.query.curve.getStartPoint(curve);
console.log(start); // { x, y, z }getEndPoint(curve)
Get the end point of a curve.
- Parameters:
curve:CurveHandle— The curve to query
- Returns:
Vec3Components— The end point
getMidPoint(curve)
Get the mid point of a curve.
- Parameters:
curve:CurveHandle— The curve to query
- Returns:
Vec3Components— The mid point
getLength(curve)
Get the arc-length of a curve.
- Parameters:
curve:CurveHandle— The curve to query
- Returns:
number— The curve length, in Snaptrude units
ts
const length = await snaptrude.core.geom.query.curve.getLength(curve);
// Convert to a display unit with snaptrude.core.units.convert(value, from, to)getChordLength(curve)
Get the straight-line chord length between a curve's endpoints.
- Parameters:
curve:CurveHandle— The curve to query
- Returns:
number— The chord length, in Snaptrude units
getTangent(curve, point)
Get the unit tangent vector of a curve at a point on it.
- Parameters:
curve:CurveHandle— The curve to querypoint:Vec3Handle— Point on the curve
- Returns:
Vec3Components— The tangent vector
getNormal(curve, point)
Get the unit normal vector of a curve at a point on it.
- Parameters:
curve:CurveHandle— The curve to querypoint:Vec3Handle— Point on the curve
- Returns:
Vec3Components— The normal vector
getNearestPoint(curve, point)
Get the point on a curve nearest to an arbitrary point.
- Parameters:
curve:CurveHandle— The curve to querypoint:Vec3Handle— The reference point
- Returns:
Vec3Components— The nearest point on the curve
ts
const p = await snaptrude.core.math.vec3.new(2, 0, 5);
const nearest = await snaptrude.core.geom.query.curve.getNearestPoint(curve, p);getProjection(curve, point)
Project a point onto a curve.
- Parameters:
curve:CurveHandle— The curve to project ontopoint:Vec3Handle— The point to project
- Returns:
Vec3Components— The projected point
getPointAtDistance(curve, referencePoint, distance, forward?)
Get the point at a given distance along a curve from a reference point.
- Parameters:
curve:CurveHandle— The curve to queryreferencePoint:Vec3Handle— Point on the curve to measure fromdistance:number— Distance along the curve from the reference pointforward:boolean(optional, defaulttrue) — Direction along the curve
- Returns:
Vec3Components— The resulting point
getParameterAtPoint(curve, point)
Get the curve parameter corresponding to a point on the curve.
- Parameters:
curve:CurveHandle— The curve to querypoint:Vec3Handle— Point on the curve
- Returns:
number— The parameter
getCurvature(curve, point)
Get the curvature of a curve at a point on it.
- Parameters:
curve:CurveHandle— The curve to querypoint:Vec3Handle— Point on the curve
- Returns:
number— The curvature
getDistanceToPoint(curve, point)
Get the shortest distance from an arbitrary point to a curve.
- Parameters:
curve:CurveHandle— The curve to querypoint:Vec3Handle— The point to measure from
- Returns:
number— The distance, in Snaptrude units
getDistanceAlong(curve, pointA, pointB)
Get the arc-length distance along a curve between two points on it.
- Parameters:
curve:CurveHandle— The curve to querypointA:Vec3Handle— First point on the curvepointB:Vec3Handle— Second point on the curve
- Returns:
number— The distance along the curve, in Snaptrude units
listPoints(curve, resolution?)
List sampled points along a curve.
- Parameters:
curve:CurveHandle— The curve to sampleresolution:number(optional, default20) — Number of samples for arcs; ignored for lines
- Returns:
Vec3Components[]— The sampled points
listSubdivisions(curve, segments)
List the points produced by subdividing a curve into equal segments.
- Parameters:
curve:CurveHandle— The curve to subdividesegments:number— Number of equal segments to divide the curve into
- Returns:
Vec3Components[]— The subdivision points
ts
// Divide an arc into 4 equal segments
const points = await snaptrude.core.geom.query.curve.listSubdivisions(arc, 4);isLinear(curve)
Test whether a curve is a straight line.
- Parameters:
curve:CurveHandle— The curve to query
- Returns:
boolean—trueif the curve is linear, otherwisefalse
isOnCurve(curve, point, threshold?)
Test whether a point lies on a curve within an optional threshold.
- Parameters:
curve:CurveHandle— The curve to querypoint:Vec3Handle— The point to testthreshold:number(optional, defaults to the engine default) — Distance tolerance
- Returns:
boolean—trueif the point is on the curve, otherwisefalse
hasPoint(curve, point, includeEndPoints?)
Test whether a curve contains a point, optionally including its endpoints.
- Parameters:
curve:CurveHandle— The curve to querypoint:Vec3Handle— The point to testincludeEndPoints:boolean(optional, defaulttrue) — Count endpoints as contained
- Returns:
boolean—trueif the curve contains the point, otherwisefalse
isEqual(curveA, curveB)
Test whether two curves are geometrically equal.
- Parameters:
curveA:CurveHandle— First curvecurveB:CurveHandle— Second curve
- Returns:
boolean—trueif the curves are equal, otherwisefalse
isOverlapping(curveA, curveB, includeEndPoints?)
Test whether two curves overlap (share a collinear/concentric span), optionally including their endpoints.
- Parameters:
curveA:CurveHandle— First curvecurveB:CurveHandle— Second curveincludeEndPoints:boolean(optional, defaultfalse) — Count endpoint contact as overlap
- Returns:
boolean—trueif the curves overlap, otherwisefalse
getCommonPart(curveA, curveB)
Get the common (overlapping) part of two curves.
- Parameters:
curveA:CurveHandle— First curvecurveB:CurveHandle— Second curve
- Returns:
CurveHandle | null— The common part, ornullif there is none
listIntersections(curveA, curveB, boundedA?, boundedB?)
List the intersection points between two curves.
- Parameters:
curveA:CurveHandle— First curvecurveB:CurveHandle— Second curveboundedA:boolean(optional, defaulttrue) — Bound intersections tocurveA's extentboundedB:boolean(optional, defaulttrue) — Bound intersections tocurveB's extent
- Returns:
Vec3Components[]— The intersection points
ts
const hits = await snaptrude.core.geom.query.curve.listIntersections(curveA, curveB);
if (hits.length > 0) {
console.log("first intersection", hits[0]);
}getMergedCurve(curveA, curveB)
Merge two curves into a single curve when they are mergeable.
- Parameters:
curveA:CurveHandle— First curvecurveB:CurveHandle— Second curve
- Returns:
CurveHandle | null— The merged curve, ornullif they cannot be merged
isContinuous(curveA, curveB)
Test whether two curves are continuous (share an endpoint without a gap).
- Parameters:
curveA:CurveHandle— First curvecurveB:CurveHandle— Second curve
- Returns:
boolean—trueif the curves are continuous, otherwisefalse
isParallel(lineA, lineB, tolerance?)
Test whether two lines are parallel within an optional tolerance.
- Parameters:
lineA:LineHandle— First linelineB:LineHandle— Second linetolerance:number(optional, defaults to the engine default) — Angular tolerance
- Returns:
boolean—trueif the lines are parallel, otherwisefalse
getShortestGap(curveA, curveB, includeEndPoints?)
Get the shortest gap between two curves, optionally including their endpoints.
- Parameters:
curveA:CurveHandle— First curvecurveB:CurveHandle— Second curveincludeEndPoints:boolean(optional, defaultfalse) — Include endpoints when measuring
- Returns:
number— The shortest gap, in Snaptrude units
getDistanceBetween(lineA, lineB)
Get the perpendicular distance between two parallel lines.
- Parameters:
lineA:LineHandle— First linelineB:LineHandle— Second line
- Returns:
number— The distance between the lines, in Snaptrude units
Errors
Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:
| Code | Thrown by | When | details |
|---|---|---|---|
HANDLE_INVALID | all methods | A curve or point handle is invalid, stale, or foreign | — |
Beyond handle resolution these reads are total — relationship methods signal "no result" by returning null, not by throwing.