Skip to content

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.

ParameterTypeDescription
curveCurveHandleThe curve to query

PluginGeomQueryCurveGetEndPointArgs

Arguments for getEndPoint, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query

PluginGeomQueryCurveGetMidPointArgs

Arguments for getMidPoint, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query

PluginGeomQueryCurveGetLengthArgs

Arguments for getLength, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query

PluginGeomQueryCurveGetChordLengthArgs

Arguments for getChordLength, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query

PluginGeomQueryCurveGetTangentArgs

Arguments for getTangent, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointVec3HandlePoint on the curve

PluginGeomQueryCurveGetNormalArgs

Arguments for getNormal, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointVec3HandlePoint on the curve

PluginGeomQueryCurveGetNearestPointArgs

Arguments for getNearestPoint, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointVec3HandleThe reference point

PluginGeomQueryCurveGetProjectionArgs

Arguments for getProjection, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to project onto
pointVec3HandleThe point to project

PluginGeomQueryCurveGetPointAtDistanceArgs

Arguments for getPointAtDistance, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
referencePointVec3HandlePoint on the curve to measure from
distancenumberDistance along the curve from the reference point
forwardboolean (optional, default true)Direction along the curve

PluginGeomQueryCurveGetParameterAtPointArgs

Arguments for getParameterAtPoint, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointVec3HandlePoint on the curve

PluginGeomQueryCurveGetCurvatureArgs

Arguments for getCurvature, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointVec3HandlePoint on the curve

PluginGeomQueryCurveGetDistanceToPointArgs

Arguments for getDistanceToPoint, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointVec3HandleThe point to measure from

PluginGeomQueryCurveGetDistanceAlongArgs

Arguments for getDistanceAlong, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointAVec3HandleFirst point on the curve
pointBVec3HandleSecond point on the curve

PluginGeomQueryCurveListPointsArgs

Arguments for listPoints, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to sample
resolutionnumber (optional, default 20)Number of samples for arcs; ignored for lines

PluginGeomQueryCurveListSubdivisionsArgs

Arguments for listSubdivisions, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to subdivide
segmentsnumberNumber of equal segments to divide the curve into

PluginGeomQueryCurveIsLinearArgs

Arguments for isLinear, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query

PluginGeomQueryCurveIsOnCurveArgs

Arguments for isOnCurve, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointVec3HandleThe point to test
thresholdnumber (optional, defaults to the engine default)Distance tolerance

PluginGeomQueryCurveHasPointArgs

Arguments for hasPoint, in positional order.

ParameterTypeDescription
curveCurveHandleThe curve to query
pointVec3HandleThe point to test
includeEndPointsboolean (optional, default true)Count endpoints as contained

PluginGeomQueryCurveIsEqualArgs

Arguments for isEqual, in positional order.

ParameterTypeDescription
curveACurveHandleFirst curve
curveBCurveHandleSecond curve

PluginGeomQueryCurveIsOverlappingArgs

Arguments for isOverlapping, in positional order.

ParameterTypeDescription
curveACurveHandleFirst curve
curveBCurveHandleSecond curve
includeEndPointsboolean (optional, default false)Count endpoint contact as overlap

PluginGeomQueryCurveGetCommonPartArgs

Arguments for getCommonPart, in positional order.

ParameterTypeDescription
curveACurveHandleFirst curve
curveBCurveHandleSecond curve

PluginGeomQueryCurveListIntersectionsArgs

Arguments for listIntersections, in positional order.

ParameterTypeDescription
curveACurveHandleFirst curve
curveBCurveHandleSecond curve
boundedAboolean (optional, default true)Bound intersections to curveA's extent
boundedBboolean (optional, default true)Bound intersections to curveB's extent

PluginGeomQueryCurveGetMergedCurveArgs

Arguments for getMergedCurve, in positional order.

ParameterTypeDescription
curveACurveHandleFirst curve
curveBCurveHandleSecond curve

PluginGeomQueryCurveIsContinuousArgs

Arguments for isContinuous, in positional order.

ParameterTypeDescription
curveACurveHandleFirst curve
curveBCurveHandleSecond curve

