mirror of https://github.com/CGAL/cgal
Add a bitset to foes_bound_a_volume and add a hidden test for all possible orientations of nested_cubes.
This commit is contained in:
parent
44efc0730b
commit
0b71f00eb5
|
|
@ -1086,7 +1086,11 @@ volume_connected_components(const TriangleMesh& tm,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (used_as_a_predicate) return 1;
|
||||
if (used_as_a_predicate)
|
||||
{
|
||||
internal::copy_orientation_bitset(is_cc_outward_oriented, parameters::get_parameter(np, internal_np::is_cc_outward_oriented));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// merge nested_cc_per_cc and nested_cc_per_cc_shared
|
||||
// (done after the volume creation to assign a CC to a unique volume)
|
||||
|
|
@ -1158,6 +1162,14 @@ volume_connected_components(const TriangleMesh& tm,
|
|||
* \cgalParamBegin{face_index_map}
|
||||
* a property map containing the index of each face of `tm`.
|
||||
* \cgalParamEnd
|
||||
* \cgalParamBegin{is_cc_outward_oriented}
|
||||
* a `reference_wrapper` (either from `boost` or the standard library) containing
|
||||
* a reference to an object of type `std::vector<bool>`.
|
||||
* The size of the vector is exactly the number of connected components.
|
||||
* For each connected component identified using its id `ccid`, the output of `is_outward_oriented`
|
||||
* called on the submesh corresponding to this connected component
|
||||
* is the value at the position `ccid` in the parameter vector.
|
||||
* \cgalParamEnd
|
||||
* \cgalNamedParamsEnd
|
||||
*
|
||||
* \see `CGAL::Polygon_mesh_processing::orient_to_bound_a_volume()`
|
||||
|
|
|
|||
|
|
@ -2,15 +2,17 @@
|
|||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Polygon_mesh_processing/orientation.h>
|
||||
#include <CGAL/Polygon_mesh_processing/corefinement.h>
|
||||
|
||||
#include <CGAL/Timer.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
//#define TEST_ALL_ORIENTATIONS 1
|
||||
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Surface_mesh<Kernel::Point_3> SMesh;
|
||||
|
||||
|
||||
template<class TriangleMesh, class NamedParameters>
|
||||
bool test_orientation(TriangleMesh& tm, bool is_positive, const NamedParameters& np)
|
||||
{
|
||||
|
|
@ -24,7 +26,7 @@ bool test_orientation(TriangleMesh& tm, bool is_positive, const NamedParameters&
|
|||
|
||||
using CGAL::parameters::choose_parameter;
|
||||
using CGAL::parameters::get_parameter;
|
||||
|
||||
|
||||
Vpm vpm = choose_parameter(get_parameter(np, CGAL::internal_np::vertex_point),
|
||||
CGAL::get_const_property_map(boost::vertex_point, tm));
|
||||
|
||||
|
|
@ -145,5 +147,67 @@ int main()
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef TEST_ALL_ORIENTATIONS //takes around 2 hours
|
||||
std::cout<<"testing ALL orientations..."<<std::endl;
|
||||
SMesh::Property_map<SMesh::Face_index, std::size_t> fccmap =
|
||||
sm1.add_property_map<SMesh::Face_index, std::size_t>("f:CC").first;
|
||||
std::vector<bool> is_cc_o_or;
|
||||
PMP::orient_to_bound_a_volume(sm1);
|
||||
PMP::does_bound_a_volume(sm1,
|
||||
CGAL::parameters::is_cc_outward_oriented(std::ref(is_cc_o_or)));
|
||||
|
||||
std::size_t nb_ccs = PMP::connected_components(sm1, fccmap);
|
||||
|
||||
std::vector< std::vector<SMesh::Face_index> > faces_per_cc(nb_ccs);
|
||||
for(SMesh::Face_index fd : faces(sm1))
|
||||
{
|
||||
std::size_t cc_id = get(fccmap, fd);
|
||||
faces_per_cc[cc_id].push_back(fd);
|
||||
}
|
||||
double total_length = 1<<20;
|
||||
CGAL::Timer timer;
|
||||
timer.start();
|
||||
for(std::size_t i=1; i<total_length; ++i)//0 is initial state, already tested
|
||||
{
|
||||
SMesh loop_m = sm1;
|
||||
int i_bis = i;
|
||||
int cc = 0;
|
||||
while(i_bis)
|
||||
{
|
||||
if(i_bis&1)
|
||||
{
|
||||
//reverse_orientation(cc)
|
||||
PMP::reverse_face_orientations(faces_per_cc[cc], loop_m);
|
||||
}
|
||||
//test volume
|
||||
i_bis>>=1;
|
||||
++cc;
|
||||
}
|
||||
std::vector<bool> is_loop_o_o;
|
||||
PMP::orient_to_bound_a_volume(loop_m);
|
||||
|
||||
if( !PMP::does_bound_a_volume(loop_m,
|
||||
CGAL::parameters::is_cc_outward_oriented(std::ref(is_loop_o_o))) )
|
||||
{
|
||||
std::cerr << "ERROR for test7\n";
|
||||
return 1;
|
||||
}
|
||||
if(is_loop_o_o.empty())
|
||||
return 1;
|
||||
if(is_loop_o_o!= is_cc_o_or)
|
||||
{
|
||||
std::cerr << "ERROR for test7\n";
|
||||
return 1;
|
||||
}
|
||||
if(i%1000 == 0){
|
||||
timer.stop();
|
||||
double remaining = ((1<<20) -i)* timer.time()/1000.0 ;
|
||||
std::cout<<remaining/60.0<<"min remaining."<<std::endl;
|
||||
timer.reset();
|
||||
timer.start();
|
||||
}
|
||||
}
|
||||
std::cout<<"finished ! "<<std::endl;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue