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;

	final fi = t * math.pi * 2;

	final x = math.cos( 3 * fi ) * ( 1 + 0.3 * math.cos( 5 * fi ) + 0.5 * math.cos( 10 * fi ) );
	final y = math.sin( 3 * fi ) * ( 1 + 0.3 * math.cos( 5 * fi ) + 0.5 * math.cos( 10 * fi ) );
	final z = 0.2 * math.sin( 20 * fi );

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