MCPcopy Create free account
hub / github.com/axmolengine/axmol / RectApplyAffineTransform

Function RectApplyAffineTransform

core/math/AffineTransform.cpp:80–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78const AffineTransform AffineTransform::IDENTITY = AffineTransformMakeIdentity();
79
80Rect RectApplyAffineTransform(const Rect& rect, const AffineTransform& anAffineTransform)
81{
82 float top = rect.getMinY();
83 float left = rect.getMinX();
84 float right = rect.getMaxX();
85 float bottom = rect.getMaxY();
86
87 Vec2 topLeft = PointApplyAffineTransform(Vec2(left, top), anAffineTransform);
88 Vec2 topRight = PointApplyAffineTransform(Vec2(right, top), anAffineTransform);
89 Vec2 bottomLeft = PointApplyAffineTransform(Vec2(left, bottom), anAffineTransform);
90 Vec2 bottomRight = PointApplyAffineTransform(Vec2(right, bottom), anAffineTransform);
91
92 float minX = min(min(topLeft.x, topRight.x), min(bottomLeft.x, bottomRight.x));
93 float maxX = max(max(topLeft.x, topRight.x), max(bottomLeft.x, bottomRight.x));
94 float minY = min(min(topLeft.y, topRight.y), min(bottomLeft.y, bottomRight.y));
95 float maxY = max(max(topLeft.y, topRight.y), max(bottomLeft.y, bottomRight.y));
96
97 return Rect(minX, minY, (maxX - minX), (maxY - minY));
98}
99
100Rect RectApplyTransform(const Rect& rect, const Mat4& transform)
101{

Callers 4

getBoundingBoxMethod · 0.85
getCascadeBoundingBoxFunction · 0.85
getBoundingBoxMethod · 0.85
getBoundingBoxMethod · 0.85

Calls 5

Vec2Function · 0.70
maxFunction · 0.70
RectFunction · 0.70
minFunction · 0.50

Tested by

no test coverage detected