示例#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;
}
示例#2
0
文件: Line.hpp 项目: mraggi/Graph
 bool Intersects(const Convex& other) const override
 {
     return other.Intersects(*this);
 }
示例#3
0
文件: Line.hpp 项目: mraggi/Graph
 bool Intersects(const Convex& other, Point& intersection) const override
 {
     return other.Intersects(*this, intersection);
 }
示例#4
0
文件: Box.hpp 项目: mraggi/Graph
 bool Intersects(const Convex& other, Point& overlap) const override
 {
     return other.Intersects(*this, overlap);
 }