getPoint method
Vector?
getPoint(
- double t, [
- Vector? optionalTarget
])
override
Implementation
@override
Vector? getPoint(double t, [Vector? optionalTarget]) {
final point = optionalTarget ?? Vector2();
final points = this.points;
double p = (points.length - 1) * t;
final intPoint = p.floor();
final weight = p - intPoint;
final p0 = points[intPoint == 0 ? intPoint : intPoint - 1];
final p1 = points[intPoint];
final p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1];
final p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2];
point.setValues(PathInterpolations.catmullRom(weight, p0.x, p1.x, p2.x, p3.x),PathInterpolations.catmullRom(weight, p0.y, p1.y, p2.y, p3.y));
return point;
}