Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

curve.bezier (procNode)

A cubic Bezier curve from four control points: one open curve whose point i of segments + 1 is the Bernstein sum at t = i / segments. The steps are equal in the curve's parameter, so the points bunch where the curve bends; curve.resample spaces them evenly by length.

Built from: core.points, attribute.number, curve.from_points.

Inputs

  • p0 (Vec3). Default { x = 0, y = 0, z = 0 }. Where the curve starts; it passes through this point.
  • p1 (Vec3). Default { x = 0, y = 1, z = 0 }. The handle leaving p0.
  • p2 (Vec3). Default { x = 1, y = 1, z = 0 }. The handle arriving at p3.
  • p3 (Vec3). Default { x = 1, y = 0, z = 0 }. Where the curve ends; it passes through this point.
  • segments (Float). Default 16. At least 1. How many spans the cubic is sampled into, leaving segments + 1 points. The steps are equal in the curve's parameter rather than in distance.

Outputs

  • curve: one open curve of segments + 1 points, each carrying P and its number id.

Example

local arc = g.curve.bezier({ p0 = vector.create(0, 0, 0), p1 = vector.create(0, 2, 0), p2 = vector.create(3, 2, 0), p3 = vector.create(3, 0, 0), segments = 8 })

Nine points from (0, 0, 0) to (3, 0, 0), rising to (1.5, 1.5, 0) at the middle.