Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Using Hole filling using inherited Polyhedron class
- Date: Wed, 9 Sep 2020 09:42:03 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:PG2j3xVehoJFb8NqCD8g4dfspdDV8LGtZVwlr6E/grcLSJyIuqrYZRSGuqdThVPEFb/W9+hDw7KP9fy5BypZu8rK4ClKWacPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3wOgVvO+v6BJPZgdip2OCu4Z3TZBhDiCagbb9oIxi6sATcutMLjYd8Jas9xRjErmZVcOlK2G1kIk6ekQzh7cmq5p5j9CpQu/Ml98FeVKjxYro1Q79FAjk4Km45/MLkuwXNQguJ/XscT34ZkgFUDAjf7RH1RYn+vy3nvedgwiaaPMn2TbcpWTS+6qpgVRHlhDsbOzM/7WrajNF7gqBGrxK7vxFx3pDaYI+VOvR9cK3Sc9wVSmhdUcheTCFBHoGxYpETA+YdM+tVrY/wrEYOoxukAgmsAfvixjFViHDoxqI1yf8hER3H3AM+GdIFrXLarNLvNKcTVuC10LTDwTHCYfxI3jf97ZbHcgw7ofCMXbx/a9beyVUoFwPfjlScrILpNC6S2+QWt2ib6PBgVeOoi247sQ1xpzyvy9wjionMnI0Vy1TE+T9lz4YyIN21UUh2asOrH5VMrS+VLZd2Qt88TGFyviY30qALtIK/cSUE1JkqwwLTZvOIfoWL/h7vSPidLzlliH57e7+yhRW//VW+x+PyS8S53lZEoyRLn9fMqH0BygLf5MiBR/Bg8Emh3jOP2BrS6uFCOU00mqvbK4Ihwr4tjZUfq1jMHijzmEnuiq+ZbF4r9fOs6+v5eLnpupicN4pyhwrjMaougtSyDfokPgUKRWSW+uSx2Kf+8UHnQ7hGlPI7n6rBvJzEP8sXurO1DgpL3Yo/8RmyCimq3MgFkXQCIl9KYgyLg5TsNl3QI/31DuuwjlGjnThx3f/LOrjsDojDI3XAirjseLh95kxexQcxy91U+ohaBasbIP3pX0/8rNzYAQE9Mwyz2+vnDc9y1oIaWW6WDK6ZNb7evUaG5u8gIOSAfoAVuDH6K/gq4/7hk2U1lkMafamsxZcXaXa4Eep6I0iBf3bgntMMHX0Jswc+VuDmlUOOXD1Ja3u9XK8w/jQ7B5inDYfHSICtmruB3CKjE51NYmBGDUqMEXbvd4WYQfsMbSaSL9RukjwBT7ehSosh2Quyuw/9zrprNvDU9TEAtZL/yNh14PXemg099TNuC8SRynyCT2BvnmwUWj82x7t/rFdmylaD1Kh4m+ZXGcZS5/NPSAc6NITTw/Z0C9DoCUr9eYKCR1+iB9mnGjosVckZwtkUYk87Fc/xoArE2n/gOLIfnqeXBZEyuobbxXn2O4495HvB0aQ9lUgIS8BTMne3x+Q3oxPXAJTIlFnfkqKCeqEV3SqL/2CGmznd9HpEWRJ9BP2WFUsUYVHb+IyguhHyCoS2ALFiCTNvjNaYI/ITONLshFRCAvzkPYaGOjPjqyKLHR+Ng4i0Qs/vcmQZ0j/aDRFdwQ8W9HeCcwM5A3X4+j+MPHlVDVvqJnjU36x+pXe8FBJmygiLawh+0uPw9EJFw/ObTPwX0/QPvyJz8zg=
Have a look at this PR that contains a convenience header to ease
the use of CGAL algorithm with dereived classes.
https://github.com/CGAL/cgal/pull/4938
This example is using Polyhedron:
https://github.com/CGAL/cgal/pull/4938/files#diff-a9b02a9ba5a7ef7823d5cf4e47187e2e
If I get it right the macros in your case must be:
#define CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS class Kernel, class feSurf_Elements
#define CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME feSurfMesh<Kernel, feSurf_Elements>
#define CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME Polyhedron_3<Kernel, feSurf_Elements>
Best regards,
Sebastien.
On 9/9/20 9:22 AM, calvin_cw ( via cgal-discuss Mailing List) wrote:
Hi,
I am trying to compile a sample hole filling code using an inherited
polyhedron class. The code is reproduced below. I keep getting the error
related to sparse matrix class. Hope someone can assist to point out the
error. thanks!
regards
Calvin
<<<< Start code
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_mesh_processing/triangulate_hole.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/OFF_reader.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <CGAL/Polyhedron_items_with_id_3.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
template <class Refs, class ID>
class feEdge_Surf : public CGAL::HalfedgeDS_halfedge_base< Refs,
CGAL::Tag_true, CGAL::Tag_true, CGAL::Tag_true >
{
typedef ID size_type;
private:
size_type mID;
public:
size_type& id() { return mID; }
size_type const& id() const { return mID; }
};
template <class Refs, class Traits, class ID>
class feFace_Surf : public CGAL::HalfedgeDS_face_base<Refs, CGAL::Tag_true,
typename Traits::Plane_3>
{
typedef ID size_type;
private:
size_type mID;
public:
size_type& id() { return mID; }
size_type const& id() const { return mID; }
};
template <class Refs, class Traits, class ID>
class feNode_Surf : public CGAL::HalfedgeDS_vertex_base< Refs,
CGAL::Tag_true, typename Traits::Point_3 >
{
typedef typename Traits::Point_3
Point_3;
typedef ID size_type;
private:
size_type mID;
public:
size_type& id() { return mID; }
size_type const& id() const { return mID; }
feNode_Surf(const Point_3& p) : CGAL::HalfedgeDS_vertex_base< Refs,
CGAL::Tag_true, Point_3>(p)
{}
feNode_Surf() : CGAL::HalfedgeDS_vertex_base< Refs, CGAL::Tag_true,
Point_3>()
{}
};
class feSurf_Elements : public CGAL::Polyhedron_items_3
{
public:
template <class Refs, class Traits>
struct Vertex_wrapper {
typedef feNode_Surf<Refs, Traits, std::size_t> Vertex;
};
template <class Refs, class Traits>
struct Halfedge_wrapper {
typedef feEdge_Surf<Refs, std::size_t> Halfedge;
};
template <class Refs, class Traits>
struct Face_wrapper {
typedef feFace_Surf<Refs, Traits, std::size_t> Face;
};
};
typedef CGAL::Polyhedron_3<Kernel, feSurf_Elements>::Point_3 Point_fe;
typedef CGAL::Polyhedron_3<Kernel, feSurf_Elements> Poly_3;
template<class Kernel, class feSurf_Elements>
class feSurfMesh : public Poly_3
{
public:
typedef Point_fe Base;
};
typedef feSurfMesh<Kernel, feSurf_Elements>
feSurfaceMesh;
namespace boost {
template <>
struct graph_traits<feSurfaceMesh> :
public graph_traits<Poly_3>
{};
} // namespace boost
namespace boost {
template <class Tag>
struct property_map<feSurfaceMesh, Tag> :
public property_map<Poly_3, Tag>
{};
} //namespace boost
namespace CGAL {
template <typename T>
struct graph_has_property<feSurfaceMesh, T>
: public CGAL::graph_has_property<Poly_3, T>
{};
}
typedef CGAL::Polyhedron_3<Kernel, feSurf_Elements>::Halfedge_handle
HalfEdge_handle;
typedef CGAL::Polyhedron_3<Kernel, feSurf_Elements>::Facet_handle
Facet_handle;
typedef CGAL::Polyhedron_3<Kernel, feSurf_Elements>::Vertex_handle
SurfPt_handle;
int main(int argc, char* argv[])
{
const char* filename = (argc > 1) ? argv[1] :
"data/mech-holes-shark.off";
std::ifstream input(filename);
feSurfaceMesh feMesh;
CGAL::read_off(input, feMesh);
// Incrementally fill the holes
unsigned int nb_holes = 0;
for (HalfEdge_handle h : halfedges(feMesh))
{
if (h->is_border())
{
std::vector<Facet_handle> patch_facets;
std::vector<SurfPt_handle> patch_vertices;
bool success = std::get<0>(
CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(
feMesh,
h,
std::back_inserter(patch_facets),
std::back_inserter(patch_vertices),
CGAL::Polygon_mesh_processing::parameters::vertex_point_map(get(CGAL::vertex_point,
feMesh)).geom_traits(Kernel())));
std::cout << " Number of facets in constructed patch: "
<<
patch_facets.size() << std::endl;
std::cout << " Number of vertices in constructed patch: "
<<
patch_vertices.size() << std::endl;
std::cout << " Fairing : " << (success ? "succeeded" :
"failed") <<
std::endl;
++nb_holes;
}
}
std::cout << std::endl;
std::cout << nb_holes << " holes have been filled" << std::endl;
std::ofstream out("filled.off");
out.precision(17);
out << feMesh << std::endl;
return 0;
}
--
Sent from: http://cgal-discuss.949826.n4.nabble.com/
- [cgal-discuss] Using Hole filling using inherited Polyhedron class, calvin_cw, 09/09/2020
- Re: [cgal-discuss] Using Hole filling using inherited Polyhedron class, Sebastien Loriot (GeometryFactory), 09/09/2020
- Re: [cgal-discuss] Using Hole filling using inherited Polyhedron class, calvin_cw, 09/10/2020
- Re: [cgal-discuss] Using Hole filling using inherited Polyhedron class, Sebastien Loriot (GeometryFactory), 09/10/2020
- Re: [cgal-discuss] Using Hole filling using inherited Polyhedron class, calvin_cw, 09/10/2020
- Re: [cgal-discuss] Using Hole filling using inherited Polyhedron class, Sebastien Loriot (GeometryFactory), 09/09/2020
Archive powered by MHonArc 2.6.19+.