Exemplo n.º 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;
}
Exemplo n.º 2
0
 bool Intersects(const Convex& other) const override
 {
     return other.Intersects(*this);
 }
Exemplo n.º 3
0
 bool Intersects(const Convex& other, Point& intersection) const override
 {
     return other.Intersects(*this, intersection);
 }
Exemplo n.º 4
0
Arquivo: Box.hpp Projeto: mraggi/Graph
 bool Intersects(const Convex& other, Point& overlap) const override
 {
     return other.Intersects(*this, overlap);
 }