nurbsCurve.transformed

The curve with an affine transform applied to its control points, weights and knots kept.

GeometricSince 0.4.0

Usage

TypeScript
curve.transformed(xf: Transform): Result<NurbsCurve>

Parameters

  • xfTransform

    An affine transform (last row 0 0 0 1), column-major.

    Required

Returns

Ok with the transformed curve, same degree, weights and knots.

Errors

Guarantees

  • pointAt(t) of the result = Transform.applyToPoint(xf, pointAt(t)) for every t (affine invariance)
  • The same result on every machine.

Example

TypeScript
const q = NurbsCurve.create([Point3.of(1, 0, 0), Point3.of(1, 1, 0), Point3.of(0, 1, 0)], 2, { weights: [1, Math.SQRT1_2, 1], knots: [0, 0, 0, 1, 1, 1] }).value
q.transformed(Transform.translation(Vector3.of(0, 0, 5))).value.pointAt(0) // → { x: 1, y: 0, z: 5 }

See also