Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Using edge_collapse with an inherited polyhedron_3 class

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Using edge_collapse with an inherited polyhedron_3 class


Chronological Thread 
  • From: calvin_cw <>
  • To:
  • Subject: Re: [cgal-discuss] Using edge_collapse with an inherited polyhedron_3 class
  • Date: Thu, 28 May 2020 20:55:13 -0500 (CDT)
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=SoftFail ; spf=Pass
  • Ironport-phdr: 9a23:Zc0FeR/tV3NYWv9uRHKM819IXTAuvvDOBiVQ1KB30u0cTK2v8tzYMVDF4r011RmVBNidsqgbwLaJ+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxhIiTanfL9+Mhe7oQreu8QUnIBvNrs/xhzVr3VSZu9Y33loJVWdnxb94se/4ptu+DlOtvwi6sBNT7z0c7w3QrJEAjsmNXs15NDwuhnYUQSP/HocXX4InRdOHgPI8Qv1Xpb1siv9q+p9xCyXNtD4QLwoRTiv6bpgRRn1gykFKjE56nnahMJwgqxFoxyupRJ/zZPbb46JO/RzZb/dcNEGSWZdQspdSzJND4WhZIUPFeoBOuNYopHhqFQUqRu+GwisBOX3xTBUiH79wKo33Pg7HgHCwgwgHtQOv2zIo9T7L6oSUee1zLXNzTrZbvNW3S3x55TPchAkuPyBW697fsXNx0c1DQzFkkmQppL/PzOTzukAsGqW4vRvW++sj2Mqqw98ryaxysosjoTEmp4ZxF/F+Ch6wYs4ONK2RFJ/bNK6FJZduC6XOo92TM88TG9luSQ3x7sbspC1eygKzY4oxx/Za/GfdYiH+AnsW/2VIThmnn5qZLW/hxO0/EO9yeP8TtG53EtOoydBiNXBuHMA2wbQ58WGUPdw/0as1DCS3A7J8O5EO1o7la/DJp4h3LEwkp0TvFzFHiL5gkn2irWZeV4/9eis9evreKnpppiZN4NsiwH+NLohmtCnDOglNgUDW3KX9Oq/2bH5/kD0Qa9Gg/w3n6XBtZDVP8Ubpqq3Aw9P1YYj7g6yACu839Qcg3kHLVRFdwqbgInnIFzOIPf4Deu6g1u2kTdrw+rKMaHmApXINnTDiqvufa5h605Azwo+1cxQ551OBbEFOf78R07xtMfEAR8kKAy02P3qCM5914MbQWKAGLWVMKLUsV+S5+IgOfOAZIEPuGW1F/9w7PHniTo1mEQWYLKy9ZoRcnGxWPp8cGuDZn+5id4FD2YMiQEhBLjhgVmcUDhkbGmaX6Ug4zg6DMStCoKVFdPlu6CIwCruRs4eXWtBEF3ZSS61JbXBYO8FbWepGuEkkjEAUuH8GYl9kxenvgX+xvxsKe+Go3RE56Km78B84qjorT937SZ9Vp/P02aRSmh1miUDQDpkhPku83w48U+K1O1Du9IdENVS4/1TVQJjbszcyPB/AtH2HAnGe4XSRQ==


I tried defining it, but still getting the same error.
I included my code into the example file
"edge_collapse_enriched_polyhedron.cpp"

==========================================

#include <iostream>
#include <fstream>

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
// Extended polyhedron items which include an id() field
#include <CGAL/Polyhedron_items_with_id_3.h>

#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
#include
<CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h>

typedef CGAL::Simple_cartesian<double>
Kernel;
class feSurf_Elements : public CGAL::Polyhedron_items_3
{};


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 boost::graph_traits<feSurfaceMesh> :
public boost::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<feSurfaceMesh::Base, T>
{};
}


typedef CGAL::Simple_cartesian<double> Kernel;
//typedef Kernel::Point_3 Point;

// Setup an enriched polyhedron type which stores an id() field in the items
typedef CGAL::Polyhedron_3<Kernel,CGAL::Polyhedron_items_with_id_3>
Surface_mesh;

typedef boost::graph_traits<Surface_mesh>::halfedge_descriptor
halfedge_descriptor;
typedef boost::graph_traits<Surface_mesh>::vertex_descriptor
vertex_descriptor;

namespace SMS = CGAL::Surface_mesh_simplification;


int main( int argc, char** argv )
{
Surface_mesh surface_mesh;

std::ifstream is(argv[1]);
is >> surface_mesh;
if (!CGAL::is_triangle_mesh(surface_mesh)){
std::cerr << "Input geometry is not triangulated." << std::endl;
return EXIT_FAILURE;
}

// The items in this polyhedron have an "id()" field
// which the default index maps used in the algorithm
// need to get the index of a vertex/edge.
// However, the Polyhedron_3 class doesn't assign any value to
// this id(), so we must do it here:
int index = 0;

for(halfedge_descriptor hd : halfedges(surface_mesh)){
hd->id() = index++;
}
index = 0;

for(vertex_descriptor vd : vertices(surface_mesh)){
vd->id() = index++;
}

// In this example, the simplification stops when the number of undirected
edges
// drops below 10% of the initial count
SMS::Count_ratio_stop_predicate<Surface_mesh> stop(0.1);


// The index maps are not explicitelty passed as in the previous
// example because the surface mesh items have a proper id() field.
// On the other hand, we pass here explicit cost and placement
// function which differ from the default policies, ommited in
// the previous example.
int r = SMS::edge_collapse(surface_mesh, stop);


feSurfaceMesh feSurf3D;
int e = SMS::edge_collapse(feSurf3D, stop);



std::cout << "\nFinished...\n" << r << " edges removed.\n"
<< (surface_mesh.size_of_halfedges()/2) << " final edges.\n";

std::ofstream os( argc > 2 ? argv[2] : "out.off" );
os.precision(17);
os << surface_mesh;

return EXIT_SUCCESS;
}

=========================================================

This code will not run, since the id field is not set, but the compilation
error is the same I got. Hope I can solve what is causing the compilation
errors.

thanks a lot!








--
Sent from: http://cgal-discuss.949826.n4.nabble.com/



Archive powered by MHonArc 2.6.19+.

Top of Page