コード例 #1
0
ファイル: Plane.cpp プロジェクト: ggf31416/CompGraf1
bool Plane::Intersects(const Polyhedron &polyhedron) const
{
	if (polyhedron.NumVertices() == 0)
		return false;
	bool sign = IsOnPositiveSide(polyhedron.Vertex(0));
	for(int i = 1; i < polyhedron.NumVertices(); ++i)
		if (sign != IsOnPositiveSide(polyhedron.Vertex(i)))
			return true;
	return false;
}
コード例 #2
0
ファイル: Sphere.cpp プロジェクト: juj/MathGeoLib
bool Sphere::Contains(const Polyhedron &polyhedron) const
{
	assume(polyhedron.IsClosed());
	for(int i = 0; i < polyhedron.NumVertices(); ++i)
		if (!Contains(polyhedron.Vertex(i)))
			return false;

	return true;
}
コード例 #3
0
ファイル: AABB.cpp プロジェクト: katik/naali
void AABB::Enclose(const Polyhedron &polyhedron)
{
	for(int i = 0; i < polyhedron.NumVertices(); ++i)
		Enclose(polyhedron.Vertex(i));
}