Skip to content

Instantly share code, notes, and snippets.

@NickDiMucci
Created May 1, 2015 23:42
Show Gist options
  • Save NickDiMucci/7e24eb175245d418c975 to your computer and use it in GitHub Desktop.
Save NickDiMucci/7e24eb175245d418c975 to your computer and use it in GitHub Desktop.
Pseudo-code for obtaining the minimum and maximum positions of objects in a 2D space.
List xPositions;
List yPositions;
foreach target {
xPositions.Add(target.x);
yPositions.Add(target.y);
}
maxX = Max(xPositions);
maxY = Max(yPositions);
minX = Min(xPositions);
minY = Min(yPositions);
minPosition = Vector2(minX, minY)
maxPosition = Vector2(minX, minY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment