Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using RicoTanks_Common;
  2. using System;
  3.  
  4. namespace RicoTanks_Server
  5. {
  6. public class BoundingBox
  7. {
  8. public Vector2Net min { get; set; }
  9. public Vector2Net max { get; set; }
  10.  
  11. public BoundingBox Create(params Vector2Net[] points)
  12. {
  13. Vector2Net _min = points[0];
  14. Vector2Net _max = points[1];
  15. for (int i = 1; i < points.Length; i++)
  16. {
  17. _min = Vector2Net.Min(_min, points[i]);
  18. _max = Vector2Net.Max(_max, points[i]);
  19. }
  20. return new BoundingBox { min = _min, max = _max };
  21. }
  22. public bool IsContains(Vector2Net point)
  23. {
  24. return (point.x < min.x || point.x > max.x || point.y < min.y || point.y > max.y) == false;
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement