getPoint method

  1. @override
Vector? getPoint(
  1. double t, [
  2. Vector? optionalTarget
])
override

Implementation

@override
Vector? getPoint(double t, [Vector? optionalTarget]) {
    optionalTarget ??= Vector3();
    late Vector3 optTarget;

    if(optionalTarget is Vector2){
      optTarget = Vector3(optionalTarget.x,optionalTarget.y,0);
    }
    else if(optionalTarget is Vector4){
      optTarget = Vector3(optionalTarget.x,optionalTarget.y,optionalTarget.z);
    }
    else{
      optTarget = optionalTarget as Vector3;
    }

	final point = optTarget;

	t = t * 4 - 2;

	final x = math.pow( t, 3 ) - 3 * t;
	final y = math.pow( t, 4 ) - 4 * t * t;
	final z = 1 / 5 * math.pow( t, 5 ) - 2 * t;

	return point.setValues( x, y, z ).scale( scale );
}