Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

core.arclength (procNode)

The length along every curve: each point's distance from the start of its curve as s, and each curve's total as length.

Built from core.owner, attribute.promote (positions to vertices), gather of each vertex's next position, math.length, a segmented scan for the distance so far and a segmented reduce for the total. A closed curve counts its closing segment in length; an open curve has none. Written as s on the point class (and on the vertex class) and length on the primitive class.

Inputs

  • curve (Curves). The curves measured.

Outputs

  • curve: the curves with s (distance along the curve) on the point class and length (the curve total) on the primitive class.

Example

local line = g.curve.line({ start = vector.create(0, 0, 0), finish = vector.create(4, 0, 0), segments = 4 })
local measured = g.core.arclength({ curve = line })

s holds 0, 1, 2, 3, 4 on the points and length holds 4 on the curve.