PluginGeomQueryCurveIsParallelArgs

Arguments for isParallel, in positional order.

ParameterTypeDescription
lineALineHandleFirst line
lineBLineHandleSecond line
tolerancenumber (optional, defaults to the engine default)Angular tolerance

PluginGeomQueryCurveGetShortestGapArgs

Arguments for getShortestGap, in positional order.

ParameterTypeDescription
curveACurveHandleFirst curve
curveBCurveHandleSecond curve
includeEndPointsboolean (optional, default false)Include endpoints when measuring

PluginGeomQueryCurveGetDistanceBetweenArgs

Arguments for getDistanceBetween, in positional order.

ParameterTypeDescription
lineALineHandleFirst line
lineBLineHandleSecond 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 query
    • point: 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 query
    • point: 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 query
    • point: 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 onto
    • point: 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 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
  • 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 query
    • point: 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 query
    • point: 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 query
    • point: 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 query
    • pointA: Vec3Handle — First point on the curve
    • pointB: 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 sample
    • resolution: number (optional, default 20) — 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 subdivide
    • segments: 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: booleantrue if the curve is linear, otherwise false

isOnCurve(curve, point, threshold?)

Test whether a point lies on a curve within an optional threshold.

  • Parameters:
    • curve: CurveHandle — The curve to query
    • point: Vec3Handle — The point to test
    • threshold: number (optional, defaults to the engine default) — Distance tolerance
  • Returns: booleantrue if the point is on the curve, otherwise false

hasPoint(curve, point, includeEndPoints?)

Test whether a curve contains a point, optionally including its endpoints.

  • Parameters:
    • curve: CurveHandle — The curve to query
    • point: Vec3Handle — The point to test
    • includeEndPoints: boolean (optional, default true) — Count endpoints as contained
  • Returns: booleantrue if the curve contains the point, otherwise false

isEqual(curveA, curveB)

Test whether two curves are geometrically equal.

  • Parameters:
    • curveA: CurveHandle — First curve
    • curveB: CurveHandle — Second curve
  • Returns: booleantrue if the curves are equal, otherwise false

isOverlapping(curveA, curveB, includeEndPoints?)

Test whether two curves overlap (share a collinear/concentric span), optionally including their endpoints.

  • Parameters:
    • curveA: CurveHandle — First curve
    • curveB: CurveHandle — Second curve
    • includeEndPoints: boolean (optional, default false) — Count endpoint contact as overlap
  • Returns: booleantrue if the curves overlap, otherwise false

getCommonPart(curveA, curveB)

Get the common (overlapping) part of two curves.

  • Parameters:
    • curveA: CurveHandle — First curve
    • curveB: CurveHandle — Second curve
  • Returns: CurveHandle | null — The common part, or null if there is none

listIntersections(curveA, curveB, boundedA?, boundedB?)

List the intersection points between two curves.

  • Parameters:
    • 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
  • 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 curve
    • curveB: CurveHandle — Second curve
  • Returns: CurveHandle | null — The merged curve, or null if they cannot be merged

isContinuous(curveA, curveB)

Test whether two curves are continuous (share an endpoint without a gap).

  • Parameters:
    • curveA: CurveHandle — First curve
    • curveB: CurveHandle — Second curve
  • Returns: booleantrue if the curves are continuous, otherwise false

isParallel(lineA, lineB, tolerance?)

Test whether two lines are parallel within an optional tolerance.

  • Parameters:
    • lineA: LineHandle — First line
    • lineB: LineHandle — Second line
    • tolerance: number (optional, defaults to the engine default) — Angular tolerance
  • Returns: booleantrue if the lines are parallel, otherwise false

getShortestGap(curveA, curveB, includeEndPoints?)

Get the shortest gap between two curves, optionally including their endpoints.

  • Parameters:
    • curveA: CurveHandle — First curve
    • curveB: CurveHandle — Second curve
    • includeEndPoints: boolean (optional, default false) — 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 line
    • lineB: 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:

CodeThrown byWhendetails
HANDLE_INVALIDall methodsA 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.