/// <summary> /// Returns true if this rectangle is wholely within the bounds of the other object /// </summary> public bool IsWithin(ISpatial2D spatial) { if (spatial is Rectangle) { var other = (Rectangle)spatial; return(TopLeft.X >= other.TopLeft.X && TopLeft.Y >= other.TopLeft.X && BottomRight.X <= other.BottomRight.X && BottomRight.Y <= other.BottomRight.Y); } return(!(Positions.Except(spatial.Positions).Any())); }
/// <summary> /// Returns true if this rectangle overlaps the other object /// </summary> public bool Overlaps(ISpatial2D spatial) { return(spatial.Positions.Any(p => Overlaps(p))); }
public ObjectOutOfBoundsException(ISpatial2D spacialObject) { Object = spacialObject; }
public RuleViolationEvent(ISpatialRule rule, ISpatial2D target) { Rule = rule; Target = target; }
/// <summary> /// Returns true if this object is wholely within the bounds of the other object /// </summary> public bool IsWithin(ISpatial2D spatial) { //TODO: Could be optimised for simple shapes? return(Positions.All(p => spatial.Overlaps(p))); }
public bool Overlaps(ISpatial2D spatial) { return(Overlaps(spatial.Positions)); }