mirror of https://github.com/CGAL/cgal
Orientation requirements always on, as it won't work without it on non triangle meshes
This commit is contained in:
parent
5f4437bef1
commit
9e6eaa504a
|
|
@ -36,7 +36,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
std::vector<std::pair<face_descriptor, face_descriptor> > common;
|
||||
std::vector<face_descriptor> m1_only, m2_only;
|
||||
PMP::compare_meshes(mesh1, mesh2, std::back_inserter(common), std::back_inserter(m1_only), std::back_inserter(m2_only), CGAL::parameters::all_default(), CGAL::parameters::all_default());
|
||||
PMP::compare_meshes(mesh1, mesh2, std::back_inserter(common), std::back_inserter(m1_only), std::back_inserter(m2_only));
|
||||
std::cout<<"Faces only in m1 : "<<std::endl;
|
||||
for(const auto& f : m1_only)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,17 +55,10 @@ namespace Polygon_mesh_processing {
|
|||
|
||||
namespace pmp_internal {
|
||||
|
||||
inline void rearrange_face_ids(boost::container::small_vector<std::size_t, 4>& ids, bool orientation_counts)
|
||||
inline void rearrange_face_ids(boost::container::small_vector<std::size_t, 4>& ids)
|
||||
{
|
||||
if(!orientation_counts)
|
||||
{
|
||||
std::sort(ids.begin(), ids.end());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto min_elem = std::min_element(ids.begin(), ids.end());
|
||||
std::rotate(ids.begin(), min_elem, ids.end());
|
||||
}
|
||||
}
|
||||
}//end pmp_internal
|
||||
/**
|
||||
|
|
@ -843,6 +836,7 @@ centroid(const TriangleMesh& tmesh)
|
|||
* \ingroup measure_grp
|
||||
* given two meshes, separates the faces that are only in one, the faces
|
||||
* that are only in the other one, and the faces that are common to both.
|
||||
* Faces with different orientations will be considered as not shared.
|
||||
*
|
||||
* @tparam PolygonMesh a model of `HalfedgeListGraph` and `FaceListGraph`
|
||||
* @tparam OutputFaceIterator model of `OutputIterator`
|
||||
|
|
@ -882,15 +876,6 @@ centroid(const TriangleMesh& tmesh)
|
|||
* or using an external map. The latter might result in - slightly - worsened performance
|
||||
* in case of non-constant complexity for index access.}
|
||||
* \cgalParamNEnd
|
||||
* \cgalParamNBegin{require_same_orientation}
|
||||
* \cgalParamDescription{Parameter (np1 only) to indicate if face orientation should be taken
|
||||
* into account when determining whether two faces are duplicates.
|
||||
* If `true`, then the triangles `0,1,2` and `0,2,1` will not be considered
|
||||
* as "shared" between the two meshes.}
|
||||
* \cgalParamType{Boolean}
|
||||
* \cgalParamDefault{`false`}
|
||||
*\cgalParamNEnd
|
||||
|
||||
* \cgalNamedParamsEnd
|
||||
*
|
||||
*/
|
||||
|
|
@ -911,7 +896,6 @@ void compare_meshes(const PolygonMesh& m1, const PolygonMesh& m2,
|
|||
get_const_property_map(vertex_point, m2));
|
||||
VIMap1 vim1 = get_initialized_vertex_index_map(m1, np1);
|
||||
VIMap1 vim2 = get_initialized_vertex_index_map(m2, np2);
|
||||
const bool same_orientation = choose_parameter(get_parameter(np1, internal_np::require_same_orientation), false);
|
||||
typedef typename boost::property_traits<VPMap2>::value_type Point_3;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor;
|
||||
|
||||
|
|
@ -960,7 +944,7 @@ void compare_meshes(const PolygonMesh& m1, const PolygonMesh& m2,
|
|||
}
|
||||
if(all_shared)
|
||||
{
|
||||
pmp_internal::rearrange_face_ids(ids, same_orientation);
|
||||
pmp_internal::rearrange_face_ids(ids);
|
||||
m1_faces_map.insert({ids, f});
|
||||
}
|
||||
else
|
||||
|
|
@ -982,7 +966,7 @@ void compare_meshes(const PolygonMesh& m1, const PolygonMesh& m2,
|
|||
}
|
||||
if(all_shared)
|
||||
{
|
||||
pmp_internal::rearrange_face_ids(ids, same_orientation);
|
||||
pmp_internal::rearrange_face_ids(ids);
|
||||
auto it = m1_faces_map.find(ids);
|
||||
if(it != m1_faces_map.end())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -337,7 +337,8 @@ void test_compare()
|
|||
return;
|
||||
}
|
||||
input.close();
|
||||
PMP::compare_meshes(mesh1, mesh2, std::back_inserter(common), std::back_inserter(m1_only), std::back_inserter(m2_only), CGAL::parameters::require_same_orientation(true), CGAL::parameters::all_default());
|
||||
PMP::compare_meshes(mesh1, mesh2, std::back_inserter(common), std::back_inserter(m1_only),
|
||||
std::back_inserter(m2_only));
|
||||
assert(common.size() == 0);
|
||||
assert(m1_only.size() == 18);
|
||||
assert(m2_only.size() == 18);
|
||||
|
|
@ -346,7 +347,7 @@ void test_compare()
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
/* const char* filename_polyhedron =
|
||||
const char* filename_polyhedron =
|
||||
(argc > 1) ? argv[1] : "data/mech-holes-shark.off";
|
||||
test_polyhedron<CGAL::Polyhedron_3<Epic>,Epic>(filename_polyhedron);
|
||||
test_polyhedron<CGAL::Polyhedron_3<Epec>,Epec>(filename_polyhedron);
|
||||
|
|
@ -359,7 +360,6 @@ int main(int argc, char* argv[])
|
|||
// It won't work with Epec for large meshes as it builds up a deep DAG
|
||||
// leading to a stackoverflow when the destructor is called.
|
||||
test_centroid<CGAL::Surface_mesh<Epic::Point_3>,Epic>(filename_surface_mesh);
|
||||
*/
|
||||
test_compare<CGAL::Polyhedron_3<Epic> >();
|
||||
test_compare<CGAL::Polyhedron_3<Epec> >();
|
||||
test_compare<CGAL::Surface_mesh<Epic::Point_3> >();
|
||||
|
|
@ -367,3 +367,4 @@ int main(int argc, char* argv[])
|
|||
std::cerr << "All done." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,14 +75,6 @@ void Polyhedron_demo_diff_between_meshes_plugin::diff()
|
|||
typedef CGAL::Face_filtered_graph<SMesh> Filtered_graph;
|
||||
|
||||
QCursor c(Qt::WaitCursor);
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Require the Same Orientation ?");
|
||||
msgBox.setInformativeText("Should face orientation count for duplicate detection ?");
|
||||
msgBox.setStandardButtons(QMessageBox::Yes| QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::No);
|
||||
int ret = msgBox.exec();
|
||||
bool same_orientation = (ret == QMessageBox::Yes);
|
||||
CGAL::Three::Three::CursorScopeGuard guard(c);
|
||||
|
||||
//Get the two meshes. No need to check their existance, applicable()
|
||||
|
|
@ -101,8 +93,7 @@ void Polyhedron_demo_diff_between_meshes_plugin::diff()
|
|||
m2,
|
||||
std::back_inserter(common),
|
||||
std::back_inserter(m1_only),
|
||||
std::back_inserter(m2_only),
|
||||
CGAL::parameters::require_same_orientation(same_orientation));
|
||||
std::back_inserter(m2_only));
|
||||
|
||||
Filtered_graph filter1(m1, m1_only);
|
||||
SMesh mesh1_only, mesh2_only, common_mesh;
|
||||
|
|
|
|||
Loading…
Reference in New Issue