Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

points.on_curve (procNode)

Points evenly spaced along every curve of a geometry by arc length. Each carries tangent (the curve's direction there), u (how far along its curve, 0 at the start to 1 at the end) and the attributes of the curve's points it lies between, blended. Use it for fence posts, lamps along a road and beads on a path.

Per curve the count is count, or at a spacing floor(length / spacing + 0.5) plus one for an open curve, at least 1, held to maxPoints in all. curve.lay_points gives each laid point its curve and its index along it; the arc-length fraction is index / count around a closed curve (wrapping with offset) and index / (count - 1) along an open one (clamped). core.sample_curve finds the position and tangent there and core.interpolate carries the curve's attributes. A geometry holding no curves is an error naming the nodes that make them.

A point that falls exactly on a vertex takes the direction of either segment that meets there. The point number id is an Int.

Built from: core.arclength, curve.lay_points, field.gather, core.sample_curve, core.interpolate, core.points, math.*.

Inputs

  • curve (Curves). The curves to lay points along. Sampling is by arc length, so the points come out evenly spaced in distance however unevenly the curve's own points are spread.
  • count (Float, default 16, at least 1). How many points per curve when spacing is 0. On an open curve the first sits at the start and the last at the end; on a closed one the points divide the loop into equal parts.
  • spacing (Float, default 0, at least 0). The distance between neighbouring points. Each curve takes as many as fit its own length. 0 uses count instead.
  • maxPoints (Float, default 4096, at least 1). The most points spacing lays across all the curves together. Curves are filled in order; the points past it are left off.
  • offset (Float, default 0). Slides every point along its curve by this share of the curve's length, and u with it. Around a closed curve the points wrap; along an open one they stop at its end.

Outputs

  • points (Points). P, tangent, u, the curve's blended point attributes and id.
local posts = g.points.on_curve({ curve = g.curve.circle({ radius = 2 }), count = 12 })
local beads = g.points.on_curve({ curve = g.curve.line({ finish = vector.create(4, 0, 0) }), spacing = 1 })