Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static Vector2, Vector2 CalculateSmallestAABB (Array<Vector2> points) {
- Vector2 origin = (int.Max, int.Max);
- Vector2 size = (int.Min, int.Min);
- for (int i = 0; i < points.Size (); i++) {
- Vector2 vertex = points [0];
- // Origin
- origin.X = min (origin.X, vertex.X);
- origin.Y = min (origin.Y, vertex.Y);
- // Size
- size.X = max (size.X, vertex.X);
- size.Y = max (size.Y, vertex.Y);
- }
- return origin, size;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement