Skip to main content

Module path_bound

Module path_bound 

Source
Expand description

Curve-path piece bounds given as a native parameter or a point (#304, ADR 0082 amendment).

A PathBound names where a piece starts or ends without stating its distance in the curve’s station measure. A parameter is read as it is; the distance to it is StationCurve’s own measure at that parameter, the one super::StationPiece::between_parameters measures by, so a bounded piece resolves to the piece between those parameters bitwise. This module resolves a POINT to the one parameter naming it.

§Points

A point is given in the curve’s own coordinates, before any placement, and lifted to z = 0 on a 2D curve. It must lie on the curve within the joint tolerance, super::JOINT_TOLERANCE * max(1, |p|), |p| the point’s largest coordinate magnitude, the tolerance within which two pieces meet and within which a graph compiler accepts a trim point:

  • A line, a circle or an ellipse is inverted in closed form (the parameter axiolid-evaluate’s invert2/invert3 reports, a closed conic’s angle in [0, 2 pi)), then checked against the curve. The angle runs round, so a closed conic’s seam is one parameter, not two.
  • A polyline is projected onto each segment; a B-spline is sampled (64 samples per control point, and every knot), each local minimum of the distance refined by Newton on |C(t) - p|^2 within its neighbouring samples. Every parameter that comes within tolerance is kept.
  • Two parameters name the same place when the curve between them stays within tolerance of the point (every vertex between them on a polyline; every sample between them and their midpoint on a B-spline): one place is one parameter, the nearest of them.

No parameter within tolerance is refused naming PATH_POINT_OFF_CURVE (the point is never projected onto the curve); several places naming PATH_POINT_AMBIGUOUS: a curve passing through the point more than once, and the seam of a closed polyline or B-spline, whose two domain ends both name it. Every other family (an intrinsic curve, a chain, an elevated or banked curve, an offset) is refused naming POINT_BOUND_UNSUPPORTED; a caller states its parameter instead.

Constants§

PATH_POINT_AMBIGUOUS
The input a point bound of a curve path piece (#304) is refused for when several parameters of the curve name it: a curve that passes through it more than once, or the seam of a closed curve other than a circle or an ellipse (whose angle runs round).
PATH_POINT_OFF_CURVE
The input a point bound of a curve path piece (#304) is refused for when it does not lie on the piece’s curve within the joint tolerance 1e-9 * max(1, |p|): a provider never projects it onto the curve.
POINT_BOUND_UNSUPPORTED
The input a point bound on a curve this evaluator does not invert is refused for.

Functions§

point_bound_tolerance
How far from its curve a point bound may lie: the joint tolerance at the point.