Subject: CGAL users discussion list
List archive
- From: calvin_cw <>
- To:
- Subject: [cgal-discuss] Using Hole filling using inherited Polyhedron class
- Date: Wed, 9 Sep 2020 02:22:52 -0500 (CDT)
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=SoftFail ; spf=Pass
- Ironport-phdr: 9a23:39iTRBTEYj5zkIhGKEIsRGcc9Npsv+yvbD5Q0YIujvd0So/mwa6yZReN2/xhgRfzUJnB7Loc0qyK6v6mADZcqsbY+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAi3oAnLq8Uan4RvJqkyxxfUv3BFZ/lYyWR0KFyJgh3y/N2w/Jlt8yRRv/Iu6ctNWrjkcqo7ULJVEi0oP3g668P3uxbDSxCP5mYHXWUNjhVIGQnF4wrkUZr3ryD3q/By2CiePc3xULA0RTGv5LplRRP0lCsKMSMy/WfKgcJyka1bugqsqRJ/zYDKY4+bKfVxcb/Sc94BWWpMXNpdWzBdDo+gcYcCCfcKM+ZCr4n6olsDtQexChOoBOPxyz9IgGf50rE00u88FgzJwBYvH9YQsHTVqtX6LLsdUO6uwanIyjXDc/ZW1i386IjMaBwuvfaMXbdpfMfX1EIgGB/LgE+Kpoz5IzOayP4Ns26D4uRgVeyjl2AqpgJwrzSyyMohiIbHi40Jxl3H+yh0w4g7KNykREJmfdOoDJVduS6GOodoTM4vX39ktSc5x7EYp5K2ejUBxpogxx7acfOHco6I7wrlVOmLOjh3n3Zld6ylixmu9kigz+vxXdS33lZStidJj93Bu3QX2xHd6cWLUPhw80a71TuO1g3e7PxPL1oumqrBMZEhx6Y9lpoNvkTHGS/7gEP2gaCMekUi4Oen8P/oYrH4qZOGK4B0jQT+Prwvmsy5H+s4LhADU3Wf9Om4zrHu8070TK9Jg/A3iKXUsZHXKdwepqGjAg9V1ogj6wy4DzejyNkXgWMILFZbeBKGiYjmI03BIf7jAPe/hFSsjDJryOrHPr3lGJnCMn/DkLL5cbZn90Fc0BYzzcxY559MFr4BL+j8WkvouNPFDx85KBC7w/v8CNVmzY4eQmKOAqqBMKzIq1OI5+QvI/ONZIAPojr9JeIltLbSiioyllYZOKWoxpAKc2uQH/J8Ikzfb2C/rM0GFDIBtw4gTerdg0LKBTVaY2izWZU3+Rk7D56jBIbHAIuqherSj2+AApRKazUeWRi3GnDyetDcAqteWGepOsZk1wc8e/25UYZ4jkOusxP/wrtjaOHT/39A7M+x5J1O/+TW0CoK23l0AsCaijzfST0ymGoCTTs7mqt4pB4kkwbR4e1Dm/VdUOdrybZMWwY+O4TbyrUhWdD1RgfIf9PPQ1GjEI6r
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+.