mirror of https://github.com/CGAL/cgal
build test and fixes
This commit is contained in:
parent
202f6a2edf
commit
41cd319487
|
|
@ -39,6 +39,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <CGAL/squared_distance_3.h>
|
#include <CGAL/squared_distance_3.h>
|
||||||
#include <CGAL/number_utils.h>
|
#include <CGAL/number_utils.h>
|
||||||
|
#include <stack>
|
||||||
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
namespace Intrinsic_Delaunay_Triangulation_3 {
|
namespace Intrinsic_Delaunay_Triangulation_3 {
|
||||||
|
|
@ -62,12 +64,11 @@ namespace Intrinsic_Delaunay_Triangulation_3 {
|
||||||
*/
|
*/
|
||||||
template <typename TriangleMesh,
|
template <typename TriangleMesh,
|
||||||
typename Traits,
|
typename Traits,
|
||||||
typename EdgeLengthMap,
|
typename VertexDistanceMap,
|
||||||
typename FaceAreaMap,
|
|
||||||
typename VertexPointMap = typename boost::property_map< TriangleMesh, vertex_point_t>::const_type,
|
typename VertexPointMap = typename boost::property_map< TriangleMesh, vertex_point_t>::const_type,
|
||||||
typename FaceIndexMap = typename boost::property_map< TriangleMesh, face_index_t>::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 EdgeIndexMap = typename boost::property_map< TriangleMesh, boost::edge_index_t>::const_type,
|
||||||
typename LA = Intrinsic_Delaunay_Triangulation_Eigen_Traits_3>
|
typename LA = Intrinsic_Delaunay_Triangulation_Eigen_traits_3>
|
||||||
class Intrinsic_Delaunay_Triangulation_3
|
class Intrinsic_Delaunay_Triangulation_3
|
||||||
{
|
{
|
||||||
typedef typename boost::graph_traits<TriangleMesh> graph_traits;
|
typedef typename boost::graph_traits<TriangleMesh> graph_traits;
|
||||||
|
|
@ -76,6 +77,7 @@ namespace Intrinsic_Delaunay_Triangulation_3 {
|
||||||
typedef typename graph_traits::halfedge_descriptor halfedge_descriptor;
|
typedef typename graph_traits::halfedge_descriptor halfedge_descriptor;
|
||||||
typedef typename graph_traits::face_descriptor face_descriptor;
|
typedef typename graph_traits::face_descriptor face_descriptor;
|
||||||
typedef typename std::set<vertex_descriptor>::iterator vertex_iterator;
|
typedef typename std::set<vertex_descriptor>::iterator vertex_iterator;
|
||||||
|
typedef typename std::set<edge_descriptor>::iterator edge_iterator;
|
||||||
/// Geometric typedefs
|
/// Geometric typedefs
|
||||||
typedef typename Traits::Point_3 Point_3;
|
typedef typename Traits::Point_3 Point_3;
|
||||||
typedef typename Traits::FT FT;
|
typedef typename Traits::FT FT;
|
||||||
|
|
@ -102,14 +104,33 @@ namespace Intrinsic_Delaunay_Triangulation_3 {
|
||||||
typedef typename boost::property_map<TriangleMesh, Edge_property_tag >::type Edge_id_map;
|
typedef typename boost::property_map<TriangleMesh, Edge_property_tag >::type Edge_id_map;
|
||||||
Edge_id_map edge_id_map;
|
Edge_id_map edge_id_map;
|
||||||
|
|
||||||
|
std::stack<edge_iterator, std::list<edge_iterator> > stack;
|
||||||
|
|
||||||
public:
|
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)
|
//return true if edge is locally delaunay (opposing angles are less than pi)
|
||||||
bool is_edge_locally_delaunay(edge_descriptor ed)
|
bool is_edge_locally_delaunay(edge_descriptor ed)
|
||||||
{
|
{
|
||||||
//two ways of doing this: taking angles directly (not good with virtual edges)
|
//two ways of doing this: taking angles directly (not good with virtual edges)
|
||||||
//OR: taking edge length and using law of cosines
|
//OR: taking edge length and using law of cosines
|
||||||
//the second way also finds cotan weights which can be used to populate c
|
//the second way also finds cotan weights which can be used to populate c
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,7 +143,7 @@ namespace Intrinsic_Delaunay_Triangulation_3 {
|
||||||
//Heron's formula
|
//Heron's formula
|
||||||
double face_area(double a, double b, double c)
|
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));
|
return CGAL::sqrt(S*(S-a)*(S-b)*(S-c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,6 +176,7 @@ namespace Intrinsic_Delaunay_Triangulation_3 {
|
||||||
VertexPointMap vpm;
|
VertexPointMap vpm;
|
||||||
FaceIndexMap fpm;
|
FaceIndexMap fpm;
|
||||||
EdgeIndexMap epm;
|
EdgeIndexMap epm;
|
||||||
|
VertexDistanceMap vdm;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,5 +52,4 @@ include_directories( BEFORE include )
|
||||||
include( CGAL_CreateSingleSourceCGALProgram )
|
include( CGAL_CreateSingleSourceCGALProgram )
|
||||||
|
|
||||||
create_single_source_cgal_program( "heat_method_surface_mesh_test.cpp" )
|
create_single_source_cgal_program( "heat_method_surface_mesh_test.cpp" )
|
||||||
|
create_single_source_cgal_program( "intrinsic_delaunay_triangulation_test.cpp" )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
#include <CGAL/Simple_cartesian.h>
|
||||||
|
#include <CGAL/Surface_mesh.h>
|
||||||
|
#include <CGAL/Polyhedron_3.h>
|
||||||
|
#include <CGAL/Dynamic_property_map.h>
|
||||||
|
#include <CGAL/Heat_method_3/Intrinsic_Delaunay_Triangulation_3.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <cassert>
|
||||||
|
#include <Eigen/Sparse>
|
||||||
|
#include <Eigen/Dense>
|
||||||
|
|
||||||
|
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||||
|
typedef Kernel::Point_3 Point;
|
||||||
|
typedef CGAL::Surface_mesh<Point> Mesh;
|
||||||
|
//typedef CGAL::Polyhedron_3<Kernel> Mesh;
|
||||||
|
|
||||||
|
typedef CGAL::dynamic_vertex_property_t<double> Vertex_distance_tag;
|
||||||
|
typedef boost::property_map<Mesh, Vertex_distance_tag >::type Vertex_distance_map;
|
||||||
|
|
||||||
|
typedef boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
|
||||||
|
typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3<Mesh,Kernel,Vertex_distance_map> 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;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue