adapting examples

This commit is contained in:
Sven Oesau 2024-05-13 17:25:33 +02:00
parent 6c94b4e3a2
commit 9cd6762198
5 changed files with 28 additions and 26 deletions

View File

@ -27,17 +27,18 @@ struct Graphics_scene_options_small_faces:
Graphics_scene_options_small_faces(const SM& sm): Base(), m_sm(sm)
{
typename SM::template Property_map<face_descriptor, FT> faces_size;
boost::tie(faces_size, m_with_size)=sm.template property_map<face_descriptor, FT>("f:size");
std::optional<typename SM::template Property_map<face_descriptor, FT>> faces_size
= sm.template property_map<face_descriptor, FT>("f:size");
m_with_size = faces_size.has_value();
if(!m_with_size)
{ return; }
m_min_size=faces_size[*(sm.faces().begin())];
m_min_size=(*faces_size)[*(sm.faces().begin())];
m_max_size=m_min_size;
FT cur_size;
for (typename SM::Face_range::iterator f=sm.faces().begin(); f!=sm.faces().end(); ++f)
{
cur_size=faces_size[*f];
cur_size=(*faces_size)[*f];
if (cur_size<m_min_size) m_min_size=cur_size;
if (cur_size>m_max_size) m_max_size=cur_size;
}
@ -60,12 +61,12 @@ struct Graphics_scene_options_small_faces:
// Compare the size of the face with the % m_threshold
bool exist;
typename SM::template Property_map<face_descriptor, FT> faces_size;
boost::tie(faces_size, exist)=sm.template property_map<face_descriptor, FT>("f:size");
assert(exist);
std::optional<typename SM::template Property_map<face_descriptor, FT>> faces_size
=sm.template property_map<face_descriptor, FT>("f:size");
assert(faces_size.has_value());
// If the face is small, color it in red.
if (get(faces_size, fh)<m_min_size+((m_max_size-m_min_size)/(100-m_threshold)))
if (get(*faces_size, fh)<m_min_size+((m_max_size-m_min_size)/(100-m_threshold)))
{ return CGAL::IO::Color(255,20,20); }
return c; // Default color

View File

@ -115,7 +115,7 @@ namespace internal {
// The supporting planar segment of each face
typename Polygon_mesh::template Property_map<Face_descriptor, Planar_segment*> face_supporting_segments =
mesh.template property_map<Face_descriptor, Planar_segment*>("f:supp_segment").first;
*mesh.template property_map<Face_descriptor, Planar_segment*>("f:supp_segment");
Planar_segment* segment = face_supporting_segments[face];
if (segment == nullptr)
@ -123,7 +123,7 @@ namespace internal {
// The supporting plane of each face
typename Polygon_mesh::template Property_map<Face_descriptor, const Plane*> face_supporting_planes =
mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane").first;
*mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane");
// We do everything by projecting the point onto the face's supporting plane
const Plane* supporting_plane = face_supporting_planes[face];
CGAL_assertion(supporting_plane == segment->supporting_plane());
@ -186,7 +186,7 @@ namespace internal {
// The supporting plane of each face
typename Polygon_mesh::template Property_map<Face_descriptor, const Plane*> face_supporting_planes =
mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane").first;
*mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane");
FT degenerate_face_area_threshold = CGAL::snap_squared_distance_threshold<FT>() * CGAL::snap_squared_distance_threshold<FT>();

View File

@ -539,9 +539,9 @@ namespace CGAL {
// Properties of the bbox_mesh
typename Polygon_mesh::template Property_map<Edge_descriptor, std::set<const Plane*> > bbox_edge_supporting_planes
= bbox_mesh.template property_map<Edge_descriptor, std::set<const Plane*> >("e:supp_plane").first;
= *bbox_mesh.template property_map<Edge_descriptor, std::set<const Plane*> >("e:supp_plane");
typename Polygon_mesh::template Property_map<Vertex_descriptor, std::set<const Plane*> > bbox_vertex_supporting_planes
= bbox_mesh.template property_map<Vertex_descriptor, std::set<const Plane*> >("v:supp_plane").first;
= *bbox_mesh.template property_map<Vertex_descriptor, std::set<const Plane*> >("v:supp_plane");
// The properties of the proxy mesh
candidate_faces.clear();
@ -729,11 +729,11 @@ namespace CGAL {
Hypothesis<Kernel>::split_edge(Polygon_mesh& mesh, const EdgePos& ep, const Plane* cutting_plane) {
// The supporting planes of each edge
typename Polygon_mesh::template Property_map<Edge_descriptor, std::set<const Plane*> > edge_supporting_planes =
mesh.template property_map<Edge_descriptor, std::set<const Plane*> >("e:supp_plane").first;
*mesh.template property_map<Edge_descriptor, std::set<const Plane*> >("e:supp_plane");
// The supporting planes of each vertex
typename Polygon_mesh::template Property_map<Vertex_descriptor, std::set<const Plane*> > vertex_supporting_planes
= mesh.template property_map<Vertex_descriptor, std::set<const Plane*> >("v:supp_plane").first;
= *mesh.template property_map<Vertex_descriptor, std::set<const Plane*> >("v:supp_plane");
// We cannot use const reference, because it will become invalid after splitting
std::set<const Plane*> sfs = edge_supporting_planes[ep.edge];
@ -771,7 +771,7 @@ namespace CGAL {
// The supporting plane of each face
typename Polygon_mesh::template Property_map<Face_descriptor, const Plane*> face_supporting_planes =
mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane").first;
*mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane");
const Plane* supporting_plane = face_supporting_planes[face];
if (supporting_plane == cutting_plane)
@ -779,11 +779,11 @@ namespace CGAL {
// The supporting planar segment of each face
typename Polygon_mesh::template Property_map<Face_descriptor, Planar_segment*> face_supporting_segments =
mesh.template property_map<Face_descriptor, Planar_segment*>("f:supp_segment").first;
*mesh.template property_map<Face_descriptor, Planar_segment*>("f:supp_segment");
// The supporting planes of each edge
typename Polygon_mesh::template Property_map<Edge_descriptor, std::set<const Plane*> > edge_supporting_planes =
mesh.template property_map<Edge_descriptor, std::set<const Plane*> >("e:supp_plane").first;
*mesh.template property_map<Edge_descriptor, std::set<const Plane*> >("e:supp_plane");
Planar_segment* supporting_segment = face_supporting_segments[face];
@ -882,13 +882,13 @@ namespace CGAL {
// The supporting plane of each face
typename Polygon_mesh::template Property_map<Face_descriptor, const Plane*> face_supporting_planes =
mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane").first;
*mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane");
const Plane* supporting_plane = face_supporting_planes[face];
if (supporting_plane == cutting_plane)
return;
typename Polygon_mesh::template Property_map<Edge_descriptor, std::set<const Plane*> > edge_supporting_planes
= mesh.template property_map<Edge_descriptor, std::set<const Plane*> >("e:supp_plane").first;
= *mesh.template property_map<Edge_descriptor, std::set<const Plane*> >("e:supp_plane");
const typename Polygon_mesh::template Property_map<Vertex_descriptor, Point>& coords = mesh.points();
@ -997,11 +997,11 @@ namespace CGAL {
{
// The supporting plane of each face
typename Polygon_mesh::template Property_map<Face_descriptor, const Plane*> face_supporting_planes =
mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane").first;
*mesh.template property_map<Face_descriptor, const Plane*>("f:supp_plane");
// The supporting planar segment of each face
typename Polygon_mesh::template Property_map<Face_descriptor, Planar_segment*> face_supporting_segments =
mesh.template property_map<Face_descriptor, Planar_segment*>("f:supp_segment").first;
*mesh.template property_map<Face_descriptor, Planar_segment*>("f:supp_segment");
std::set<Face_descriptor> intersecting_faces;
for(auto f : mesh.faces()) {
@ -1034,7 +1034,7 @@ namespace CGAL {
// The supporting plane of each face
typename Polygon_mesh::template Property_map<Face_descriptor, const Plane*> face_supporting_planes
= candidate_faces.template property_map<Face_descriptor, const Plane*>("f:supp_plane").first;
= *candidate_faces.template property_map<Face_descriptor, const Plane*>("f:supp_plane");
for (std::size_t i = 0; i < all_faces.size(); ++i) {
Face_descriptor face = all_faces[i];
@ -1090,7 +1090,7 @@ namespace CGAL {
typename Hypothesis<Kernel>::Adjacency Hypothesis<Kernel>::extract_adjacency(const Polygon_mesh& candidate_faces)
{
typename Polygon_mesh::template Property_map<Vertex_descriptor, std::set<const Plane*> > vertex_supporting_planes
= candidate_faces.template property_map<Vertex_descriptor, std::set<const Plane*> >("v:supp_plane").first;
= *candidate_faces.template property_map<Vertex_descriptor, std::set<const Plane*> >("v:supp_plane");
// An edge is denoted by its two end points
typedef typename std::unordered_map<const Point*, std::set<Halfedge_descriptor> > Edge_map;

View File

@ -20,6 +20,7 @@
#include <CGAL/property_map.h>
#include <algorithm>
#include <optional>
#include <string>
#include <typeinfo>
#include <vector>

View File

@ -100,7 +100,7 @@ typename boost::lazy_disable_if<
inline get(CGAL::face_patch_id_t<I>, const Surface_mesh<P> & smesh)
{
typedef typename boost::graph_traits<Surface_mesh<P> >::face_descriptor face_descriptor;
return smesh. template property_map<face_descriptor,I>("f:patch_id").first;
return *smesh. template property_map<face_descriptor,I>("f:patch_id");
}
@ -134,7 +134,7 @@ CGAL_PROPERTY_SURFACE_MESH_RETURN_TYPE(CGAL::edge_is_feature_t)
inline get(CGAL::edge_is_feature_t, const Surface_mesh<P>& smesh)
{
typedef typename boost::graph_traits<Surface_mesh<P> >::edge_descriptor edge_descriptor;
return smesh. template property_map<edge_descriptor,bool>("e:is_feature").first;
return *smesh. template property_map<edge_descriptor,bool>("e:is_feature");
}