project method
Returns the result of applying an affine transformation to the shape.
Certain shapes may be transformed into shapes of a different kind during
the projection. For example, a Circle may transform into an Ellipse,
and Rectangle into a Polygon.
If target is provided and it has a proper type, then this method should
modify the target in-place and return it. If target is null, or if its
type is not compatible with the requested transform, then the method
should create and return a new Shape.
Implementation
@override
Shape project(Transform2D transform, [Shape? target]) {
if (transform.isConformal) {
final newCenter = transform.localToGlobal(_center);
final newRadius = transform.scale.x.abs() * _radius;
if (target is Circle) {
target._center.setFrom(newCenter);
target._radius = newRadius;
_aabb = null;
return target;
} else {
return Circle(newCenter, newRadius);
}
}
throw UnimplementedError();
}