mirror of https://github.com/CGAL/cgal
add an option to not refine one of the two meshes
This commit is contained in:
parent
6747341f66
commit
e43221ae8b
|
|
@ -101,6 +101,7 @@ CGAL_add_named_parameter(area_threshold_t, area_threshold, area_threshold)
|
|||
CGAL_add_named_parameter(halfedges_keeper_t, halfedges_keeper, halfedges_keeper)
|
||||
CGAL_add_named_parameter(volume_threshold_t, volume_threshold, volume_threshold)
|
||||
CGAL_add_named_parameter(dry_run_t, dry_run, dry_run)
|
||||
CGAL_add_named_parameter(do_not_modify_t, do_not_modify, do_not_modify)
|
||||
|
||||
// List of named parameters that we use in the package 'Surface Mesh Simplification'
|
||||
CGAL_add_named_parameter(get_cost_policy_t, get_cost_policy, get_cost)
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ void test(const NamedParameters& np)
|
|||
assert(get_parameter(np, CGAL::internal_np::do_lock_mesh).v == 61);
|
||||
assert(get_parameter(np, CGAL::internal_np::halfedges_keeper).v == 62);
|
||||
assert(get_parameter(np, CGAL::internal_np::do_simplify_border).v == 64);
|
||||
assert(get_parameter(np, CGAL::internal_np::do_not_modify).v == 65);
|
||||
assert(get_parameter(np, CGAL::internal_np::maximum_number_of_faces).v == 78910);
|
||||
|
||||
// Named parameters that we use in the package 'Surface Mesh Simplification'
|
||||
|
|
@ -184,6 +185,7 @@ void test(const NamedParameters& np)
|
|||
check_same_type<54>(get_parameter(np, CGAL::internal_np::use_area_smoothing));
|
||||
check_same_type<55>(get_parameter(np, CGAL::internal_np::use_Delaunay_flips));
|
||||
check_same_type<56>(get_parameter(np, CGAL::internal_np::use_safety_constraints));
|
||||
check_same_type<65>(get_parameter(np, CGAL::internal_np::do_not_modify));
|
||||
|
||||
check_same_type<12340>(get_parameter(np, CGAL::internal_np::do_self_intersection_tests));
|
||||
check_same_type<12341>(get_parameter(np, CGAL::internal_np::do_orientation_tests));
|
||||
|
|
@ -353,6 +355,7 @@ int main()
|
|||
.halfedges_keeper(A<62>(62))
|
||||
.use_convex_hull(A<63>(63))
|
||||
.do_simplify_border(A<64>(64))
|
||||
.do_not_modify(A<65>(65))
|
||||
.point_map(A<9000>(9000))
|
||||
.query_point_map(A<9001>(9001))
|
||||
.normal_map(A<9002>(9002))
|
||||
|
|
|
|||
|
|
@ -626,6 +626,9 @@ corefine_and_compute_difference( TriangleMesh& tm1,
|
|||
* checked for self-intersection and `CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception`
|
||||
* will be thrown if at least one is found (`np1` only).
|
||||
* \cgalParamEnd
|
||||
* \cgalParamBegin{do_not_modify} if `true`, the corresponding mesh will not be updated. The default value is `false`.
|
||||
* Obviously if this parameter is set to `true` for both meshes nothing will be done.
|
||||
* \cgalParamEnd
|
||||
* \cgalNamedParamsEnd
|
||||
*
|
||||
*/
|
||||
|
|
@ -641,9 +644,19 @@ corefine( TriangleMesh& tm1,
|
|||
using parameters::choose_parameter;
|
||||
using parameters::get_parameter;
|
||||
|
||||
if (choose_parameter(get_parameter(np1, internal_np::do_not_modify), false))
|
||||
{
|
||||
if (choose_parameter(get_parameter(np2, internal_np::do_not_modify), false))
|
||||
return;
|
||||
return corefine(tm2,tm1, np2, np1);
|
||||
}
|
||||
|
||||
const bool throw_on_self_intersection =
|
||||
choose_parameter(get_parameter(np1, internal_np::throw_on_self_intersection), false);
|
||||
|
||||
const bool modify_tm2 =
|
||||
!choose_parameter(get_parameter(np2, internal_np::do_not_modify), false);
|
||||
|
||||
// Vertex point maps
|
||||
typedef typename GetVertexPointMap<TriangleMesh,
|
||||
NamedParameters1>::type Vpm;
|
||||
|
|
@ -700,7 +713,7 @@ corefine( TriangleMesh& tm1,
|
|||
Ob ob;
|
||||
Ecm ecm(tm1,tm2,ecm1,ecm2);
|
||||
Corefinement::Intersection_of_triangle_meshes<TriangleMesh, Vpm, Algo_visitor>
|
||||
functor(tm1, tm2, vpm1, vpm2, Algo_visitor(uv,ob,ecm));
|
||||
functor(tm1, tm2, vpm1, vpm2, Algo_visitor(uv,ob,ecm,modify_tm2));
|
||||
functor(CGAL::Emptyset_iterator(), throw_on_self_intersection, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ private:
|
|||
OutputBuilder& output_builder;
|
||||
EdgeMarkMapBind marks_on_edges;
|
||||
bool input_with_coplanar_faces;
|
||||
bool refine_tm2;
|
||||
|
||||
template <class Ecm1, class Ecm2>
|
||||
void call_put(Ecm_bind<TriangleMesh, Ecm1, Ecm2>& ecm,
|
||||
|
|
@ -200,12 +201,13 @@ private:
|
|||
// visitor public functions
|
||||
public:
|
||||
Surface_intersection_visitor_for_corefinement(
|
||||
UserVisitor& uv, OutputBuilder& o, const EdgeMarkMapBind& emm)
|
||||
UserVisitor& uv, OutputBuilder& o, const EdgeMarkMapBind& emm, bool refine_tm2=true)
|
||||
: number_coplanar_vertices(0)
|
||||
, user_visitor(uv)
|
||||
, output_builder(o)
|
||||
, marks_on_edges(emm)
|
||||
, input_with_coplanar_faces(false)
|
||||
, refine_tm2(refine_tm2)
|
||||
{}
|
||||
|
||||
template<class Graph_node>
|
||||
|
|
@ -624,6 +626,7 @@ public:
|
|||
++it)
|
||||
{
|
||||
TriangleMesh& tm=*it->first;
|
||||
if (!refine_tm2 && tm2_ptr==&tm) continue;
|
||||
// Face_boundaries& face_boundaries=mesh_to_face_boundaries[&tm];
|
||||
|
||||
Node_to_target_of_hedge_map& nodes_to_hedge=it->second;
|
||||
|
|
@ -693,6 +696,7 @@ public:
|
|||
it=on_edge.begin(); it!=on_edge.end(); ++it)
|
||||
{
|
||||
TriangleMesh& tm=*it->first;
|
||||
if (!refine_tm2 && tm2_ptr==&tm) continue;
|
||||
const VertexPointMap& vpm=vpms[&tm];
|
||||
On_edge_map& on_edge_map=it->second;
|
||||
On_face_map& on_face_map=on_face[&tm];
|
||||
|
|
@ -788,6 +792,7 @@ public:
|
|||
it=on_face.begin(); it!=on_face.end(); ++it)
|
||||
{
|
||||
TriangleMesh& tm=*it->first;
|
||||
if (!refine_tm2 && tm2_ptr==&tm) continue;
|
||||
const VertexPointMap& vpm=vpms[&tm];
|
||||
On_face_map& on_face_map=it->second;
|
||||
Face_boundaries& face_boundaries=mesh_to_face_boundaries[&tm];
|
||||
|
|
|
|||
Loading…
Reference in New Issue