public List <Vector2d> FindIntersections(Polygon2d o) { List <Vector2d> v = new List <Vector2d>(); if (!this.GetBounds().Intersects(o.GetBounds())) { return(v); } foreach (Segment2d seg in SegmentItr()) { foreach (Segment2d oseg in o.SegmentItr()) { IntrSegment2Segment2 intr = new IntrSegment2Segment2(seg, oseg); if (intr.Find()) { v.Add(intr.Point0); if (intr.Quantity == 2) { v.Add(intr.Point1); } break; } } } return(v); }
public bool Intersects(Polygon2d o) { if (!this.GetBounds().Intersects(o.GetBounds())) { return(false); } foreach (Segment2d seg in SegmentItr()) { foreach (Segment2d oseg in o.SegmentItr()) { IntrSegment2Segment2 intr = new IntrSegment2Segment2(seg, oseg); if (intr.Find()) { return(true); } } } return(false); }
public override AxisAlignedBox2d Bounds() { return(polygon.GetBounds()); }