diff --git a/Quadtree/Rectangle.cs b/Quadtree/Rectangle.cs index 4fd92a9..416c06f 100644 --- a/Quadtree/Rectangle.cs +++ b/Quadtree/Rectangle.cs @@ -4,28 +4,22 @@ namespace SpatialCollections { public enum IntersectionType { Contains, Intersects, Disjoint } - public class Rectangle + public class Rectangle(Vector2 min, Vector2 max) { /// /// Vector containing the lowest X and Y coordinates contained in the rectangle. /// - public Vector2 Min; + public Vector2 Min = min; /// /// Vector containing the highest X and Y coordinates contained in the rectangle. /// - public Vector2 Max; + public Vector2 Max = max; public Vector2 Center => (Max + Min) * 0.5f; public Vector2 Size => Max - Min; - public Rectangle(Vector2 min, Vector2 max) - { - Min = min; - Max = max; - } - public bool Contains(Vector2 position) { return Min.X <= position.X && position.X <= Max.X && Min.Y <= position.Y && position.Y <= Max.Y;