Bezier.fromPoints constructor
Bezier.fromPoints(
- List<
Vector2> curvePoints
Returns a new instance of the proper subclass of Bezier based on
the number of entries in curvePoints
. If curvePoints
contains three points,
returns a QuadraticBezier. If curvePoints
contains four points, returns a
CubicBezier.
Implementation
factory Bezier.fromPoints(List<Vector2> curvePoints) {
if (curvePoints.length == 3) {
return QuadraticBezier(curvePoints);
} else if (curvePoints.length == 4) {
return CubicBezier(curvePoints);
} else {
throw UnsupportedError('Unsupported number of curve points');
}
}