本文整理汇总了C++中Polyhedron::location方法的典型用法代码示例。如果您正苦于以下问题:C++ Polyhedron::location方法的具体用法?C++ Polyhedron::location怎么用?C++ Polyhedron::location使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyhedron
的用法示例。
在下文中一共展示了Polyhedron::location方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove_inside
/// Removes triangles from mesh that are inside p (helper function for Boolean operations on polyhedra)
void Polyhedron::remove_inside(IndexedTriArray& mesh, Polyhedron& p, bool remove_shared)
{
// get the vertices and facets
const vector<Vector3>& verts = mesh.get_vertices();
vector<IndexedTri> facets = mesh.get_facets();
// check whether each vertex is inside or outside the polyhedron
vector<LocationType> loc(verts.size());
for (unsigned i=0; i< loc.size(); i++)
loc[i] = p.location(verts[i]);
// now determine the facets that are inside the mesh (and shared)
for (unsigned i=0; i< facets.size(); i++)
{
// if we are removing shared, see whether all points are on the polyhedron
if (remove_shared)
{
if (loc[facets[i].a] == eOnVertex && loc[facets[i].b] == eOnVertex &&
loc[facets[i].c] == eOnVertex)
{
facets[i] = facets.back();
facets.pop_back();
i--;
continue;
}
}
// see whether a single point is inside
if (loc[facets[i].a] == eInside || loc[facets[i].b] == eInside ||
loc[facets[i].c] == eInside)
{
facets[i] = facets.back();
facets.pop_back();
i--;
continue;
}
}
// now reinstantiate the mesh
mesh = IndexedTriArray(verts.begin(), verts.end(), facets.begin(), facets.end());
}