Skip to main content
Each node has a position and optional curve handles.

Import

Example

Notes

  • Nodes use [x, z] profile coordinates.
  • toRing() changes curved edges into points.
  • A closed profile needs three nodes or more.
  • A network is one path. It has no branches, and it does not split where it crosses itself.

Constructor

Properties

VNNode[]
boolean
number
Read-only. Number of edges: a closed loop has one per node; an open path has one fewer.

Methods

segmentEndpoints

Endpoints of edge i as profile points.

segmentMidpoint

Midpoint of edge i (on the curve if curved), in profile coords.

moveNode

endIndex

The index of the node the edge leaving i ends at.

bendSegmentTo

Bend edge i so its curve passes through (px, pz) at the midpoint.

insertNode

Insert a vertex on edge i.

deleteNode

Delete node i and heal the gap: the previous node’s outgoing edge now spans to the next node.

toRing

Compile to a tessellated outer ring of [x, z] points for the kernel.

Types

VNNode

number
required
number
required
boolean
required
Whether the edge leaving this node (to the next node) is a cubic Bézier.
Point
required
Control point near this node (absolute profile coords). Valid when curved.
Point
required
Control point near the next node (absolute profile coords). Valid when curved.

Point

Least-squares cubic Bézier fitting — the “delete and heal” half of the profile editor (Schneider, An Algorithm for Automatically Fitting Digitized Curves, Graphics Gems, 1990). The package does not export this type by name.
Last modified on October 6, 2026