From 41cd3194876b4168b6a1ca7f68f60851e9dbeb74 Mon Sep 17 00:00:00 2001 From: Christina Vaz Date: Thu, 21 Jun 2018 13:59:30 -0400 Subject: [PATCH] build test and fixes --- .../Intrinsic_Delaunay_Triangulation_3.h | 32 ++++++++++++--- .../test/Heat_method_3/CMakeLists.txt | 3 +- .../intrinsic_delaunay_triangulation_test.cpp | 41 +++++++++++++++++++ 3 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 Heat_method_3/test/Heat_method_3/intrinsic_delaunay_triangulation_test.cpp diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Intrinsic_Delaunay_Triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Intrinsic_Delaunay_Triangulation_3.h index b3d4ba46d2e..8f8a2134173 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Intrinsic_Delaunay_Triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Intrinsic_Delaunay_Triangulation_3.h @@ -39,6 +39,8 @@ #include #include #include +#include + namespace CGAL { namespace Intrinsic_Delaunay_Triangulation_3 { @@ -62,12 +64,11 @@ namespace Intrinsic_Delaunay_Triangulation_3 { */ template ::const_type, typename FaceIndexMap = typename boost::property_map< TriangleMesh, face_index_t>::const_type, - typename EdgeIndexMap = typename boost::property_map< TriangleMesh, edge_index_t>::const_type, - typename LA = Intrinsic_Delaunay_Triangulation_Eigen_Traits_3> + typename EdgeIndexMap = typename boost::property_map< TriangleMesh, boost::edge_index_t>::const_type, + typename LA = Intrinsic_Delaunay_Triangulation_Eigen_traits_3> class Intrinsic_Delaunay_Triangulation_3 { typedef typename boost::graph_traits graph_traits; @@ -76,6 +77,7 @@ namespace Intrinsic_Delaunay_Triangulation_3 { typedef typename graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename graph_traits::face_descriptor face_descriptor; typedef typename std::set::iterator vertex_iterator; + typedef typename std::set::iterator edge_iterator; /// Geometric typedefs typedef typename Traits::Point_3 Point_3; typedef typename Traits::FT FT; @@ -102,14 +104,33 @@ namespace Intrinsic_Delaunay_Triangulation_3 { typedef typename boost::property_map::type Edge_id_map; Edge_id_map edge_id_map; + std::stack > stack; + public: + Intrinsic_Delaunay_Triangulation_3(TriangleMesh tm, VertexDistanceMap vdm) + : tm(tm), vdm(vdm), vpm(get(vertex_point,tm)) + { + build(); + } + + + + Intrinsic_Delaunay_Triangulation_3(TriangleMesh tm, VertexDistanceMap vdm, VertexPointMap vpm, FaceIndexMap fpm, EdgeIndexMap epm) + : tm(tm), vdm(vdm), vpm(vpm), fpm(fpm), epm(epm) + { + build(); + } + + //return true if edge is locally delaunay (opposing angles are less than pi) bool is_edge_locally_delaunay(edge_descriptor ed) { //two ways of doing this: taking angles directly (not good with virtual edges) //OR: taking edge length and using law of cosines //the second way also finds cotan weights which can be used to populate c + + return true; } @@ -122,7 +143,7 @@ namespace Intrinsic_Delaunay_Triangulation_3 { //Heron's formula double face_area(double a, double b, double c) { - double S = (a+b+c)./2; + double S = (a+b+c)/2; return CGAL::sqrt(S*(S-a)*(S-b)*(S-c)); } @@ -155,6 +176,7 @@ namespace Intrinsic_Delaunay_Triangulation_3 { VertexPointMap vpm; FaceIndexMap fpm; EdgeIndexMap epm; + VertexDistanceMap vdm; diff --git a/Heat_method_3/test/Heat_method_3/CMakeLists.txt b/Heat_method_3/test/Heat_method_3/CMakeLists.txt index 84ee55f33e5..d08c51b9283 100644 --- a/Heat_method_3/test/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/test/Heat_method_3/CMakeLists.txt @@ -52,5 +52,4 @@ include_directories( BEFORE include ) include( CGAL_CreateSingleSourceCGALProgram ) create_single_source_cgal_program( "heat_method_surface_mesh_test.cpp" ) - - +create_single_source_cgal_program( "intrinsic_delaunay_triangulation_test.cpp" ) diff --git a/Heat_method_3/test/Heat_method_3/intrinsic_delaunay_triangulation_test.cpp b/Heat_method_3/test/Heat_method_3/intrinsic_delaunay_triangulation_test.cpp new file mode 100644 index 00000000000..4e1be5fd0ef --- /dev/null +++ b/Heat_method_3/test/Heat_method_3/intrinsic_delaunay_triangulation_test.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point; +typedef CGAL::Surface_mesh Mesh; +//typedef CGAL::Polyhedron_3 Mesh; + +typedef CGAL::dynamic_vertex_property_t Vertex_distance_tag; +typedef boost::property_map::type Vertex_distance_map; + +typedef boost::graph_traits::vertex_descriptor vertex_descriptor; +typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 IDT; + +int main() +{ + Mesh sm; + Vertex_distance_map vertex_distance_map = get(Vertex_distance_tag(),sm); + + std::ifstream in("../data/pyramid0.off"); + in >> sm; + if(!in || num_vertices(sm) == 0) { + std::cerr << "Problem loading the input data" << std::endl; + return 1; + } + IDT im(sm, vertex_distance_map); + + std::cout<<"success \n"; + return 0; + +}