mirror of https://github.com/CGAL/cgal
fix pmap for curvature based version
This commit is contained in:
parent
37e3368ff3
commit
837dfc45ab
|
|
@ -90,7 +90,7 @@ public Q_SLOTS:
|
||||||
|
|
||||||
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
FaceGraph remeshed *graph;
|
FaceGraph remeshed = *graph;
|
||||||
|
|
||||||
// TODO add post-processing
|
// TODO add post-processing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ int main(int argc, char* argv[])
|
||||||
//CGAL::get_default_random() = CGAL::Random( 1739197120 ); //connexity constraint issue + infinite loop with cheese
|
//CGAL::get_default_random() = CGAL::Random( 1739197120 ); //connexity constraint issue + infinite loop with cheese
|
||||||
//CGAL::get_default_random() = CGAL::Random( 1739199762 ); //one small edge
|
//CGAL::get_default_random() = CGAL::Random( 1739199762 ); //one small edge
|
||||||
//CGAL::get_default_random() = CGAL::Random( 1739264620 ); //one very small edge
|
//CGAL::get_default_random() = CGAL::Random( 1739264620 ); //one very small edge
|
||||||
CGAL::get_default_random() = CGAL::Random( 1739293586 ); // seed elephant non-manifold with 300 clusters
|
//CGAL::get_default_random() = CGAL::Random( 1739293586 ); // seed elephant non-manifold with 300 clusters + regression for fandisk 3000 with qem
|
||||||
|
|
||||||
std::cout << "Seed : " << CGAL::get_default_random().get_seed() << std::endl;
|
std::cout << "Seed : " << CGAL::get_default_random().get_seed() << std::endl;
|
||||||
const std::string filename = (argc > 1) ?
|
const std::string filename = (argc > 1) ?
|
||||||
|
|
|
||||||
|
|
@ -295,15 +295,11 @@ struct QEMClusterData {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class TriangleMesh, class NamedParameters = parameters::Default_named_parameters>
|
template <class TriangleMesh, class VPCDM, class NamedParameters>
|
||||||
void upsample_subdivision_property(TriangleMesh& pmesh, const NamedParameters& np = parameters::default_values()) {
|
void upsample_subdivision_property(TriangleMesh& pmesh, VPCDM vpcd_map, const NamedParameters& np) {
|
||||||
typedef typename GetGeomTraits<TriangleMesh, NamedParameters>::type GT;
|
typedef typename GetGeomTraits<TriangleMesh, NamedParameters>::type GT;
|
||||||
typedef typename boost::graph_traits<TriangleMesh>::vertex_descriptor Vertex_descriptor;
|
typedef typename boost::graph_traits<TriangleMesh>::vertex_descriptor Vertex_descriptor;
|
||||||
typedef typename boost::graph_traits<TriangleMesh>::halfedge_descriptor Halfedge_descriptor;
|
typedef typename boost::graph_traits<TriangleMesh>::halfedge_descriptor Halfedge_descriptor;
|
||||||
typedef Constant_property_map<Vertex_descriptor, Principal_curvatures_and_directions<GT>> Default_principal_map;
|
|
||||||
typedef typename internal_np::Lookup_named_param_def<internal_np::vertex_principal_curvatures_and_directions_map_t,
|
|
||||||
NamedParameters,
|
|
||||||
Default_principal_map>::type VPCDM;
|
|
||||||
|
|
||||||
using parameters::choose_parameter;
|
using parameters::choose_parameter;
|
||||||
using parameters::get_parameter;
|
using parameters::get_parameter;
|
||||||
|
|
@ -313,16 +309,9 @@ void upsample_subdivision_property(TriangleMesh& pmesh, const NamedParameters& n
|
||||||
VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point),
|
VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point),
|
||||||
get_property_map(CGAL::vertex_point, pmesh));
|
get_property_map(CGAL::vertex_point, pmesh));
|
||||||
|
|
||||||
// get curvature related parameters
|
|
||||||
const VPCDM vpcd_map =
|
|
||||||
choose_parameter(get_parameter(np, internal_np::vertex_principal_curvatures_and_directions_map),
|
|
||||||
Default_principal_map());
|
|
||||||
|
|
||||||
// unordered_set of old vertices
|
// unordered_set of old vertices
|
||||||
std::unordered_set<Vertex_descriptor> old_vertices;
|
std::unordered_set<Vertex_descriptor> old_vertices;
|
||||||
|
|
||||||
bool curvatures_available = !is_default_parameter<NamedParameters, internal_np::vertex_principal_curvatures_and_directions_map_t>::value;
|
|
||||||
|
|
||||||
unsigned int step = choose_parameter(get_parameter(np, internal_np::number_of_iterations), 1);
|
unsigned int step = choose_parameter(get_parameter(np, internal_np::number_of_iterations), 1);
|
||||||
Upsample_mask_3<TriangleMesh,VPM> mask(&pmesh, vpm);
|
Upsample_mask_3<TriangleMesh,VPM> mask(&pmesh, vpm);
|
||||||
|
|
||||||
|
|
@ -332,8 +321,6 @@ void upsample_subdivision_property(TriangleMesh& pmesh, const NamedParameters& n
|
||||||
|
|
||||||
Subdivision_method_3::internal::PTQ_1step(pmesh, vpm, mask);
|
Subdivision_method_3::internal::PTQ_1step(pmesh, vpm, mask);
|
||||||
// interpolate curvature values
|
// interpolate curvature values
|
||||||
if (curvatures_available)
|
|
||||||
{
|
|
||||||
for (Vertex_descriptor vd : vertices(pmesh))
|
for (Vertex_descriptor vd : vertices(pmesh))
|
||||||
{
|
{
|
||||||
if (old_vertices.find(vd) == old_vertices.end())
|
if (old_vertices.find(vd) == old_vertices.end())
|
||||||
|
|
@ -363,7 +350,6 @@ void upsample_subdivision_property(TriangleMesh& pmesh, const NamedParameters& n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TriangleMesh,
|
template <typename TriangleMesh,
|
||||||
|
|
@ -388,7 +374,7 @@ std::pair<
|
||||||
typedef typename boost::property_map<TriangleMesh, CGAL::dynamic_vertex_property_t<bool> >::type VertexVisitedMap;
|
typedef typename boost::property_map<TriangleMesh, CGAL::dynamic_vertex_property_t<bool> >::type VertexVisitedMap;
|
||||||
typedef typename boost::property_map<TriangleMesh, CGAL::dynamic_vertex_property_t<typename GT::FT> >::type VertexWeightMap;
|
typedef typename boost::property_map<TriangleMesh, CGAL::dynamic_vertex_property_t<typename GT::FT> >::type VertexWeightMap;
|
||||||
typedef typename boost::property_map<TriangleMesh, CGAL::dynamic_vertex_property_t<Matrix4x4> >::type VertexQuadricMap;
|
typedef typename boost::property_map<TriangleMesh, CGAL::dynamic_vertex_property_t<Matrix4x4> >::type VertexQuadricMap;
|
||||||
typedef Constant_property_map<Vertex_descriptor, Principal_curvatures_and_directions<GT>> Default_principal_map;
|
typedef typename boost::property_map<TriangleMesh, CGAL::dynamic_vertex_property_t<Principal_curvatures_and_directions<GT>> >::type Default_principal_map;
|
||||||
typedef typename internal_np::Lookup_named_param_def<internal_np::vertex_principal_curvatures_and_directions_map_t,
|
typedef typename internal_np::Lookup_named_param_def<internal_np::vertex_principal_curvatures_and_directions_map_t,
|
||||||
NamedParameters,
|
NamedParameters,
|
||||||
Default_principal_map>::type Vertex_principal_curvatures_and_directions_map;
|
Default_principal_map>::type Vertex_principal_curvatures_and_directions_map;
|
||||||
|
|
@ -402,9 +388,7 @@ std::pair<
|
||||||
|
|
||||||
// get curvature related parameters
|
// get curvature related parameters
|
||||||
const typename GT::FT gradation_factor = choose_parameter(get_parameter(np, internal_np::gradation_factor), 0);
|
const typename GT::FT gradation_factor = choose_parameter(get_parameter(np, internal_np::gradation_factor), 0);
|
||||||
const Vertex_principal_curvatures_and_directions_map vpcd_map =
|
Vertex_principal_curvatures_and_directions_map vpcd_map;
|
||||||
choose_parameter(get_parameter(np, internal_np::vertex_principal_curvatures_and_directions_map),
|
|
||||||
Default_principal_map());
|
|
||||||
|
|
||||||
// using QEM ?
|
// using QEM ?
|
||||||
bool use_postprocessing_qem = choose_parameter(get_parameter(np, internal_np::use_postprocessing_qem), false);
|
bool use_postprocessing_qem = choose_parameter(get_parameter(np, internal_np::use_postprocessing_qem), false);
|
||||||
|
|
@ -412,13 +396,20 @@ std::pair<
|
||||||
if (use_qem_based_energy) use_postprocessing_qem = false;
|
if (use_qem_based_energy) use_postprocessing_qem = false;
|
||||||
|
|
||||||
// if adaptive clustering
|
// if adaptive clustering
|
||||||
if (gradation_factor > 0 &&
|
if (gradation_factor > 0)
|
||||||
is_default_parameter<NamedParameters, internal_np::vertex_principal_curvatures_and_directions_map_t>::value)
|
{
|
||||||
|
if constexpr (is_default_parameter<NamedParameters, internal_np::vertex_principal_curvatures_and_directions_map_t>::value)
|
||||||
|
{
|
||||||
|
vpcd_map = get(CGAL::dynamic_vertex_property_t<Principal_curvatures_and_directions<GT>>(), pmesh);
|
||||||
interpolated_corrected_curvatures(pmesh, parameters::vertex_principal_curvatures_and_directions_map(vpcd_map));
|
interpolated_corrected_curvatures(pmesh, parameters::vertex_principal_curvatures_and_directions_map(vpcd_map));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vpcd_map = get_parameter(np, internal_np::vertex_principal_curvatures_and_directions_map);
|
||||||
|
}
|
||||||
|
|
||||||
CGAL_precondition(CGAL::is_triangle_mesh(pmesh));
|
CGAL_precondition(CGAL::is_triangle_mesh(pmesh));
|
||||||
|
|
||||||
const double vertex_count_ratio = choose_parameter(get_parameter(np, internal_np::vertex_count_ratio), 0.05);
|
const double vertex_count_ratio = choose_parameter(get_parameter(np, internal_np::vertex_count_ratio), 0.1);
|
||||||
// TODO compute less qem things if not used
|
// TODO compute less qem things if not used
|
||||||
// TODO use symmetric matrices?
|
// TODO use symmetric matrices?
|
||||||
|
|
||||||
|
|
@ -506,7 +497,7 @@ std::pair<
|
||||||
);
|
);
|
||||||
else // adaptive clustering
|
else // adaptive clustering
|
||||||
upsample_subdivision_property(
|
upsample_subdivision_property(
|
||||||
pmesh,
|
pmesh, vpcd_map,
|
||||||
CGAL::parameters::number_of_iterations(subdivide_steps).vertex_principal_curvatures_and_directions_map(vpcd_map)
|
CGAL::parameters::number_of_iterations(subdivide_steps).vertex_principal_curvatures_and_directions_map(vpcd_map)
|
||||||
);
|
);
|
||||||
vpm = get_property_map(CGAL::vertex_point, pmesh);
|
vpm = get_property_map(CGAL::vertex_point, pmesh);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue