1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
// Copyright (c) 2006 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// 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: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.2-branch/Surface_mesher/include/CGAL/make_surface_mesh.h $
// $Revision: 30642 $ $Date: 2006-04-18 14:42:52 +0200 (Tue, 18 Apr 2006) $
//
// Author(s) : Laurent Rineau
#ifndef CGAL_MAKE_SURFACE_MESH_H
#define CGAL_MAKE_SURFACE_MESH_H
#include <CGAL/Surface_mesher/Surface_mesher.h>
#include <CGAL/Surface_mesher/Surface_mesher_manifold.h>
#include <CGAL/Surface_mesh_traits_generator_3.h>
#include <CGAL/Surface_mesh_cell_base_3.h>
#include <CGAL/Surface_mesh_vertex_base_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Surface_mesh_complex_2_in_triangulation_3.h>
#include <CGAL/Surface_mesh_default_criteria_3.h>
#include <CGAL/iterator.h> // CGAL::inserter()
namespace CGAL {
struct Non_manifold_tag {};
struct Manifold_tag {};
struct Manifold_with_boundary_tag {};
template <
typename C2T3,
typename SurfaceMeshTraits_3,
typename Criteria,
typename Tag // generic version: generates a compile time error
>
struct Make_surface_mesh_helper {
template <typename T>
struct Tag_does_not_exist_error {};
typedef Tag_does_not_exist_error<Tag> Mesher_base;
};
template <
typename C2T3,
typename SurfaceMeshTraits_3,
typename Criteria
>
struct Make_surface_mesh_helper<
C2T3,
SurfaceMeshTraits_3,
Criteria,
Non_manifold_tag> // Non_manifold_tag partial specialization
{
typedef Surface_mesher::Surface_mesher_base<
C2T3,
typename SurfaceMeshTraits_3::Surface_3,
SurfaceMeshTraits_3,
Criteria> Mesher_base;
};
template <
typename C2T3,
typename SurfaceMeshTraits_3,
typename Criteria
>
struct Make_surface_mesh_helper<
C2T3,
SurfaceMeshTraits_3,
Criteria,
Manifold_with_boundary_tag> // Manifold_with_boundary_tag partial
// specialization
{
typedef Surface_mesher::Surface_mesher_regular_edges_base<
C2T3,
typename SurfaceMeshTraits_3::Surface_3,
SurfaceMeshTraits_3,
Criteria,
true> /* true means "with boundary"*/ Regular_edge_base;
typedef Surface_mesher::Surface_mesher_manifold_base<
C2T3,
typename SurfaceMeshTraits_3::Surface_3,
SurfaceMeshTraits_3,
Criteria,
Regular_edge_base
> Mesher_base;
};
template <
typename C2T3,
typename SurfaceMeshTraits_3,
typename Criteria
>
struct Make_surface_mesh_helper<
C2T3,
SurfaceMeshTraits_3,
Criteria,
Manifold_tag> // Manifold_tag partial specialization
{
typedef Surface_mesher::Surface_mesher_regular_edges_base<
C2T3,
typename SurfaceMeshTraits_3::Surface_3,
SurfaceMeshTraits_3,
Criteria> Regular_edge_without_boundary_base;
typedef Surface_mesher::Surface_mesher_manifold_base<
C2T3,
typename SurfaceMeshTraits_3::Surface_3,
SurfaceMeshTraits_3,
Criteria,
Regular_edge_without_boundary_base
> Mesher_base;
};
template <typename C2T3,
typename Surface,
typename Criteria,
typename Tag>
void make_surface_mesh(C2T3& c2t3,
Surface surface,
Criteria criteria,
Tag tag,
int initial_number_of_points = 20) // TODO: document
// this parameter
{
typedef typename Surface_mesh_traits_generator_3<Surface>::type Traits;
make_surface_mesh(c2t3, surface, Traits(), criteria, tag,
initial_number_of_points);
}
template <typename C2T3,
typename SurfaceMeshTraits_3,
typename Criteria,
typename Tag>
void make_surface_mesh(C2T3& c2t3,
typename SurfaceMeshTraits_3::Surface_3 surface,
SurfaceMeshTraits_3 surface_mesh_traits,
Criteria criteria,
Tag,
int initial_number_of_points = 20)
{
typedef typename Make_surface_mesh_helper<
C2T3,
SurfaceMeshTraits_3,
Criteria,
Tag>::Mesher_base Mesher_base;
#ifdef CGAL_SURFACE_MESHER_VERBOSE
typedef Surface_mesher::Surface_mesher<
Mesher_base,
Surface_mesher::VERBOSE> Mesher;
#else
typedef Surface_mesher::Surface_mesher<Mesher_base> Mesher;
#endif
typename SurfaceMeshTraits_3::Construct_initial_points get_initial_points =
surface_mesh_traits.construct_initial_points_object();
get_initial_points(surface,
CGAL::inserter(c2t3.triangulation()),
initial_number_of_points);
Mesher mesher(c2t3, surface, surface_mesh_traits, criteria);
mesher.refine_mesh();
// TODO initial, then refine()
}
} // end namespace CGAL
#endif // CGAL_MAKE_SURFACE_MESH_H
|