From 2074d71cb836e4cdc738d41ea88ae549e6ca8410 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 4 Sep 2018 13:36:55 +0200 Subject: [PATCH] Start cleanup --- ...eatMethodTraits.h => HeatMethodTraits_3.h} | 4 +- .../doc/Heat_method_3/PackageDescription.txt | 9 +- .../heat_method_surface_mesh_intrinsic.cpp | 2 +- .../CGAL/Heat_method_3/Heat_method_3.h | 15 +- .../include/CGAL/Heat_method_3/IDT.h | 719 ------------------ .../Intrinsic_Delaunay_Triangulation_3.h | 53 +- ...eat_method_intrinsic_surface_mesh_test.cpp | 2 +- .../intrinsic_delaunay_triangulation_test.cpp | 2 +- .../Display/Display_property_plugin.cpp | 2 +- 9 files changed, 52 insertions(+), 756 deletions(-) rename Heat_method_3/doc/Heat_method_3/Concepts/{HeatMethodTraits.h => HeatMethodTraits_3.h} (78%) delete mode 100644 Heat_method_3/include/CGAL/Heat_method_3/IDT.h diff --git a/Heat_method_3/doc/Heat_method_3/Concepts/HeatMethodTraits.h b/Heat_method_3/doc/Heat_method_3/Concepts/HeatMethodTraits_3.h similarity index 78% rename from Heat_method_3/doc/Heat_method_3/Concepts/HeatMethodTraits.h rename to Heat_method_3/doc/Heat_method_3/Concepts/HeatMethodTraits_3.h index 871557c374d..9d2699c9e24 100644 --- a/Heat_method_3/doc/Heat_method_3/Concepts/HeatMethodTraits.h +++ b/Heat_method_3/doc/Heat_method_3/Concepts/HeatMethodTraits_3.h @@ -3,14 +3,14 @@ \cgalConcept -The concept `HeatMethodTraits` describes the types, +The concept `HeatMethodTraits_3` describes the types, predicates, and constructions required by the traits class parameter of `CGAL::Heat_method_3`. */ -class HeatMethodTraits +class HeatMethodTraits_3 { public: diff --git a/Heat_method_3/doc/Heat_method_3/PackageDescription.txt b/Heat_method_3/doc/Heat_method_3/PackageDescription.txt index a862ad046e1..cdceab902df 100644 --- a/Heat_method_3/doc/Heat_method_3/PackageDescription.txt +++ b/Heat_method_3/doc/Heat_method_3/PackageDescription.txt @@ -22,7 +22,7 @@ \cgalPkgSummaryBegin \cgalPkgAuthors{Keenan Crane, Christina Vaz, Andreas Fabri} -\cgalPkgDesc{The package provides the Heat Method, a geodesic distance algorithm, and an Intrinsic Delaunay remeshing algorithm to be run on Triangle Meshes. } +\cgalPkgDesc{The package provides the Heat Method, a geodesic distance algorithm, and an Intrinsic Delaunay remeshing algorithm to be run on triangle meshes. } \cgalPkgManuals{Chapter_HeatMethod,PkgHeatMethod} \cgalPkgSummaryEnd \cgalPkgShortInfoBegin @@ -38,13 +38,16 @@ \cgalClassifedRefPages ## Concepts ## -- `HeatMethodTraits` +- `HeatMethodTraits_3` ## Classes ## - `CGAL::Heat_method_3::Heat_method_3` +- `CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3` +## Functions ## - +- `CGAL::Heat_method_3::compute_distances_with_heat_method()` +- `CGAL::Heat_method_3::compute_distances_with_intrinsic_delaunay_heat_method()` */ \todo Add more detailed cache diff --git a/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh_intrinsic.cpp b/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh_intrinsic.cpp index dedc19003c8..ee38014c150 100644 --- a/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh_intrinsic.cpp +++ b/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh_intrinsic.cpp @@ -16,7 +16,7 @@ typedef CGAL::Surface_mesh Surface_mesh; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; typedef Surface_mesh::Property_map Vertex_distance_map; -typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 Idt; +typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 Idt; typedef CGAL::Heat_method_3::Heat_method_3 Heat_method_idt; diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Heat_method_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Heat_method_3.h index b5e2a4ae052..5589bb1061d 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Heat_method_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Heat_method_3.h @@ -69,7 +69,7 @@ namespace CGAL { * \tparam VertexPointMap a model of `ReadablePropertyMap` with * `boost::graph_traits::%vertex_descriptor` as key and * `Traits::Point_3` as value type. - * The default is `typename boost::property_map< TriangleMesh, vertex_point_t>::%type`. + * The default is `typename boost::property_map::%type`. * */ template bool remove_source(VD vd) @@ -192,7 +192,7 @@ namespace CGAL { /** - * clears the current source sets + * clears the current source set */ void clear_sources() { @@ -625,7 +625,7 @@ namespace CGAL { * @{ */ - /// \relates Heat_method_3 + /// \relates CGAL::Heat_method_3::Heat_method_3 /// computes ... template void compute_distances_with_heat_method(const TriangleMesh& tm, @@ -643,7 +643,7 @@ namespace CGAL { } - /// \relates Heat_method_3 + /// \relates CGAL::Heat_method_3::Heat_method_3 /// computes ... template void compute_distances_with_intrinsic_delaunay_heat_method(const TriangleMesh& tm, @@ -653,7 +653,7 @@ namespace CGAL { typedef typename boost::property_map::type PPM; typedef typename boost::property_traits::value_type Point_3; typedef typename CGAL::Kernel_traits::Kernel Kernel; - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 Idt; + typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 Idt; typedef CGAL::Heat_method_3::Heat_method_3 Heat_method; Idt idt(tm, vdm); @@ -667,5 +667,6 @@ namespace CGAL { } // namespace Heat_method_3 } // namespace CGAL + #include #endif // CGAL_HEAT_METHOD_3_HEAT_METHOD_3_H diff --git a/Heat_method_3/include/CGAL/Heat_method_3/IDT.h b/Heat_method_3/include/CGAL/Heat_method_3/IDT.h deleted file mode 100644 index df982384e6c..00000000000 --- a/Heat_method_3/include/CGAL/Heat_method_3/IDT.h +++ /dev/null @@ -1,719 +0,0 @@ -// Copyright (c) 2018 Carnegie Mellon University (USA), GeometryFactory (France) -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0+ -// -// -// Author(s) : Christina Vaz, Keenan Crane, Andreas Fabri - - -#ifndef CGAL_INTRINSIC_DELAUNAY_TRIANGULATION_3_H -#define CGAL_INTRINSIC_DELAUNAY_TRIANGULATION_3_H - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - - - -namespace CGAL { -namespace Intrinsic_Delaunay_Triangulation_3 { - - struct Intrinsic_Delaunay_Triangulation_Eigen_traits_3 { - typedef Eigen::SparseMatrix SparseMatrix; - typedef Eigen::Triplet T; - typedef int Index; - }; - - - template - struct IDT_vertex_point_property_map; - - - /** - * Class `Intrinsic_Delaunay_Triangulation_3` is a ... - * \tparam TriangleMesh a triangulated surface mesh, model of `FaceGraph` and `HalfedgeListGraph` - * \tparam Traits a model of IntrinsicDelaunayTriangulation_3 - * \tparam VertexPointMap a model of `ReadablePropertyMap` with - * `boost::graph_traits::%vertex_descriptor` as key and - * `Traits::Point_3` as value type. - * The default is `typename boost::property_map< TriangleMesh, vertex_point_t>::%type`. - * - */ - - template ::const_type, - typename FaceIndexMap = typename boost::property_map< TriangleMesh, face_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> - class Intrinsic_Delaunay_Triangulation_3 - { - typedef Intrinsic_Delaunay_Triangulation_3 Self; - - typedef typename boost::graph_traits graph_traits; - typedef typename graph_traits::vertex_descriptor vertex_descriptor; - typedef typename graph_traits::edge_descriptor edge_descriptor; - 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; - typedef typename Traits::Vector_3 Vector_3; - - typedef typename Traits::Point_2 Point_2; - - typedef typename LA::SparseMatrix Matrix; - typedef typename LA::Index Index; - - typedef typename boost::property_traits::reference VertexPointMap_reference; - - typedef typename boost::graph_traits::vertices_size_type vertices_size_type; - - typedef CGAL::dynamic_vertex_property_t Vertex_property_tag; - typedef typename boost::property_map::type Vertex_id_map; - Vertex_id_map vertex_id_map; - - typedef CGAL::dynamic_face_property_t Face_property_tag; - typedef typename boost::property_map::type Face_id_map; - Face_id_map face_id_map; - - typedef CGAL::dynamic_edge_property_t Edge_property_tag; - typedef typename boost::property_map::type Edge_id_map; - Edge_id_map edge_id_map; - typedef typename std::stack > edge_stack; - - friend struct IDT_vertex_point_property_map; - - - public: // for the BGL functions below. They should maybe become friend? - struct Vertex_descriptor { - halfedge_descriptor hd; - - Vertex_descriptor(const halfedge_descriptor& hd) - : hd(hd) - {} - }; - - public: - Intrinsic_Delaunay_Triangulation_3(TriangleMesh& tm, HalfedgeCoordinateMap hcm) - : tm(tm), hcm(hcm) - { - build(); - } - - - - Intrinsic_Delaunay_Triangulation_3(TriangleMesh& tm, HalfedgeCoordinateMap hcm, FaceIndexMap fpm, EdgeIndexMap epm) - : tm(tm), hcm(hcm), fpm(fpm), epm(epm) - { - build(); - } - - - typedef TriangleMesh Triangle_mesh; - - const Triangle_mesh& triangle_mesh() const - { - return tm; - } - - Triangle_mesh& triangle_mesh() - { - return tm; - } - - const HalfedgeCoordinateMap& hcmap() const - { - return hcm; - } - - double get_cotan_weight(edge_descriptor ed) - { - double cotan_weight = 0; - halfedge_descriptor hd = halfedge(ed, tm); - halfedge_descriptor hd2 = next(hd,tm); - halfedge_descriptor hd3 = next(hd2,tm); - Index a_i = get(edge_id_map, ed); - Index b_i = get(edge_id_map, edge(hd2,tm)); - Index c_i = get(edge_id_map, edge(hd3,tm)); - double a = edge_lengths(a_i,0) + 0.0; - double b = edge_lengths(b_i,0) + 0.0; - double c = edge_lengths(c_i,0) + 0.0; - - double tan2 = CGAL::sqrt(CGAL::abs(((a-b+c)*(a+b-c))/((a+b+c)*(-a+b+c)))); - cotan_weight+=(1-(tan2*tan2))/(2*tan2); - - hd = opposite(hd,tm); - hd2 =next(hd,tm); - hd3 = next(hd2,tm); - b_i = get(edge_id_map, edge(hd2,tm)); - c_i = get(edge_id_map, edge(hd3,tm)); - b = edge_lengths(b_i,0) + 0.0; - c = edge_lengths(c_i,0) + 0.0; - tan2 = CGAL::sqrt(CGAL::abs(((a-b+c)*(a+b-c))/((a+b+c)*(-a+b+c)))); - cotan_weight+=(1-(tan2*tan2))/(2*tan2); - return cotan_weight; - } - - //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 checks cotan weights - if(get_cotan_weight(ed)>=0) - { - return true; - } - else - { - return false; - } - } - - void change_edge_length(Index i, edge_descriptor ed) - { - halfedge_descriptor hd = halfedge(ed,tm); - halfedge_descriptor hd2 = next(hd,tm); - halfedge_descriptor hd3 = next(hd2,tm); - Index b_i = get(edge_id_map, edge(hd2,tm)); - Index c_i = get(edge_id_map, edge(hd3,tm)); - double a = edge_lengths(i,0); - double b1 = edge_lengths(b_i,0); - double c1 = edge_lengths(c_i,0); - double tan2a = CGAL::sqrt(CGAL::abs(((c1-a+b1)*(-b1+a+c1))/((a+b1+c1)*(b1+a-c1)))); - hd = opposite(hd,tm); - hd2 =next(hd,tm); - hd3 = next(hd2,tm); - b_i = get(edge_id_map, edge(hd2,tm)); - c_i = get(edge_id_map, edge(hd3,tm)); - double b2 = edge_lengths(b_i,0); - double c2 = edge_lengths(c_i,0); - double tan2d = CGAL::sqrt(CGAL::abs(((-a+b2+c2)*(a+b2-c2))/((a+b2+c2)*(a-b2+c2)))); - double tan2ad = (tan2a + tan2d)/(1-tan2a*tan2d); - double cosad = (1-tan2ad*tan2ad)/(1+tan2ad*tan2ad); - double new_length = CGAL::sqrt( CGAL::abs(b1*b1 + c2*c2 - 2*b1*c2*cosad)); - edge_lengths(i,0) = new_length; - } - - - //Heron's formula - double face_area(double a, double b, double c) - { - double S = (a+b+c)/2; - return CGAL::sqrt(S*(S-a)*(S-b)*(S-c)); - } - - void loop_over_edges(edge_stack stack, Eigen::VectorXd marked_edges) - { - int a = 0; - while(!stack.empty()) - { - edge_descriptor ed = stack.top(); - stack.pop(); - - Index edge_i = get(edge_id_map,ed); - - marked_edges(edge_i,0)=0; - //if the edge itself is not locally delaunay, go back - if(!(is_edge_locally_delaunay(ed))) - { - if(!(is_border(ed,tm))) - { - a++; - change_edge_length(edge_i,ed); - halfedge_descriptor hd = (halfedge(ed, tm)); - CGAL::Euler::flip_edge(hd, tm); - edge_descriptor next_edge= edge(next(hd,tm),tm); - Index next_edge_i = get(edge_id_map, next_edge); - - //if edge was already checked, go back and check again - //for the 4 surrounding edges, since local 'geometry' changed, - if(!(marked_edges(next_edge_i,0))) - { - stack.push(next_edge); - marked_edges(next_edge_i,0) = 1; - } - next_edge = edge(prev(hd,tm),tm); - next_edge_i = get(edge_id_map,next_edge); - if(!(marked_edges(next_edge_i,0))) - { - stack.push(next_edge); - marked_edges(next_edge_i,0) = 1; - } - next_edge = edge(next(opposite(hd,tm),tm),tm); - next_edge_i = get(edge_id_map,next_edge); - if(!(marked_edges(next_edge_i,0))) - { - stack.push(next_edge); - marked_edges(next_edge_i,0) = 1; - } - next_edge = edge(prev(opposite(hd,tm),tm),tm); - next_edge_i = get(edge_id_map,next_edge); - if(!(marked_edges(next_edge_i,0))) - { - stack.push(next_edge); - marked_edges(next_edge_i,0) = 1; - } - } - //then go back to top of the stack - } - } - std::cout<<"this many edges were flipped: "<< a <<"\n"; - } - - private: - - void build() - { - CGAL_precondition(is_triangle_mesh(tm)); - vertex_id_map = get(Vertex_property_tag(),const_cast(tm)); - Index i = 0; - BOOST_FOREACH(vertex_descriptor vd, vertices(tm)){ - put(vertex_id_map, vd, i++); - } - face_id_map = get(Face_property_tag(), const_cast(tm)); - Index face_i = 0; - BOOST_FOREACH(face_descriptor fd, faces(tm)){ - put(face_id_map, fd, face_i++); - } - edge_stack stack; - edge_lengths.resize(number_of_edges, 1); - mark_edges.resize(number_of_edges, 1); - edge_id_map = get(Edge_property_tag(), const_cast(tm)); - Index edge_i = 0; - BOOST_FOREACH(edge_descriptor ed, edges(tm)){ - mark_edges(edge_i,0)=1; - edge_lengths(edge_i,0) = Polygon_mesh_processing::edge_length(halfedge(ed,tm),tm); - put(edge_id_map, ed, edge_i++); - stack.push(ed); - } - loop_over_edges(stack, mark_edges); - //now that edges are calculated, go through and for each face, calculate the vertex positions around it - - BOOST_FOREACH(face_descriptor f, faces(tm)) - { - CGAL::Vertex_around_face_iterator vbegin, vend, vmiddle; - Index face_i = get(face_id_map, f); - - boost::tie(vbegin, vend) = vertices_around_face(halfedge(f,tm),tm); - halfedge_descriptor hd = halfedge(f,tm); - if(face(hd,tm) != f) - { - hd = opposite(hd,tm); - } - hd = next(hd,tm); - //each 'local' set of coordinates will have 0,0 at the first vertex/halfedge - Point_2 p11(0,0); - put(hcm, hd,p11); - edge_descriptor ed1 = edge(hd, tm); - hd = next(hd,tm); - //the second local coordinate will be edge_length(first edge),0 - Point_2 p21(edge_lengths(get(edge_id_map,ed1),0),0); - put(hcm,hd,p21); - - - //use basic trigonometry to compute third coordinate - edge_descriptor ed2 = edge(hd, tm); - hd = next(hd,tm); - edge_descriptor ed3 = edge(hd, tm); - Index e1 = get(edge_id_map, ed1); - Index e2 = get(edge_id_map, ed2); - Index e3 = get(edge_id_map, ed3); - double e1_len = edge_lengths(e1,0); - double e2_len = edge_lengths(e2,0); - double e3_len = edge_lengths(e3,0); - double angle_a = -(e2_len*e2_len) + e3_len*e3_len + e1_len*e1_len; - angle_a = angle_a/(2*e3_len*e1_len); - Point_2 p31(e3_len*std::cos(angle_a), e3_len*std::sin(angle_a)); - put(hcm,hd,p31); - - } - } - //todo:: determine which can be const - TriangleMesh& tm; - VertexPointMap vpm; - FaceIndexMap fpm; - EdgeIndexMap epm; - HalfedgeCoordinateMap hcm; - int number_of_edges = num_edges(tm); - int number_of_faces = num_faces(tm); - Eigen::VectorXd edge_lengths; - Eigen::VectorXd mark_edges; - }; - -} // namespace Intrinsic_Delaunay_Triangulation_3 -} // namespace CGAL - -namespace boost { - -template -struct graph_traits > { - - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 Mesh; - typedef typename Mesh::Vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - typedef typename boost::graph_traits::halfedge_iterator halfedge_iterator; - typedef typename boost::graph_traits::edge_descriptor edge_descriptor; - typedef typename boost::graph_traits::edge_iterator edge_iterator; - typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename boost::graph_traits::face_iterator face_iterator; - - typedef typename boost::graph_traits::vertices_size_type vertices_size_type; -}; - -} // namespace boost - - -namespace CGAL { -namespace Intrinsic_Delaunay_Triangulation_3 { - -template -typename boost::graph_traits::vertices_size_type -num_vertices(const Intrinsic_Delaunay_Triangulation_3& idt) -{ - return num_vertices(idt.triangle_mesh()); -} - -template -typename std::pair::vertex_iterator, - typename boost::graph_traits::vertex_iterator> -vertices(const Intrinsic_Delaunay_Triangulation_3& idt) - { - return vertices(idt.triangle_mesh()); - } - -template -typename std::pair::halfedge_iterator, - typename boost::graph_traits::halfedge_iterator> -halfedges(const Intrinsic_Delaunay_Triangulation_3& idt) - { - return halfedges(idt.triangle_mesh()); - } - - -template -typename std::pair::edge_iterator, - typename boost::graph_traits::edge_iterator> -edges(const Intrinsic_Delaunay_Triangulation_3& idt) - { - return edges(idt.triangle_mesh()); - } - - -template -typename boost::graph_traits >::vertex_descriptor -vertex(typename boost::graph_traits >::halfedge_descriptor hd, - const Intrinsic_Delaunay_Triangulation_3& ) -{ - return boost::graph_traits >::vertex_descriptor(hd); -} - - -template -typename boost::graph_traits >::halfedge_descriptor -halfedge(typename boost::graph_traits >::face_descriptor fd, - const Intrinsic_Delaunay_Triangulation_3& idt) -{ - return halfedge(fd, idt.triangle_mesh()); -} - - -template -typename boost::graph_traits >::halfedge_descriptor -next(typename boost::graph_traits >::halfedge_descriptor hd, - const Intrinsic_Delaunay_Triangulation_3& idt) -{ - return next(hd, idt.triangle_mesh()); -} - - - template - struct IDT_vertex_point_property_map { - const IDT& idt; - typedef typename IDT::Triangle_mesh TM; - typedef typename boost::graph_traits::vertex_descriptor key_type; - typedef typename IDT::Point_3 value_type; - typedef value_type reference; - - IDT_vertex_point_property_map(const IDT& idt) - : idt(idt) - {} - - friend value_type get(const IDT_vertex_point_property_map& pm, - key_type vd) - { - typename IDT::Point_2 p = get(pm.idt.hcmap(), vd.hd); - return value_type(p.x(), p.y(), 0); - } - }; - - - template - struct IDT_vertex_index_property_map { - const IDT& idt; - typedef typename IDT::Triangle_mesh TM; - typedef typename boost::graph_traits::vertex_descriptor key_type; - typedef typename boost::graph_traits::vertices_size_type value_type; - typedef value_type reference; - - IDT_vertex_index_property_map(const IDT& idt) - : idt(idt) - {} - - friend value_type get(const IDT_vertex_index_property_map& pm, - key_type vd) - { - typename TM::vertex_descriptor tm_vd = target(vd.hd,pm.idt.triangle_mesh()); - - return 0;// AF todo: return the index of tm_vd - } - }; - -} // namespace Intrinsic_Delaunay_Triangulation_3 -} // namespace CGAL - -namespace boost { - -template - struct property_map, - CGAL::vertex_point_t > { - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 IDT; - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_point_property_map type; - typedef type const_type; - }; - -template -CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_point_property_map > -get(CGAL::vertex_point_t, - const CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3& idt) -{ - return CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_point_property_map >(idt); -} - - -template -CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_index_property_map > -get(boost::vertex_index_t, - const CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3& idt) -{ - return CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_index_property_map >(idt); -} - -} // boost - -namespace CGAL { namespace Intrinsic_Delaunay_Triangulation_3 { - -template -class IDT_dynamic_vertex_property_map { - const IDT& idt; - PM pm; -public: - typedef IDT_dynamic_vertex_property_map Self; - typedef typename IDT::Triangle_mesh TM; - typedef typename boost::graph_traits::vertex_descriptor TM_vertex_descriptor; - - IDT_dynamic_vertex_property_map(const IDT& idt, PM pm) - : idt(idt), pm(pm) - {} - - friend V get(const Self& idpm, const K&k) - { - std::cout << "get" << std::endl; - return get(idpm.pm, target(k.hd, idt.triangle_mesh())); - } - - friend void put(const Self& idpm, const K&k, const V& v) - { - std::cout << "put" << std::endl; - put(idpm.pm, target(k.hd, idt.triangle_mesh(), v); - } -}; - - } -} - -namespace boost { - -template - struct property_map, - CGAL::dynamic_vertex_property_t
> { - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 IDT; - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_dynamic_vertex_property_map >::type, - typename boost::graph_traits::vertex_descriptor, - dT> type; - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_dynamic_vertex_property_map >::const_type, - typename boost::graph_traits::vertex_descriptor, - dT> const_type; - }; - -} // namespace boost - - -namespace CGAL { - -template -typename boost::property_map, CGAL::dynamic_vertex_property_t
>::const_type -get(CGAL::dynamic_vertex_property_t
dvp, - const CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3& idt) -{ - typedef IDT_dynamic_vertex_property_map >::const_type, - typename boost::graph_traits::vertex_descriptor, - dT> PM; - return PM(idt,get(dvp,idt.triangle_mesh())); -} - -template -typename boost::property_map, CGAL::dynamic_vertex_property_t
>::type -get(CGAL::dynamic_vertex_property_t
dvp, - CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3& idt) -{ - typedef IDT_dynamic_vertex_property_map >::const_type, - typename boost::graph_traits::vertex_descriptor, - dT> PM; - - return PM(idt, get(dvp,idt.triangle_mesh())); -} - - -} // namespace CGAL - -#include -#endif // CGAL_HEAT_METHOD_3_HEAT_METHOD_3_H 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 eb7721ca058..7a45d7e0cb2 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 @@ -54,7 +54,7 @@ namespace CGAL { -namespace Intrinsic_Delaunay_Triangulation_3 { +namespace Heat_method_3 { struct Intrinsic_Delaunay_Triangulation_Eigen_traits_3 { typedef Eigen::SparseMatrix SparseMatrix; @@ -62,6 +62,8 @@ namespace Intrinsic_Delaunay_Triangulation_3 { typedef int Index; }; +#ifndef DOXYGEN_RUNNING + // forward declaration template struct IDT_vertex_point_property_map; @@ -70,6 +72,8 @@ namespace Intrinsic_Delaunay_Triangulation_3 { template struct IDT_vertex_distance_property_map; +#endif + /** * Class `Intrinsic_Delaunay_Triangulation_3` is a remeshing algorithm implemented to make the Heat method's approximation better. * \tparam TriangleMesh a triangulated surface mesh, model of `FaceGraph` and `HalfedgeListGraph` @@ -412,7 +416,7 @@ namespace Intrinsic_Delaunay_Triangulation_3 { boost::unordered_map v2v, vtov; }; -} // namespace Intrinsic_Delaunay_Triangulation_3 +} // namespace Heat_method_3 namespace Heat_method_3 { @@ -421,9 +425,9 @@ template -struct V2V > +struct V2V > { - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 Idt; + typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 Idt; const Idt& idt; /** * Vertex descriptor for iDT @@ -461,9 +465,9 @@ template -struct graph_traits > { +struct graph_traits > { - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 Mesh; + typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 Mesh; typedef typename Mesh::Vertex_descriptor vertex_descriptor; typedef boost::transform_iterator< typename Mesh::Vertex_iterator_functor, @@ -679,6 +683,8 @@ target(typename boost::graph_traits struct IDT_vertex_point_property_map { const IDT& idt; @@ -760,6 +766,7 @@ target(typename boost::graph_traits - struct property_map, + struct property_map, CGAL::vertex_point_t > { - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 IDT; - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_point_property_map type; + typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 IDT; + typedef CGAL::Heat_method_3::IDT_vertex_point_property_map type; typedef type const_type; }; @@ -783,11 +790,11 @@ template -CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_point_property_map > +CGAL::Heat_method_3::IDT_vertex_point_property_map > get(CGAL::vertex_point_t, - const CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3& idt) + const CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3& idt) { - return CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_point_property_map >(idt); + return CGAL::Heat_method_3::IDT_vertex_point_property_map >(idt); } @@ -796,9 +803,9 @@ template - struct property_map, + struct property_map, CGAL::face_index_t > { - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 IDT; + typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 IDT; typedef typename property_map::type type; typedef typename property_map::const_type const_type; }; @@ -810,7 +817,7 @@ template typename property_map::type get(CGAL::face_index_t fi, - const CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3& idt) + const CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3& idt) { return get(fi, idt.triangle_mesh()); } @@ -825,15 +832,17 @@ template typename property_map::type get(boost::vertex_index_t vi, - const CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3& idt) + const CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3& idt) { - return CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_vertex_index_property_map, VPM >(idt, get(vi, idt.triangle_mesh())); + return CGAL::Heat_method_3::IDT_vertex_index_property_map, VPM >(idt, get(vi, idt.triangle_mesh())); } } // boost namespace CGAL { namespace Intrinsic_Delaunay_Triangulation_3 { + +#ifndef DOXYGEN_RUNNING template class IDT_dynamic_vertex_property_map { const IDT& idt; @@ -869,6 +878,8 @@ public: } }; + +#endif // DOXYGEN_RUNNING } } @@ -880,9 +891,9 @@ template - struct property_map, + struct property_map, CGAL::dynamic_vertex_property_t
> { - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 IDT; + typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 IDT; typedef CGAL::Intrinsic_Delaunay_Triangulation_3::IDT_dynamic_vertex_property_map >::type, typename graph_traits::vertex_descriptor, @@ -897,7 +908,7 @@ template dvp, } // namespace CGAL #include -#endif // CGAL_HEAT_METHOD_3_HEAT_METHOD_3_H +#endif // CGAL_INTRINSIC_DELAUNAY_TRIANGULATION_3_H diff --git a/Heat_method_3/test/Heat_method_3/heat_method_intrinsic_surface_mesh_test.cpp b/Heat_method_3/test/Heat_method_3/heat_method_intrinsic_surface_mesh_test.cpp index 5e80773568e..436e78f5d99 100644 --- a/Heat_method_3/test/Heat_method_3/heat_method_intrinsic_surface_mesh_test.cpp +++ b/Heat_method_3/test/Heat_method_3/heat_method_intrinsic_surface_mesh_test.cpp @@ -23,7 +23,7 @@ typedef CGAL::Surface_mesh Surface_mesh; typedef CGAL::dynamic_vertex_property_t Vertex_distance_tag; typedef boost::property_map::type Vertex_distance_map; -typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 Idt; +typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 Idt; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; 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 index 9b66ae357e4..37ced77cb81 100644 --- 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 @@ -25,7 +25,7 @@ typedef boost::graph_traits::vertex_descriptor vertex_descriptor; typedef CGAL::dynamic_halfedge_property_t Halfedge_coordinate_tag; typedef boost::property_map::type Halfedge_coordinate_map; -typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 IDT; +typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 IDT; void bglstyle(const IDT& idt) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp index 884280da206..0bfe19a608f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp @@ -312,7 +312,7 @@ class DisplayPropertyPlugin : typedef SMesh::Property_map::vertex_descriptor, double> Vertex_distance_map; typedef CGAL::Heat_method_3::Heat_method_3 Heat_method; - typedef CGAL::Intrinsic_Delaunay_Triangulation_3::Intrinsic_Delaunay_Triangulation_3 Idt; + typedef CGAL::Heat_method_3::Intrinsic_Delaunay_Triangulation_3 Idt; typedef CGAL::Heat_method_3::Heat_method_3 Heat_method_idt; public: