Curves.Polyline.Curve (curves v1.0.1)

Copy Markdown View Source

Struct representing a polyline: knots joined by straight lines, like SVG's <polyline>.

curve = Curves.define_polyline([{0, 0}, {2, 3}, {4, 1}, {6, 4}, {8, 2}])

# Find any point along it (u goes from 0.0 to Curves.max_u(curve))...
Curves.solve!(curve, 1.5)

# ...or draw it as an SVG image
Curves.Svg.save!(curve, "polyline.svg")

Polyline

Like a spline, it is solved with u: each straight line (segment) adds one to it, so u = 1.0 is the second knot and Curves.max_u/1 is the last one. Within a segment the speed is steady, so u = 1.5 is exactly halfway between the second and third knots.

Summary

Types

t()

A polyline. Its fields are internal and may change in any 1.x release, so use the functions in Curves (e.g. Curves.solve/3, Curves.max_u/1) instead of reading them.

Types

t()

@opaque t()

A polyline. Its fields are internal and may change in any 1.x release, so use the functions in Curves (e.g. Curves.solve/3, Curves.max_u/1) instead of reading them.