Skip to content

Bezier Surface

The BezierSurface is tessellated from one or more bicubic Bézier patches. Each patch is sixteen control points: the surface passes through the four corners and is pulled towards the twelve interior points, so a shape is edited by moving points rather than by writing a formula.

NOTE

For the full API, see the 3D API Reference.

Demo

Properties

  • patches: the patches to tessellate, held by reference and never copied
  • segments: subdivisions along each parameter of every patch (default 8)
  • revision: a counter bumped whenever the patch list is replaced

A patch is a flat array of sixteen Vector3 control points in row-major order.

Evaluating a patch directly

ts
import {
    bernstein3,
    evaluateBezierPatch,
} from '@ripl/3d';

const point = evaluateBezierPatch(patch, 0.5, 0.5);
const weights = bernstein3(0.25);

Type Guard

ts
import {
    elementIsBezierSurface,
} from '@ripl/3d';

if (elementIsBezierSurface(element)) {
    console.log(element.patches.length);
}