globalVertices method
gives back the shape vectors multiplied by the size and scale
Implementation
List<Vector2> globalVertices() {
final scale = absoluteScale;
final shouldReverse = scale.y.isNegative ^ scale.x.isNegative;
final angle = absoluteAngle;
final position = absoluteTopLeftPosition;
if (!_cachedGlobalVertices.isCacheValid<dynamic>(<dynamic>[
position,
size,
scale,
angle,
])) {
for (var i = 0; i < _vertices.length; i++) {
_globalVertices[i].setFrom(absolutePositionOf(_vertices[i]));
}
if (shouldReverse) {
// Since the list will be clockwise we have to reverse it for it to
// become counterclockwise.
_reverseList(_globalVertices);
}
_cachedGlobalVertices.updateCache<dynamic>(
_globalVertices,
<dynamic>[position.clone(), size.clone(), scale.clone(), angle],
);
}
return _cachedGlobalVertices.value!;
}