cvMesh: Relocated the conformalVoronoiMesh library and localised all uses of CGAL

Removed unused dependencies on CGAL
This commit is contained in:
Henry
2011-07-22 14:12:08 +01:00
parent 8417b828d6
commit 5f9e3a04f0
71 changed files with 32 additions and 594 deletions

View File

@ -45,14 +45,6 @@ Description
#include "treeDataEdge.H"
#include "unitConversion.H"
#ifdef ENABLE_CURVATURE
#include "buildCGALPolyhedron.H"
#include "CGALPolyhedronRings.H"
#include <CGAL/Monge_via_jet_fitting.h>
#include <CGAL/Lapack/Linear_algebra_lapack.h>
#include <CGAL/property_map.h>
#endif
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -149,155 +141,6 @@ void drawHitProblem
}
#ifdef ENABLE_CURVATURE
scalarField calcCurvature(const triSurface& surf)
{
scalarField k(surf.points().size(), 0);
Polyhedron P;
buildCGALPolyhedron convert(surf);
P.delegate(convert);
// Info<< "Created CGAL Polyhedron with " << label(P.size_of_vertices())
// << " vertices and " << label(P.size_of_facets())
// << " facets. " << endl;
// The rest of this function adapted from
// CGAL-3.7/examples/Jet_fitting_3/Mesh_estimation.cpp
// Licensed under CGAL-3.7/LICENSE.FREE_USE
// Copyright (c) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
// Utrecht University (The Netherlands), ETH Zurich (Switzerland), Freie
// Universitaet Berlin (Germany), INRIA Sophia-Antipolis (France),
// Martin-Luther-University Halle-Wittenberg (Germany), Max-Planck-Institute
// Saarbruecken (Germany), RISC Linz (Austria), and Tel-Aviv University
// (Israel). All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
// THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//Vertex property map, with std::map
typedef std::map<Vertex*, int> Vertex2int_map_type;
typedef boost::associative_property_map< Vertex2int_map_type >
Vertex_PM_type;
typedef T_PolyhedralSurf_rings<Polyhedron, Vertex_PM_type > Poly_rings;
typedef CGAL::Monge_via_jet_fitting<Kernel> Monge_via_jet_fitting;
typedef Monge_via_jet_fitting::Monge_form Monge_form;
std::vector<Point_3> in_points; //container for data points
// default parameter values and global variables
unsigned int d_fitting = 2;
unsigned int d_monge = 2;
unsigned int min_nb_points = (d_fitting + 1)*(d_fitting + 2)/2;
//initialize the tag of all vertices to -1
Vertex_iterator vitb = P.vertices_begin();
Vertex_iterator vite = P.vertices_end();
Vertex2int_map_type vertex2props;
Vertex_PM_type vpm(vertex2props);
CGAL_For_all(vitb, vite)
{
put(vpm, &(*vitb), -1);
}
vite = P.vertices_end();
label vertI = 0;
for (vitb = P.vertices_begin(); vitb != vite; vitb++)
{
//initialize
Vertex* v = &(*vitb);
//gather points around the vertex using rings
// From: gather_fitting_points(v, in_points, vpm);
{
std::vector<Vertex*> gathered;
in_points.clear();
Poly_rings::collect_enough_rings(v, min_nb_points, gathered, vpm);
//store the gathered points
std::vector<Vertex*>::iterator itb = gathered.begin();
std::vector<Vertex*>::iterator ite = gathered.end();
CGAL_For_all(itb, ite)
{
in_points.push_back((*itb)->point());
}
}
//skip if the nb of points is to small
if ( in_points.size() < min_nb_points )
{
std::cerr
<< "not enough pts for fitting this vertex"
<< in_points.size()
<< std::endl;
continue;
}
// perform the fitting
Monge_via_jet_fitting monge_fit;
Monge_form monge_form = monge_fit
(
in_points.begin(),
in_points.end(),
d_fitting,
d_monge
);
// std::cout<< monge_form << std::endl;
// std::cout<< "k1 " << monge_form.principal_curvatures(0) << std::endl;
// std::cout<< "k2 " << monge_form.principal_curvatures(1) << std::endl;
// std::vector<Point_3>::iterator itbp = in_points.begin();
// std::vector<Point_3>::iterator itep = in_points.end();
// std::cout << "in_points list : " << std::endl;
// for (; itbp != itep; itbp++)
// {
// std::cout << *itbp << std::endl;
// }
// std::cout << "--- vertex " << vertI
// << " : " << v->point() << std::endl
// << "number of points used : " << in_points.size()
// << std::endl;
k[vertI++] = Foam::sqrt
(
sqr(monge_form.principal_curvatures(0))
+ sqr(monge_form.principal_curvatures(1))
);
}
return k;
}
#endif
// Unmark non-manifold edges if individual triangles are not features
void unmarkBaffles
(