Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

core.resample.curve (procNode)

Redistribute the points of every curve evenly by arc length: a fixed number per curve, or as many as fit a spacing.

Built from core.arclength, core.points (one row per new point, from the expand kernel over the per-curve counts), core.sample_curve, core.interpolate, and an exclusive scan for the new curves' starts. The result is curves again: vertex.pt runs through the new points in order and primitive.vstart, vcount and closed describe each curve; a curve's own attributes carry over.

Inputs

  • curve (Curves). The curves resampled.
  • count (Number). Default 16. At least 2. Points per curve when spacing is 0.
  • spacing (Number). Default 0.0. At least 0. The distance between points; each curve takes as many as fit. 0 uses count.

Outputs

  • curve: the resampled curves. Each new point also carries the sampling attributes core.sample_curve writes (prim, ia, ib, ic, bary, t, tangent) and the s and length of core.arclength.

Example

local line = g.curve.line({ start = vector.create(0, 0, 0), finish = vector.create(4, 0, 0), segments = 4 })
local even = g.core.resample.curve({ curve = line, count = 9 })

Nine points spread evenly along the line, 0.5 apart.