bool Convex_Intersects_Polygon(const Convex &c, const Polygon &p) { LineSegment l; l.a = p.p.back(); for(size_t i = 0; i < p.p.size(); ++i) { l.b = p.p[i]; if (c.Intersects(l)) return true; l.a = l.b; } // Check all the edges of the convex shape against the polygon. for(int i = 0; i < c.NumEdges(); ++i) { l = c.Edge(i); if (p.Intersects(l)) return true; } return false; }
bool Intersects(const Convex& other) const override { return other.Intersects(*this); }
bool Intersects(const Convex& other, Point& intersection) const override { return other.Intersects(*this, intersection); }
bool Intersects(const Convex& other, Point& overlap) const override { return other.Intersects(*this, overlap); }