Esempio n. 1
0
        public static HashSet <Vec2i> GeometricNeighbors_WithinRect(
            Rect2i rect,
            Vec2i point,
            Directions_Ortho_2D directions
            )
        {
            var neighbors = point.Geometric_Neighbors(directions);

            neighbors.RemoveWhere(
                x =>
                rect.Contains(x) == false
                );

            return(neighbors);
        }
Esempio n. 2
0
        public static HashSet <Vec2i> GeometricNeighbors_WithinRect(
            Rect2i rect,
            HashSet <Vec2i> points,
            Directions_Ortho_2D directions
            )
        {
            var neighbors = new HashSet <Vec2i>();

            foreach (var point in points)
            {
                neighbors.UnionWith(GeometricNeighbors_WithinRect(rect, point, directions));
            }

            neighbors.ExceptWith(points);

            return(neighbors);
        }
Esempio n. 3
0
        public override bool Equals(object otherObject)
        {
            if (otherObject.GetType() != this.GetType())
            {
                return(false);
            }
            Rect2i other = (Rect2i)otherObject;

            if (
                this.min_coords == other.min_coords
                &&
                this.max_coords == other.max_coords
                )
            {
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
 public bool Intersects(Rect2i otherRect)
 {
     return(ContainsAny(otherRect.Corners()));
 }