Add a mesh in envelope test

This commit is contained in:
Andreas Fabri 2020-12-03 07:58:33 +00:00
parent 3463501b4d
commit 6046432534
3 changed files with 41 additions and 0 deletions

View File

@ -55,6 +55,7 @@ endif()
create_single_source_cgal_program( "polyhedral_envelope.cpp" ) create_single_source_cgal_program( "polyhedral_envelope.cpp" )
create_single_source_cgal_program( "polyhedral_envelope_of_triangle_soup.cpp" ) create_single_source_cgal_program( "polyhedral_envelope_of_triangle_soup.cpp" )
create_single_source_cgal_program( "polyhedral_envelope_mesh_containment.cpp" )
create_single_source_cgal_program( "self_intersections_example.cpp" ) create_single_source_cgal_program( "self_intersections_example.cpp" )
create_single_source_cgal_program( "stitch_borders_example.cpp" ) create_single_source_cgal_program( "stitch_borders_example.cpp" )
create_single_source_cgal_program( "compute_normals_example_Polyhedron.cpp" CXX_FEATURES cxx_range_for ) create_single_source_cgal_program( "compute_normals_example_Polyhedron.cpp" CXX_FEATURES cxx_range_for )

View File

@ -0,0 +1,38 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedral_envelope.h>
#include <CGAL/Surface_mesh.h>
#include <fstream>
int main(int argc, char* argv[])
{
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
typedef boost::graph_traits<Surface_mesh>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<Surface_mesh>::halfedge_descriptor halfedge_descriptor;
typedef CGAL::Polyhedral_envelope<Kernel> Envelope;
std::ifstream in((argc>1) ? argv[1] : "data/patch.off");
std::ifstream in2((argc>2) ? argv[2] : "data/tentative.off");
Surface_mesh tmesh, test;
in >> tmesh;
in2 >> test;
double eps = (argc>3) ? std::stod(std::string(argv[3])) : 0.2;
Envelope envelope(tmesh, eps);
for(auto fd : faces(test)){
halfedge_descriptor hd = halfedge(fd, test);
Point_3 p = test.point(target(hd,test));
Point_3 q = test.point(target(next(hd,test),test));
Point_3 r = test.point(source(hd,test));
if(envelope(p,q,r)){
std::cout << "inside polyhedral envelope" << std::endl;
}
}
return 0;
}

View File

@ -58,6 +58,8 @@
#include <CGAL/license/Polygon_mesh_processing/Polyhedral_envelope.h> #include <CGAL/license/Polygon_mesh_processing/Polyhedral_envelope.h>
#define CGAL_ENVELOPE_DEBUG 1
#include <CGAL/disable_warnings.h> #include <CGAL/disable_warnings.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>