Beispiel #1
0
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;
}
Beispiel #2
0
 bool Intersects(const Convex& other) const override
 {
     return other.Intersects(*this);
 }
Beispiel #3
0
 bool Intersects(const Convex& other, Point& intersection) const override
 {
     return other.Intersects(*this, intersection);
 }
Beispiel #4
0
 bool Intersects(const Convex& other, Point& overlap) const override
 {
     return other.Intersects(*this, overlap);
 }