Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

core.sample_curve (procNode)

Find the places along curves that arc-length positions name: for each row, the segment of its curve and the weights of the segment's two ends.

Built from core.arclength, core.owner, an exclusive scan of the curves' lengths (each curve's start in one ascending run of distances), the search kernel over that run, gather and math operators. The result is the rows with prim (the curve), ia, ib, ic (the segment's start vertex, its end vertex, the end again), bary (weights 1 - w, w, 0), P (the position there), tangent and t. core.interpolate carries the curve's attributes to them.

Inputs

  • curve (Curves). The curves sampled.
  • owner (Value). Default 0. For each row, the curve it samples: a primitive number.
  • t (Value). Default 0.0. For each row, how far along its curve: 0 at the start, 1 at the end.
  • rows (Points). The points that become the samples: one per row.

Outputs

  • samples: the rows standing on the curves, with P, tangent, t, prim, ia, ib, ic, bary.

Example

local line = g.curve.line({ start = vector.create(0, 0, 0), finish = vector.create(4, 0, 0), segments = 4 })
local rows = g.core.points({ count = 3 })
local samples = g.core.sample_curve({ curve = line, owner = 0, t = g.element.id * 0.5, rows = rows })

The three rows stand at 0, 2 and 4 along the line, with t 0, 0.5 and 1.