getPoint method

  1. @override
dynamic getPoint(
  1. num t,
  2. dynamic optionalTarget
)
override

Implementation

@override
getPoint(t, optionalTarget) {
  var point = optionalTarget ?? Vector3();

  var u = knots[startKnot] + t * (knots[endKnot] - knots[startKnot]); // linear mapping t->u

  // following results in (wx, wy, wz, w) homogeneous point
  var hpoint = calcBSplinePoint(degree, knots, controlPoints, u);

  if (hpoint.w != 1.0) {
    // project to 3D space: (wx, wy, wz, w) -> (x, y, z, 1)
    hpoint.divideScalar(hpoint.w);
  }

  return point.set(hpoint.x, hpoint.y, hpoint.z);
}