Expand description
Arc length, and distributing points along a curve by it.
A curve’s parameter is not its length. A B-spline traverses its own parameter at whatever speed its knots imply; a cone’s slant runs at a rate set by its half angle. So “a point every two millimetres” and “twenty evenly spaced points” are questions about length, and answering them from parameter values is answering a different question.
§Two operations, one of them an inversion
Length is an integral: the speed |c'(u)| integrated over the range. That
is curve_length, and it is exact to a stated tolerance rather than
summed from a polyline.
Placing a point at a length is the inverse of that integral, which has no closed form for anything but a line and a circle. It is solved rather than approximated: the length from the start is strictly increasing wherever the parameterization is regular, so a bracketed root find always converges, and there is no risk of the multiple-root trouble a general solve would have.
§This is not tessellation
ogeom_mesh::discretize() places points where the curve bends,
which is what a mesh wants and what a drawing wants. These place points
where the caller asked, evenly along the curve, which is what a toolpath, a
dimension chain or a sampling pattern wants. Neither substitutes for the
other: an evenly spaced polyline through a tight corner misses it, and a
deflection-driven one has no even spacing to speak of.
Functions§
- curve_
length - The arc length of a curve over
range. - parameter_
at_ length - The parameter at which a given arc length from the start of
rangeis reached. - points_
by_ count countpoints evenly spaced by arc length along a curve, ends included.- points_
by_ spacing - Points along a curve at a fixed arc-length
spacing.