mirror of https://github.com/CGAL/cgal
Improved Interpolation readability (no real changes)
-- Removed trailing whitespace -- Fixed (some) includes -- Fixed indentation -- Fixed some remaining french
This commit is contained in:
parent
8842cc9f54
commit
b39201ab5c
|
|
@ -1,4 +1,4 @@
|
|||
// compares the result of several interpolation methods
|
||||
// Compares the result of several interpolation methods
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
|
|
@ -53,11 +53,9 @@ int main()
|
|||
|
||||
Delaunay_triangulation T;
|
||||
|
||||
|
||||
Point_value_map values;
|
||||
Point_vector_map gradients;
|
||||
|
||||
|
||||
//parameters for quadratic function:
|
||||
Coord_type alpha = Coord_type(1.0),
|
||||
beta1 = Coord_type(2.0),
|
||||
|
|
@ -132,7 +130,6 @@ int main()
|
|||
if (error > f_max) f_max = error;
|
||||
} else ++failure;
|
||||
|
||||
|
||||
//quadratic interpolant:
|
||||
res = CGAL::quadratic_interpolation(coords.begin(), coords.end(),
|
||||
norm,points[i],
|
||||
|
|
|
|||
|
|
@ -20,12 +20,14 @@ int main()
|
|||
|
||||
Coord_type a(0.25), bx(1.3), by(-0.7);
|
||||
|
||||
for (int y=0 ; y<3 ; y++)
|
||||
for (int y=0 ; y<3 ; y++){
|
||||
for (int x=0 ; x<3 ; x++){
|
||||
K::Point_2 p(x,y);
|
||||
T.insert(p);
|
||||
function_values.insert(std::make_pair(p,a + bx* x+ by*y));
|
||||
}
|
||||
}
|
||||
|
||||
//coordinate computation
|
||||
K::Point_2 p(1.3,0.34);
|
||||
std::vector< std::pair< Point, Coord_type > > coords;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Delaunay_triangulation_2<K> Delaunay_triangulation;
|
||||
typedef std::vector< std::pair< K::Point_2, K::FT > >
|
||||
Point_coordinate_vector;
|
||||
typedef std::vector< std::pair< K::Point_2, K::FT > > Point_coordinate_vector;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
@ -18,17 +17,17 @@ int main()
|
|||
//coordinate computation
|
||||
K::Point_2 p(1.2, 0.7);
|
||||
Point_coordinate_vector coords;
|
||||
CGAL::Triple<
|
||||
std::back_insert_iterator<Point_coordinate_vector>,
|
||||
CGAL::Triple<std::back_insert_iterator<Point_coordinate_vector>,
|
||||
K::FT, bool> result =
|
||||
CGAL::natural_neighbor_coordinates_2(dt, p,
|
||||
std::back_inserter(coords));
|
||||
CGAL::natural_neighbor_coordinates_2(dt, p, std::back_inserter(coords));
|
||||
|
||||
if(!result.third){
|
||||
std::cout << "The coordinate computation was not successful."
|
||||
<< std::endl;
|
||||
std::cout << "The point (" <<p << ") lies outside the convex hull."
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
K::FT norm = result.second;
|
||||
std::cout << "Coordinate computation successful." << std::endl;
|
||||
std::cout << "Normalization factor: " <<norm << std::endl;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ int main()
|
|||
pp[2]=Point3(0,0,0); //outside data/points3 convex hull
|
||||
std::cout << "P2 is outside the convex hull" << std::endl;
|
||||
|
||||
for(int ii=0;ii<3;ii++)
|
||||
for(int ii=0; ii<3; ++ii)
|
||||
{
|
||||
std::vector< std::pair< Vertex_handle,NT> > coor_laplace;
|
||||
std::vector< std::pair< Vertex_handle,NT> > coor_sibson;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ typedef CGAL::Regular_triangulation_euclidean_traits_2<K> Gt;
|
|||
typedef CGAL::Regular_triangulation_2<Gt> Regular_triangulation;
|
||||
typedef Regular_triangulation::Bare_point Bare_point;
|
||||
typedef Regular_triangulation::Weighted_point Weighted_point;
|
||||
typedef std::vector< std::pair< Weighted_point, K::FT > >
|
||||
Point_coordinate_vector;
|
||||
typedef std::vector< std::pair< Weighted_point, K::FT > > Point_coordinate_vector;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
@ -23,17 +22,17 @@ int main()
|
|||
//coordinate computation
|
||||
Weighted_point wp(Bare_point(1.2, 0.7),2);
|
||||
Point_coordinate_vector coords;
|
||||
CGAL::Triple<
|
||||
std::back_insert_iterator<Point_coordinate_vector>,
|
||||
CGAL::Triple<std::back_insert_iterator<Point_coordinate_vector>,
|
||||
K::FT, bool> result =
|
||||
CGAL::regular_neighbor_coordinates_2(rt, wp,
|
||||
std::back_inserter(coords));
|
||||
CGAL::regular_neighbor_coordinates_2(rt, wp, std::back_inserter(coords));
|
||||
|
||||
if(!result.third){
|
||||
std::cout << "The coordinate computation was not successful."
|
||||
<< std::endl;
|
||||
std::cout << "The point (" <<wp.point() << ") lies outside the convex hull."
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
K::FT norm = result.second;
|
||||
std::cout << "Coordinate computation successful." << std::endl;
|
||||
std::cout << "Normalization factor: " <<norm << std::endl;
|
||||
|
|
|
|||
|
|
@ -24,35 +24,35 @@ int main()
|
|||
|
||||
//parameters for spherical function:
|
||||
Coord_type a(0.25), bx(1.3), by(-0.7), c(0.2);
|
||||
for (int y=0 ; y<4 ; y++)
|
||||
for (int y=0 ; y<4 ; y++){
|
||||
for (int x=0 ; x<4 ; x++){
|
||||
K::Point_2 p(x,y);
|
||||
T.insert(p);
|
||||
function_values.insert(std::make_pair(p,a + bx* x+ by*y + c*(x*x+y*y)));
|
||||
}
|
||||
}
|
||||
|
||||
sibson_gradient_fitting_nn_2(T,std::inserter(function_gradients,
|
||||
function_gradients.begin()),
|
||||
CGAL::Data_access<Point_value_map>
|
||||
(function_values),
|
||||
CGAL::Data_access<Point_value_map>(function_values),
|
||||
Traits());
|
||||
|
||||
|
||||
//coordiante computation
|
||||
K::Point_2 p(1.6,1.4);
|
||||
std::vector< std::pair< Point, Coord_type > > coords;
|
||||
Coord_type norm =
|
||||
CGAL::natural_neighbor_coordinates_2(T, p,std::back_inserter
|
||||
Coord_type norm = CGAL::natural_neighbor_coordinates_2(T, p, std::back_inserter
|
||||
(coords)).second;
|
||||
|
||||
|
||||
//Sibson interpolant: version without sqrt:
|
||||
std::pair<Coord_type, bool> res =
|
||||
CGAL::sibson_c1_interpolation_square
|
||||
(coords.begin(),
|
||||
CGAL::sibson_c1_interpolation_square(
|
||||
coords.begin(),
|
||||
coords.end(),norm,p,
|
||||
CGAL::Data_access<Point_value_map>(function_values),
|
||||
CGAL::Data_access<Point_vector_map>(function_gradients),
|
||||
Traits());
|
||||
|
||||
if(res.second)
|
||||
std::cout << "Tested interpolation on " << p
|
||||
<< " interpolation: " << res.first << " exact: "
|
||||
|
|
|
|||
|
|
@ -8,29 +8,29 @@
|
|||
|
||||
#include <CGAL/surface_neighbor_coordinates_3.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::FT Coord_type;
|
||||
typedef K::Point_3 Point_3;
|
||||
typedef K::Vector_3 Vector_3;
|
||||
typedef std::vector< std::pair< Point_3, K::FT > >
|
||||
Point_coordinate_vector;
|
||||
typedef std::vector< std::pair< Point_3, K::FT > > Point_coordinate_vector;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
int n=100;
|
||||
std::vector< Point_3> points;
|
||||
points.reserve(n);
|
||||
|
||||
std::cout << "Generate " << n << " random points on a sphere."
|
||||
<< std::endl;
|
||||
std::cout << "Generate " << n << " random points on a sphere." << std::endl;
|
||||
CGAL::Random_points_on_sphere_3<Point_3> g(1);
|
||||
CGAL::cpp11::copy_n(g, n, std::back_inserter(points));
|
||||
|
||||
Point_3 p(1, 0,0);
|
||||
Vector_3 normal(p - CGAL::ORIGIN);
|
||||
std::cout << "Compute surface neighbor coordinates for "
|
||||
<< p << std::endl;
|
||||
std::cout << "Compute surface neighbor coordinates for " << p << std::endl;
|
||||
Point_coordinate_vector coords;
|
||||
CGAL::Triple<std::back_insert_iterator<Point_coordinate_vector>,
|
||||
K::FT, bool> result =
|
||||
|
|
@ -40,8 +40,7 @@ int main()
|
|||
K());
|
||||
if(!result.third){
|
||||
//Undersampling:
|
||||
std::cout << "The coordinate computation was not successful."
|
||||
<< std::endl;
|
||||
std::cout << "The coordinate computation was not successful." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
K::FT norm = result.second;
|
||||
|
|
@ -53,8 +52,7 @@ int main()
|
|||
b = b + (it->second/norm)* (it->first - CGAL::ORIGIN);
|
||||
|
||||
std::cout << " weighted barycenter: " << b <<std::endl;
|
||||
std::cout << " squared distance: " <<
|
||||
CGAL::squared_distance(p,b) <<std::endl;
|
||||
std::cout << " squared distance: " << CGAL::squared_distance(p,b) << std::endl;
|
||||
|
||||
std::cout << "done" << std::endl;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
#ifndef CGAL_INTERPOLATION_GRADIENT_FITTING_TRAITS_2_H
|
||||
|
|
@ -23,7 +19,6 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <CGAL/aff_transformation_tags.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -91,7 +86,8 @@ public:
|
|||
Aff_transformation_2
|
||||
operator()(const Vector_2& v) const
|
||||
{
|
||||
return Aff_transformation_2(v.x()*v.x(),v.x()*v.y(),v.x()*v.y(),
|
||||
return Aff_transformation_2(v.x()*v.x(),
|
||||
v.x()*v.y(), v.x()*v.y(),
|
||||
v.y()*v.y());
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
#ifndef CGAL_INTERPOLATION_TRAITS_2_H
|
||||
|
|
@ -23,7 +19,6 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2003 INRIA Sophia-Antipolis (France).
|
||||
// Copyright (c) 2003, 2017 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <CGAL/Origin.h>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/number_utils_classes.h>
|
||||
|
|
@ -116,7 +115,6 @@ private:
|
|||
const Vector& normal;
|
||||
};
|
||||
|
||||
|
||||
template < typename K >
|
||||
class Construct_plane_intersected_bisector_3
|
||||
{
|
||||
|
|
@ -142,7 +140,6 @@ private:
|
|||
const Vector& normal;
|
||||
};
|
||||
|
||||
|
||||
template < typename K >
|
||||
class Compare_first_projection_3
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
#ifndef CGAL_INTERPOLATION_FUNCTIONS_H
|
||||
|
|
@ -23,24 +19,25 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <utility>
|
||||
#include <CGAL/double.h>
|
||||
#include <CGAL/use.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
//Functor class for accessing the function values/gradients
|
||||
template< class Map >
|
||||
struct Data_access : public std::unary_function< typename Map::key_type,
|
||||
struct Data_access
|
||||
: public std::unary_function< typename Map::key_type,
|
||||
std::pair< typename Map::mapped_type, bool> >
|
||||
{
|
||||
typedef typename Map::mapped_type Data_type;
|
||||
typedef typename Map::key_type Key_type;
|
||||
|
||||
Data_access< Map >(const Map& m): map(m){};
|
||||
Data_access< Map >(const Map& m): map(m){}
|
||||
|
||||
std::pair< Data_type, bool>
|
||||
operator()(const Key_type& p) const {
|
||||
|
|
@ -48,7 +45,7 @@ struct Data_access : public std::unary_function< typename Map::key_type,
|
|||
if(mit!= map.end())
|
||||
return std::make_pair(mit->second, true);
|
||||
return std::make_pair(Data_type(), false);
|
||||
};
|
||||
}
|
||||
|
||||
const Map& map;
|
||||
};
|
||||
|
|
@ -59,7 +56,8 @@ typename Functor::result_type::first_type
|
|||
linear_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||
const typename
|
||||
std::iterator_traits<ForwardIterator>::value_type::
|
||||
second_type& norm, Functor function_value)
|
||||
second_type& norm,
|
||||
Functor function_value)
|
||||
{
|
||||
CGAL_precondition(norm>0);
|
||||
typedef typename Functor::result_type::first_type Value_type;
|
||||
|
|
@ -74,15 +72,16 @@ linear_interpolation(ForwardIterator first, ForwardIterator beyond,
|
|||
}
|
||||
|
||||
|
||||
template < class ForwardIterator, class Functor, class GradFunctor,
|
||||
class Traits>
|
||||
template < class ForwardIterator, class Functor, class GradFunctor, class Traits>
|
||||
std::pair< typename Functor::result_type::first_type, bool>
|
||||
quadratic_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||
const typename
|
||||
std::iterator_traits<ForwardIterator>::
|
||||
value_type::second_type& norm, const typename
|
||||
value_type::second_type& norm,
|
||||
const typename
|
||||
std::iterator_traits<ForwardIterator>::value_type::
|
||||
first_type& p, Functor function_value,
|
||||
first_type& p,
|
||||
Functor function_value,
|
||||
GradFunctor function_gradient,
|
||||
const Traits& traits)
|
||||
{
|
||||
|
|
@ -107,14 +106,13 @@ quadratic_interpolation(ForwardIterator first, ForwardIterator beyond,
|
|||
}
|
||||
|
||||
|
||||
template < class ForwardIterator, class Functor, class GradFunctor,
|
||||
class Traits>
|
||||
template < class ForwardIterator, class Functor, class GradFunctor, class Traits>
|
||||
std::pair< typename Functor::result_type::first_type, bool>
|
||||
sibson_c1_interpolation(ForwardIterator first, ForwardIterator beyond,
|
||||
const typename
|
||||
std::iterator_traits<ForwardIterator>::
|
||||
value_type::second_type&
|
||||
norm, const typename
|
||||
value_type::second_type& norm,
|
||||
const typename
|
||||
std::iterator_traits<ForwardIterator>::value_type::
|
||||
first_type& p,
|
||||
Functor function_value,
|
||||
|
|
@ -182,11 +180,10 @@ sibson_c1_interpolation(ForwardIterator first, ForwardIterator beyond,
|
|||
// (vh->get_value()+ vh->get_gradient()
|
||||
// *(p - vh->point()));
|
||||
|
||||
template < class ForwardIterator, class Functor, class GradFunctor,
|
||||
class Traits>
|
||||
template < class ForwardIterator, class Functor, class GradFunctor, class Traits>
|
||||
std::pair< typename Functor::result_type::first_type, bool>
|
||||
sibson_c1_interpolation_square(ForwardIterator first, ForwardIterator
|
||||
beyond, const typename
|
||||
sibson_c1_interpolation_square(ForwardIterator first, ForwardIterator beyond,
|
||||
const typename
|
||||
std::iterator_traits<ForwardIterator>::
|
||||
value_type::second_type& norm,
|
||||
const typename
|
||||
|
|
@ -231,8 +228,7 @@ sibson_c1_interpolation_square(ForwardIterator first, ForwardIterator
|
|||
|
||||
linear_int += coeff * f.first;
|
||||
|
||||
gradient_int += (coeff/squared_dist)
|
||||
*(f.first + grad.first*
|
||||
gradient_int += (coeff/squared_dist) * (f.first + grad.first *
|
||||
traits.construct_vector_d_object()(first->first, p));
|
||||
}
|
||||
|
||||
|
|
@ -251,7 +247,8 @@ farin_c1_interpolation(RandomAccessIterator first,
|
|||
RandomAccessIterator beyond,
|
||||
const typename
|
||||
std::iterator_traits<RandomAccessIterator>::
|
||||
value_type::second_type& norm, const typename
|
||||
value_type::second_type& norm,
|
||||
const typename
|
||||
std::iterator_traits<RandomAccessIterator>::
|
||||
value_type::first_type& /*p*/,
|
||||
Functor function_value, GradFunctor
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Frank Da, Julia Floetotto
|
||||
|
||||
#ifndef CGAL_NATURAL_NEIGHBOR_COORDINATES_2_H
|
||||
|
|
@ -23,13 +19,14 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <utility>
|
||||
#include <CGAL/Iterator_project.h>
|
||||
#include <CGAL/Polygon_2.h>
|
||||
#include <CGAL/number_utils_classes.h>
|
||||
#include <CGAL/utility.h>
|
||||
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// the struct "Project_vertex_output_iterator"
|
||||
|
|
@ -79,14 +76,13 @@ struct Project_vertex_output_iterator
|
|||
// OutputIterator out, const Traits& traits,
|
||||
// typename Dt::Face_handle start
|
||||
// = typename Dt::Face_handle())
|
||||
//
|
||||
|
||||
//template <class Dt, class OutputIterator, class Traits>
|
||||
//Triple< OutputIterator, typename Traits::FT, bool >
|
||||
//natural_neighbor_coordinates_2(const Dt& dt,
|
||||
// typename Dt::Vertex_handle vh,
|
||||
// OutputIterator out, const Traits& traits)
|
||||
|
||||
|
||||
//the following two functions suppose that
|
||||
// OutputIterator has value type
|
||||
// std::pair<Dt::Vertex_handle, Dt::Geom_traits::FT>
|
||||
|
|
@ -97,7 +93,6 @@ natural_neighbor_coordinates_vertex_2(const Dt& dt,
|
|||
const typename Dt::Geom_traits::Point_2& p,
|
||||
OutputIterator out, typename Dt::Face_handle start
|
||||
= typename Dt::Face_handle())
|
||||
|
||||
{
|
||||
typedef typename Dt::Geom_traits Traits;
|
||||
typedef typename Traits::FT Coord_type;
|
||||
|
|
@ -114,15 +109,13 @@ natural_neighbor_coordinates_vertex_2(const Dt& dt,
|
|||
int li;
|
||||
Face_handle fh = dt.locate(p, lt, li, start);
|
||||
|
||||
if (lt == Dt::OUTSIDE_AFFINE_HULL
|
||||
|| lt == Dt::OUTSIDE_CONVEX_HULL)
|
||||
if (lt == Dt::OUTSIDE_AFFINE_HULL || lt == Dt::OUTSIDE_CONVEX_HULL)
|
||||
{
|
||||
return make_triple(out, Coord_type(1), false);
|
||||
}
|
||||
|
||||
if ((lt == Dt::EDGE &&
|
||||
(dt.is_infinite(fh) ||
|
||||
dt.is_infinite(fh->neighbor(li)))))
|
||||
(dt.is_infinite(fh) || dt.is_infinite(fh->neighbor(li)))))
|
||||
{
|
||||
Vertex_handle v1 = fh->vertex(dt.cw(li));
|
||||
Vertex_handle v2 = fh->vertex(dt.ccw(li));
|
||||
|
|
@ -138,13 +131,11 @@ natural_neighbor_coordinates_vertex_2(const Dt& dt,
|
|||
coef2 = 1 - coef1;
|
||||
*out++ = std::make_pair(v1,coef1);
|
||||
*out++ = std::make_pair(v2,coef2);
|
||||
|
||||
} else {
|
||||
coef1 = (p.y() - p2.y()) / (p1.y() - p2.y());
|
||||
coef2 = 1-coef1;
|
||||
*out++ = std::make_pair(v1,coef1);
|
||||
*out++ = std::make_pair(v2,coef2);
|
||||
|
||||
}
|
||||
|
||||
return make_triple(out, coef1+coef2, true);
|
||||
|
|
@ -157,7 +148,6 @@ natural_neighbor_coordinates_vertex_2(const Dt& dt,
|
|||
}
|
||||
|
||||
std::list<Edge> hole;
|
||||
|
||||
dt.get_boundary_of_conflicts(p, std::back_inserter(hole), fh, false);
|
||||
|
||||
return natural_neighbor_coordinates_vertex_2
|
||||
|
|
@ -184,7 +174,6 @@ natural_neighbor_coordinates_vertex_2(const Dt& dt,
|
|||
typedef typename Dt::Vertex_handle Vertex_handle;
|
||||
typedef typename Dt::Face_circulator Face_circulator;
|
||||
|
||||
|
||||
std::vector<Point_2> vor(3);
|
||||
|
||||
Coord_type area_sum(0);
|
||||
|
|
@ -200,8 +189,8 @@ natural_neighbor_coordinates_vertex_2(const Dt& dt,
|
|||
Coord_type area(0);
|
||||
Vertex_handle current = hit->first->vertex(dt.cw(hit->second));
|
||||
|
||||
vor[0] = dt.geom_traits().construct_circumcenter_2_object()
|
||||
(current->point(),
|
||||
vor[0] = dt.geom_traits().construct_circumcenter_2_object()(
|
||||
current->point(),
|
||||
hit->first->vertex(dt.ccw(hit->second))->point(),
|
||||
p);
|
||||
|
||||
|
|
@ -213,21 +202,18 @@ natural_neighbor_coordinates_vertex_2(const Dt& dt,
|
|||
{
|
||||
++fc;
|
||||
vor[2] = dt.dual(fc);
|
||||
|
||||
area += polygon_area_2(vor.begin(), vor.end(), dt.geom_traits());
|
||||
|
||||
vor[1] = vor[2];
|
||||
};
|
||||
vor[2] =
|
||||
dt.geom_traits().construct_circumcenter_2_object()(prev->point(),
|
||||
current->point(),p);
|
||||
}
|
||||
|
||||
vor[2] = dt.geom_traits().construct_circumcenter_2_object()(prev->point(),
|
||||
current->point(),
|
||||
p);
|
||||
|
||||
area += polygon_area_2(vor.begin(), vor.end(), dt.geom_traits());
|
||||
|
||||
|
||||
*out++ = std::make_pair(current,area);
|
||||
area_sum += area;
|
||||
|
||||
|
||||
//update prev and hit:
|
||||
prev = current;
|
||||
++hit;
|
||||
|
|
@ -257,8 +243,7 @@ natural_neighbor_coordinates_2(const Dt& dt,
|
|||
|
||||
Triple<Project_vertex_output_iterator<OutputIterator>,
|
||||
typename Dt::Geom_traits::FT, bool > result =
|
||||
natural_neighbor_coordinates_vertex_2
|
||||
(dt, p, op, start);
|
||||
natural_neighbor_coordinates_vertex_2(dt, p, op, start);
|
||||
|
||||
return make_triple(result.first.base(), result.second, result.third);
|
||||
}
|
||||
|
|
@ -279,8 +264,7 @@ natural_neighbor_coordinates_2(const Dt& dt,
|
|||
|
||||
Triple<Project_vertex_output_iterator<OutputIterator>,
|
||||
typename Dt::Geom_traits::FT, bool > result =
|
||||
natural_neighbor_coordinates_vertex_2
|
||||
(dt, p, op, hole_begin,hole_end);
|
||||
natural_neighbor_coordinates_vertex_2(dt, p, op, hole_begin,hole_end);
|
||||
|
||||
return make_triple(result.first.base(), result.second, result.third);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,16 +23,18 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/iterator.h>
|
||||
#include <CGAL/utility.h>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/number_utils.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream> //TO DO : to remove
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -73,7 +75,8 @@ Triple< OutputIterator, // iterator with value type std::pair<Dt::Vertex_handle
|
|||
bool >
|
||||
laplace_natural_neighbor_coordinates_3(const Dt& dt,
|
||||
const typename Dt::Geom_traits::Point_3& Q,
|
||||
OutputIterator nn_out, typename Dt::Geom_traits::FT & norm_coeff,
|
||||
OutputIterator nn_out,
|
||||
typename Dt::Geom_traits::FT& norm_coeff,
|
||||
const typename Dt::Cell_handle start = CGAL_TYPENAME_DEFAULT_ARG Dt::Cell_handle())
|
||||
{
|
||||
typedef typename Dt::Geom_traits Gt;
|
||||
|
|
@ -86,8 +89,8 @@ laplace_natural_neighbor_coordinates_3(const Dt& dt,
|
|||
|
||||
CGAL_triangulation_precondition (dt.dimension() == 3);
|
||||
|
||||
Locate_type lt; int li, lj;
|
||||
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = dt.locate( Q, lt, li, lj, start);
|
||||
|
||||
if ( lt == Dt::VERTEX )
|
||||
|
|
@ -96,7 +99,10 @@ laplace_natural_neighbor_coordinates_3(const Dt& dt,
|
|||
return make_triple(nn_out, norm_coeff = Coord_type(1),true);
|
||||
}
|
||||
else if (dt.is_infinite(c))
|
||||
return make_triple(nn_out, Coord_type(1), false);//point outside the convex-hull
|
||||
{
|
||||
//point outside the convex-hull
|
||||
return make_triple(nn_out, Coord_type(1), false);
|
||||
}
|
||||
|
||||
std::set<Cell_handle> cells;
|
||||
// To replace the forbidden access to the "in conflict" flag :
|
||||
|
|
@ -169,7 +175,8 @@ Triple< OutputIterator, // iterator with value type std::pair<Dt::Vertex_handle
|
|||
bool >
|
||||
sibson_natural_neighbor_coordinates_3(const Dt& dt,
|
||||
const typename Dt::Geom_traits::Point_3& Q,
|
||||
OutputIterator nn_out, typename Dt::Geom_traits::FT & norm_coeff,
|
||||
OutputIterator nn_out,
|
||||
typename Dt::Geom_traits::FT& norm_coeff,
|
||||
const typename Dt::Cell_handle start = CGAL_TYPENAME_DEFAULT_ARG Dt::Cell_handle())
|
||||
{
|
||||
typedef typename Dt::Geom_traits Gt;
|
||||
|
|
@ -182,8 +189,8 @@ sibson_natural_neighbor_coordinates_3(const Dt& dt,
|
|||
|
||||
CGAL_triangulation_precondition (dt.dimension()== 3);
|
||||
|
||||
Locate_type lt; int li, lj;
|
||||
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = dt.locate( Q, lt, li, lj, start);
|
||||
|
||||
if ( lt == Dt::VERTEX )
|
||||
|
|
@ -192,7 +199,10 @@ sibson_natural_neighbor_coordinates_3(const Dt& dt,
|
|||
return make_triple(nn_out,norm_coeff=Coord_type(1),true);
|
||||
}
|
||||
else if (dt.is_infinite(c))
|
||||
return make_triple(nn_out, Coord_type(1), false);//point outside the convex-hull
|
||||
{
|
||||
//point outside the convex-hull
|
||||
return make_triple(nn_out, Coord_type(1), false);
|
||||
}
|
||||
|
||||
std::set<Cell_handle> cells;
|
||||
typename std::set<Cell_handle>::iterator cit;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
#ifndef CGAL_REGULAR_NEIGHBOR_COORDINATES_2_H
|
||||
|
|
@ -23,23 +19,22 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <utility>
|
||||
#include <CGAL/Polygon_2.h>
|
||||
#include <CGAL/iterator.h>
|
||||
|
||||
//for definition of class Project_vertex_output_iterator
|
||||
#include <CGAL/natural_neighbor_coordinates_2.h>
|
||||
|
||||
#include <list>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// in this functions, the traits class is defined via the regular
|
||||
// triangulation
|
||||
// see natural_neighbor_coordinates_2 for a proposal for signatures
|
||||
// that allow to pass the traits class as argument
|
||||
// In these functions, the traits class is defined via the regular triangulation.
|
||||
// See natural_neighbor_coordinates_2 for a proposal for signatures
|
||||
// that allow to pass the traits class as argument.
|
||||
|
||||
|
||||
//the following two functions suppose that
|
||||
// The following two functions assume that
|
||||
// OutputIterator has value type
|
||||
// std::pair<Rt::Vertex_handle, Rt::Geom_traits::FT>
|
||||
//!!!they are not documented!!!
|
||||
|
|
@ -70,7 +65,7 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
|
|||
Emptyset_iterator(), start);
|
||||
}
|
||||
|
||||
//the Voronoi vertices of the power cell are known:
|
||||
// The Voronoi vertices of the power cell are known:
|
||||
// OutputIterator has value type
|
||||
// std::pair<Rt::Vertex_handle, Rt::Geom_traits::FT>
|
||||
template <class Rt, class OutputIterator, class OutputIteratorVorVertices>
|
||||
|
|
@ -82,8 +77,7 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
|
|||
typename Rt::Face_handle start)
|
||||
{
|
||||
// out: the result of the coordinate computation
|
||||
//vor_vertices: the vertices of the power cell (to avoid
|
||||
// recomputation)
|
||||
// vor_vertices: the vertices of the power cell (to avoid recomputation)
|
||||
typedef typename Rt::Geom_traits Traits;
|
||||
typedef typename Traits::FT Coord_type;
|
||||
|
||||
|
|
@ -98,19 +92,16 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
|
|||
int li;
|
||||
Face_handle fh = rt.locate(p, lt, li, start);
|
||||
|
||||
//the point must lie inside the convex hull
|
||||
// sinon return false:
|
||||
if(lt == Rt::OUTSIDE_AFFINE_HULL || lt ==
|
||||
Rt::OUTSIDE_CONVEX_HULL
|
||||
|| (lt == Rt::EDGE && (rt.is_infinite(fh)
|
||||
|| rt.is_infinite(fh->neighbor(li)))))
|
||||
// the point must lie inside the convex hull otherwisereturn false:
|
||||
if(lt == Rt::OUTSIDE_AFFINE_HULL || lt == Rt::OUTSIDE_CONVEX_HULL
|
||||
|| (lt == Rt::EDGE
|
||||
&& (rt.is_infinite(fh) || rt.is_infinite(fh->neighbor(li)))))
|
||||
return make_triple(out, Coord_type(1), false);
|
||||
|
||||
if (lt == Rt::VERTEX)
|
||||
{
|
||||
//the point must be in conflict:
|
||||
CGAL_precondition(rt.power_test(fh->vertex(li)->point(), p) !=
|
||||
ON_NEGATIVE_SIDE);
|
||||
CGAL_precondition(rt.power_test(fh->vertex(li)->point(), p) != ON_NEGATIVE_SIDE);
|
||||
if (rt.power_test(fh->vertex(li)->point(), p) ==ON_ORIENTED_BOUNDARY)
|
||||
{
|
||||
*out++= std::make_pair(fh->vertex(li),Coord_type(1));
|
||||
|
|
@ -126,9 +117,10 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
|
|||
std::back_inserter
|
||||
(hidden_vertices),
|
||||
fh);
|
||||
return regular_neighbor_coordinates_vertex_2
|
||||
(rt, p, out, vor_vertices, hole.begin(),hole.end(),
|
||||
hidden_vertices.begin(), hidden_vertices.end());
|
||||
return regular_neighbor_coordinates_vertex_2(rt, p, out, vor_vertices,
|
||||
hole.begin(),hole.end(),
|
||||
hidden_vertices.begin(),
|
||||
hidden_vertices.end());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -139,19 +131,17 @@ template <class Rt, class OutputIterator, class EdgeIterator,
|
|||
Triple< OutputIterator, typename Rt::Geom_traits::FT, bool >
|
||||
regular_neighbor_coordinates_vertex_2(const Rt& rt,
|
||||
const typename Rt::Weighted_point& p,
|
||||
OutputIterator out, EdgeIterator
|
||||
hole_begin, EdgeIterator hole_end,
|
||||
OutputIterator out,
|
||||
EdgeIterator hole_begin, EdgeIterator hole_end,
|
||||
VertexIterator hidden_vertices_begin,
|
||||
VertexIterator hidden_vertices_end)
|
||||
{
|
||||
return regular_neighbor_coordinates_vertex_2(rt, p,
|
||||
out,Emptyset_iterator(),
|
||||
return regular_neighbor_coordinates_vertex_2(rt, p, out, Emptyset_iterator(),
|
||||
hole_begin, hole_end,
|
||||
hidden_vertices_begin,
|
||||
hidden_vertices_end);
|
||||
}
|
||||
|
||||
|
||||
// OutputIterator has value type
|
||||
// std::pair<Rt::Vertex_handle, Rt::Geom_traits::FT>
|
||||
template <class Rt, class OutputIterator, class EdgeIterator,
|
||||
|
|
@ -161,8 +151,7 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
|
|||
const typename Rt::Weighted_point& p,
|
||||
OutputIterator out,
|
||||
OutputIteratorVorVertices vor_vertices,
|
||||
EdgeIterator
|
||||
hole_begin, EdgeIterator hole_end,
|
||||
EdgeIterator hole_begin, EdgeIterator hole_end,
|
||||
VertexIterator hidden_vertices_begin,
|
||||
VertexIterator hidden_vertices_end)
|
||||
{
|
||||
|
|
@ -282,8 +271,7 @@ regular_neighbor_coordinates_2(const Rt& rt,
|
|||
const typename Rt::Weighted_point& p,
|
||||
OutputIterator out)
|
||||
{
|
||||
return regular_neighbor_coordinates_2(rt, p, out,
|
||||
typename Rt::Face_handle());
|
||||
return regular_neighbor_coordinates_2(rt, p, out, typename Rt::Face_handle());
|
||||
}
|
||||
|
||||
//OutputIterator has value type
|
||||
|
|
@ -296,8 +284,7 @@ regular_neighbor_coordinates_2(const Rt& rt,
|
|||
OutputIterator out,
|
||||
typename Rt::Face_handle start)
|
||||
{
|
||||
return regular_neighbor_coordinates_2(rt, p, out,
|
||||
Emptyset_iterator(), start);
|
||||
return regular_neighbor_coordinates_2(rt, p, out, Emptyset_iterator(), start);
|
||||
}
|
||||
|
||||
//OutputIterator has value type
|
||||
|
|
@ -320,12 +307,11 @@ regular_neighbor_coordinates_2(const Rt& rt,
|
|||
|
||||
Triple< Project_vertex_output_iterator<OutputIterator>,
|
||||
typename Rt::Geom_traits::FT, bool > result =
|
||||
regular_neighbor_coordinates_vertex_2
|
||||
(rt, p, op , vor_vertices, start);
|
||||
regular_neighbor_coordinates_vertex_2(rt, p, op, vor_vertices, start);
|
||||
|
||||
return make_triple(result.first.base(), result.second, result.third);
|
||||
}
|
||||
|
||||
|
||||
//OutputIterator has value type
|
||||
// std::pair< Rt::Geom_traits::Point_2, Rt::Geom_traits::FT>
|
||||
template <class Rt, class OutputIterator, class EdgeIterator,
|
||||
|
|
@ -338,14 +324,12 @@ regular_neighbor_coordinates_2(const Rt& rt,
|
|||
VertexIterator hidden_vertices_begin,
|
||||
VertexIterator hidden_vertices_end)
|
||||
{
|
||||
return regular_neighbor_coordinates_2(rt, p,
|
||||
out,Emptyset_iterator(),
|
||||
return regular_neighbor_coordinates_2(rt, p, out, Emptyset_iterator(),
|
||||
hole_begin, hole_end,
|
||||
hidden_vertices_begin,
|
||||
hidden_vertices_end);
|
||||
}
|
||||
|
||||
|
||||
//OutputIterator has value type
|
||||
// std::pair< Rt::Geom_traits::Point_2, Rt::Geom_traits::FT>
|
||||
template <class Rt, class OutputIterator, class EdgeIterator,
|
||||
|
|
@ -368,9 +352,10 @@ regular_neighbor_coordinates_2(const Rt& rt,
|
|||
|
||||
Triple< Project_vertex_output_iterator<OutputIterator>,
|
||||
typename Rt::Geom_traits::FT, bool > result =
|
||||
regular_neighbor_coordinates_vertex_2
|
||||
(rt, p, op , vor_vertices, hole_begin,hole_end,
|
||||
hidden_vertices_begin, hidden_vertices_end);
|
||||
regular_neighbor_coordinates_vertex_2(rt, p, op , vor_vertices,
|
||||
hole_begin, hole_end,
|
||||
hidden_vertices_begin,
|
||||
hidden_vertices_end);
|
||||
return make_triple(result.first.base(), result.second, result.third);
|
||||
}
|
||||
|
||||
|
|
@ -393,8 +378,7 @@ regular_neighbor_coordinates_2(const Rt& rt,
|
|||
CGAL_precondition(rt.dimension() == 2);
|
||||
|
||||
Rt t2;
|
||||
Vertex_circulator vc = rt.incident_vertices(vh),
|
||||
done(vc);
|
||||
Vertex_circulator vc = rt.incident_vertices(vh), done(vc);
|
||||
do{
|
||||
CGAL_assertion(!rt.is_infinite(vc));
|
||||
t2.insert(vc->point());
|
||||
|
|
@ -404,7 +388,6 @@ regular_neighbor_coordinates_2(const Rt& rt,
|
|||
return regular_neighbor_coordinates_2(t2, vh->point(), out);
|
||||
}
|
||||
|
||||
|
||||
//class providing a function object:
|
||||
//OutputIterator has value type
|
||||
// std::pair< Rt::Geom_traits::Point_2, Rt::Geom_traits::FT>
|
||||
|
|
|
|||
|
|
@ -23,12 +23,13 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <utility>
|
||||
#include <CGAL/Origin.h>
|
||||
#include <CGAL/natural_neighbor_coordinates_2.h>
|
||||
#include <CGAL/regular_neighbor_coordinates_2.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class ForwardIterator, class Functor, class Traits>
|
||||
|
|
@ -36,10 +37,11 @@ typename Traits::Vector_d
|
|||
sibson_gradient_fitting(ForwardIterator first, ForwardIterator beyond,
|
||||
const typename
|
||||
std::iterator_traits<ForwardIterator>::
|
||||
value_type::second_type&
|
||||
norm, const typename
|
||||
value_type::second_type& norm,
|
||||
const typename
|
||||
std::iterator_traits<ForwardIterator>::value_type
|
||||
::first_type& p, Functor function_value,
|
||||
::first_type& p,
|
||||
Functor function_value,
|
||||
const Traits& traits)
|
||||
{
|
||||
CGAL_precondition( first!=beyond && norm!=0);
|
||||
|
|
@ -93,11 +95,9 @@ sibson_gradient_fitting(const Triangul& tr,
|
|||
std::vector< std::pair< Point, Coord_type > > coords;
|
||||
Coord_type norm;
|
||||
|
||||
typename Triangul::Finite_vertices_iterator
|
||||
vit = tr.finite_vertices_begin();
|
||||
typename Triangul::Finite_vertices_iterator vit = tr.finite_vertices_begin();
|
||||
for(; vit != tr.finite_vertices_end(); ++vit){
|
||||
//test if vit is a convex hull vertex:
|
||||
//otherwise do nothing
|
||||
//test if vit is a convex hull vertex, otherwise do nothing
|
||||
if (!tr.is_edge(vit, tr.infinite_vertex()))
|
||||
{
|
||||
norm = compute_coordinates(tr, vit, std::back_inserter(coords)).second;
|
||||
|
|
@ -108,7 +108,6 @@ sibson_gradient_fitting(const Triangul& tr,
|
|||
function_value,
|
||||
traits));
|
||||
coords.clear();
|
||||
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
|
@ -126,12 +125,14 @@ sibson_gradient_fitting_nn_2(const Dt& dt,
|
|||
Functor function_value,
|
||||
const Traits& traits)
|
||||
{
|
||||
typedef typename std::back_insert_iterator< std::vector< std::pair<
|
||||
typename Traits::Point_d,typename Traits::FT > > > CoordInserter;
|
||||
typedef typename std::back_insert_iterator<
|
||||
std::vector<
|
||||
std::pair< typename Traits::Point_d,
|
||||
typename Traits::FT > > > CoordInserter;
|
||||
|
||||
return sibson_gradient_fitting
|
||||
(dt, out, function_value,
|
||||
natural_neighbor_coordinates_2_object< Dt, CoordInserter >(),
|
||||
return sibson_gradient_fitting(dt, out, function_value,
|
||||
natural_neighbor_coordinates_2_object< Dt,
|
||||
CoordInserter >(),
|
||||
traits);
|
||||
}
|
||||
|
||||
|
|
@ -142,12 +143,14 @@ sibson_gradient_fitting_rn_2(const Rt& rt,
|
|||
Functor function_value,
|
||||
const Traits& traits)
|
||||
{
|
||||
typedef typename std::back_insert_iterator< std::vector< std::pair<
|
||||
typename Traits::Point_d,typename Traits::FT > > > CoordInserter;
|
||||
typedef typename std::back_insert_iterator<
|
||||
std::vector<
|
||||
std::pair< typename Traits::Point_d,
|
||||
typename Traits::FT > > > CoordInserter;
|
||||
|
||||
return sibson_gradient_fitting
|
||||
(rt, out, function_value,
|
||||
regular_neighbor_coordinates_2_object< Rt, CoordInserter >(),
|
||||
return sibson_gradient_fitting(rt, out, function_value,
|
||||
regular_neighbor_coordinates_2_object< Rt,
|
||||
CoordInserter >(),
|
||||
traits);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
// ATTENTION : the surface is supposed to be a closed surface
|
||||
|
|
@ -25,20 +21,24 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <utility>
|
||||
#include <CGAL/Iterator_project.h>
|
||||
#include <CGAL/Voronoi_intersection_2_traits_3.h>
|
||||
#include <CGAL/Regular_triangulation_2.h>
|
||||
#include <CGAL/regular_neighbor_coordinates_2.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class OutputIterator, class InputIterator, class Kernel>
|
||||
inline
|
||||
Triple< OutputIterator, typename Kernel::FT, bool >
|
||||
surface_neighbor_coordinates_3(InputIterator
|
||||
first, InputIterator beyond,
|
||||
surface_neighbor_coordinates_3(InputIterator first, InputIterator beyond,
|
||||
const typename Kernel::Point_3& p,
|
||||
const typename Kernel::Vector_3& normal,
|
||||
OutputIterator out,
|
||||
|
|
@ -51,8 +51,7 @@ surface_neighbor_coordinates_3(InputIterator
|
|||
|
||||
template <class OutputIterator, class InputIterator, class ITraits>
|
||||
Triple< OutputIterator, typename ITraits::FT, bool >
|
||||
surface_neighbor_coordinates_3(InputIterator
|
||||
first, InputIterator beyond,
|
||||
surface_neighbor_coordinates_3(InputIterator first, InputIterator beyond,
|
||||
const typename ITraits::Point_2& p,
|
||||
OutputIterator out,
|
||||
const ITraits& traits)
|
||||
|
|
@ -106,8 +105,8 @@ surface_neighbor_coordinates_certified_3(InputIterator
|
|||
const Kernel& )
|
||||
{
|
||||
typedef Voronoi_intersection_2_traits_3<Kernel> I_gt;
|
||||
return surface_neighbor_coordinates_certified_3
|
||||
(first, beyond, p, out, I_gt(p,normal));
|
||||
return surface_neighbor_coordinates_certified_3(first, beyond, p, out,
|
||||
I_gt(p,normal));
|
||||
}
|
||||
|
||||
//this function takes the radius of the sphere centered on p
|
||||
|
|
@ -116,16 +115,15 @@ surface_neighbor_coordinates_certified_3(InputIterator
|
|||
template <class OutputIterator, class InputIterator, class Kernel>
|
||||
inline
|
||||
Quadruple< OutputIterator, typename Kernel::FT, bool, bool >
|
||||
surface_neighbor_coordinates_certified_3(
|
||||
InputIterator first, InputIterator beyond,
|
||||
surface_neighbor_coordinates_certified_3(InputIterator first, InputIterator beyond,
|
||||
const typename Kernel::Point_3& p,
|
||||
const typename Kernel::Vector_3& normal,
|
||||
const typename Kernel::FT& radius,
|
||||
OutputIterator out, const Kernel& )
|
||||
{
|
||||
typedef Voronoi_intersection_2_traits_3<Kernel> I_gt;
|
||||
return surface_neighbor_coordinates_certified_3
|
||||
(first, beyond, p, radius, out, I_gt(p,normal));
|
||||
return surface_neighbor_coordinates_certified_3(first, beyond, p, radius, out,
|
||||
I_gt(p,normal));
|
||||
}
|
||||
|
||||
// FIXME : this should probably be replaced by some kernel functor.
|
||||
|
|
@ -153,8 +151,8 @@ private:
|
|||
// Versions with instantiated traits class:
|
||||
template <class OutputIterator, class InputIterator, class ITraits>
|
||||
Quadruple< OutputIterator, typename ITraits::FT, bool, bool >
|
||||
surface_neighbor_coordinates_certified_3(InputIterator
|
||||
first, InputIterator beyond,
|
||||
surface_neighbor_coordinates_certified_3(InputIterator first,
|
||||
InputIterator beyond,
|
||||
const typename ITraits::Point_2& p,
|
||||
OutputIterator out,
|
||||
const ITraits& traits)
|
||||
|
|
@ -163,8 +161,7 @@ surface_neighbor_coordinates_certified_3(InputIterator
|
|||
InputIterator furthest = std::max_element(first, beyond,
|
||||
closer_to_point<ITraits>(p, traits));
|
||||
|
||||
return surface_neighbor_coordinates_certified_3
|
||||
(first, beyond, p,
|
||||
return surface_neighbor_coordinates_certified_3(first, beyond, p,
|
||||
traits.compute_squared_distance_2_object()(p,*furthest),
|
||||
out, traits);
|
||||
}
|
||||
|
|
@ -173,12 +170,10 @@ surface_neighbor_coordinates_certified_3(InputIterator
|
|||
// add. parameter:
|
||||
template <class OutputIterator, class InputIterator, class ITraits>
|
||||
Quadruple< OutputIterator, typename ITraits::FT, bool, bool >
|
||||
surface_neighbor_coordinates_certified_3(InputIterator
|
||||
first, InputIterator beyond,
|
||||
const typename
|
||||
ITraits::Point_2& p,
|
||||
const typename ITraits::FT&
|
||||
radius,
|
||||
surface_neighbor_coordinates_certified_3(InputIterator first,
|
||||
InputIterator beyond,
|
||||
const typename ITraits::Point_2& p,
|
||||
const typename ITraits::FT& radius,
|
||||
OutputIterator out,
|
||||
const ITraits& traits)
|
||||
{
|
||||
|
|
@ -265,8 +260,7 @@ surface_neighbor_coordinates_3(const Dt& dt,
|
|||
const typename Dt::Geom_traits::Point_3& p,
|
||||
const typename Dt::Geom_traits::Vector_3& normal,
|
||||
OutputIterator out,
|
||||
typename Dt::Cell_handle start
|
||||
= typename Dt::Cell_handle())
|
||||
typename Dt::Cell_handle start = typename Dt::Cell_handle())
|
||||
{
|
||||
typedef Voronoi_intersection_2_traits_3<typename Dt::Geom_traits> I_gt;
|
||||
return surface_neighbor_coordinates_3(dt, p, out, I_gt(p,normal), start);
|
||||
|
|
@ -277,8 +271,7 @@ Triple< OutputIterator, typename ITraits::FT, bool >
|
|||
surface_neighbor_coordinates_3(const Dt& dt,
|
||||
const typename ITraits::Point_2& p,
|
||||
OutputIterator out, const ITraits& traits,
|
||||
typename Dt::Cell_handle start
|
||||
= typename Dt::Cell_handle())
|
||||
typename Dt::Cell_handle start = typename Dt::Cell_handle())
|
||||
{
|
||||
typedef typename ITraits::FT Coord_type;
|
||||
typedef typename ITraits::Point_2 Point_3;
|
||||
|
|
@ -289,8 +282,7 @@ surface_neighbor_coordinates_3(const Dt& dt,
|
|||
|
||||
//the Vertex_handle is, in fact, an iterator over vertex:
|
||||
typedef Project_vertex_iterator_to_point< Vertex_handle> Proj_point;
|
||||
typedef Iterator_project<
|
||||
typename std::list< Vertex_handle >::iterator,
|
||||
typedef Iterator_project<typename std::list< Vertex_handle >::iterator,
|
||||
Proj_point,
|
||||
const Point_3&,
|
||||
const Point_3*,
|
||||
|
|
@ -303,15 +295,13 @@ surface_neighbor_coordinates_3(const Dt& dt,
|
|||
|
||||
//if p is located on a vertex: the only neighbor is found
|
||||
if(lt == Dt::VERTEX){
|
||||
*out++= std::make_pair(c->vertex(li)->point(),
|
||||
Coord_type(1));
|
||||
*out++= std::make_pair(c->vertex(li)->point(), Coord_type(1));
|
||||
return make_triple(out, Coord_type(1), true);
|
||||
}
|
||||
|
||||
//the candidate points are the points of dt in conflict with p:
|
||||
typename std::list< Vertex_handle > conflict_vertices;
|
||||
dt.vertices_on_conflict_zone_boundary(p,c,
|
||||
std::back_inserter(conflict_vertices));
|
||||
dt.vertices_on_conflict_zone_boundary(p, c, std::back_inserter(conflict_vertices));
|
||||
|
||||
for (typename std::list< Vertex_handle >::iterator it = conflict_vertices.begin();
|
||||
it != conflict_vertices.end();){
|
||||
|
|
@ -323,8 +313,7 @@ surface_neighbor_coordinates_3(const Dt& dt,
|
|||
it++;
|
||||
}
|
||||
}
|
||||
return surface_neighbor_coordinates_3
|
||||
(Point_iterator(conflict_vertices.begin()),
|
||||
return surface_neighbor_coordinates_3(Point_iterator(conflict_vertices.begin()),
|
||||
Point_iterator(conflict_vertices.end()),
|
||||
p, out, traits);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
#ifndef CGAL_SURFACE_NEIGHBORS_3_H
|
||||
|
|
@ -23,8 +19,6 @@
|
|||
|
||||
#include <CGAL/license/Interpolation.h>
|
||||
|
||||
|
||||
#include <utility>
|
||||
#include <CGAL/Voronoi_intersection_2_traits_3.h>
|
||||
#include <CGAL/Regular_triangulation_2.h>
|
||||
#include <CGAL/Iterator_project.h>
|
||||
|
|
@ -33,6 +27,10 @@
|
|||
// the function object Project_vertex_iterator_to_point
|
||||
#include <CGAL/surface_neighbor_coordinates_3.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
//without Delaunay filtering
|
||||
|
|
@ -85,8 +83,7 @@ surface_neighbors_3(InputIterator first, InputIterator beyond,
|
|||
|
||||
Vertex_handle vh = it.insert(wp, fh);
|
||||
|
||||
typename I_triangulation::Vertex_circulator
|
||||
vc(it.incident_vertices(vh)),
|
||||
typename I_triangulation::Vertex_circulator vc(it.incident_vertices(vh)),
|
||||
done(vc);
|
||||
do{
|
||||
*out++= wp2p(vc->point());
|
||||
|
|
@ -197,11 +194,11 @@ surface_neighbors_certified_3(InputIterator first,
|
|||
//determine the furthest distance from p to a vertex of its cell
|
||||
bool valid(false);
|
||||
Face_circulator fc(it.incident_faces(vh)), fdone(fc);
|
||||
do
|
||||
do{
|
||||
valid = (!it.is_infinite(fc) &&
|
||||
(4*radius > traits.compute_squared_distance_2_object()
|
||||
(p, it.dual(fc))));
|
||||
while(!valid && ++fc!=fdone);
|
||||
}while(!valid && ++fc!=fdone);
|
||||
|
||||
//get the neighbor points:
|
||||
Vertex_circulator vc(it.incident_vertices(vh)), vdone(vc);
|
||||
|
|
@ -212,7 +209,6 @@ surface_neighbors_certified_3(InputIterator first,
|
|||
return std::make_pair(out, valid);
|
||||
}
|
||||
|
||||
|
||||
//using Delaunay triangulation for candidate point filtering:
|
||||
// => no certification is necessary
|
||||
template <class Dt, class OutputIterator>
|
||||
|
|
@ -233,8 +229,7 @@ OutputIterator
|
|||
surface_neighbors_3(const Dt& dt,
|
||||
const typename ITraits::Point_2& p,
|
||||
OutputIterator out, const ITraits& traits,
|
||||
typename Dt::Cell_handle start
|
||||
= typename Dt::Cell_handle())
|
||||
typename Dt::Cell_handle start = typename Dt::Cell_handle())
|
||||
{
|
||||
typedef typename ITraits::Point_2 Point_3;
|
||||
|
||||
|
|
@ -244,8 +239,7 @@ surface_neighbors_3(const Dt& dt,
|
|||
|
||||
//the Vertex_handle is, in fact, an iterator over vertex:
|
||||
typedef Project_vertex_iterator_to_point< Vertex_handle> Proj_point;
|
||||
typedef Iterator_project<
|
||||
typename std::list< Vertex_handle >::iterator,
|
||||
typedef Iterator_project<typename std::list< Vertex_handle >::iterator,
|
||||
Proj_point,
|
||||
const Point_3&,
|
||||
const Point_3*,
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
|
|
@ -24,6 +20,8 @@
|
|||
|
||||
#include <CGAL/_test_interpolation_functions_2.cpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
|
||||
typedef CGAL::Delaunay_triangulation_2<K> Dt;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Naceur MESKINI.
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
|
@ -23,11 +19,11 @@
|
|||
|
||||
#include <CGAL/_test_natural_neighbors_2.cpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Delaunay_triangulation_2<K> Dt;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Testing NN_neighbors_2 " << std::endl;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
|
@ -26,6 +22,7 @@
|
|||
|
||||
#include <CGAL/_test_regular_neighbors_2.cpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// 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$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Floetotto
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
|
@ -25,6 +21,7 @@
|
|||
|
||||
#include <CGAL/_test_surface_neighbors_3.cpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Delaunay_triangulation_3<K> Dt;
|
||||
|
|
@ -35,7 +32,6 @@ typedef CGAL::Delaunay_triangulation_3<K2> Dt2;
|
|||
// Fast_location with exact pred exact const. kernel:
|
||||
typedef CGAL::Delaunay_triangulation_3<K2, CGAL::Fast_location> Dh;
|
||||
|
||||
|
||||
// Aff_transformation:
|
||||
typedef CGAL::Aff_transformation_3<K2> Transformation;
|
||||
|
||||
|
|
@ -46,7 +42,6 @@ int main()
|
|||
_test_surface_neighbors_3_sphere( Dt() );
|
||||
std::cout << " done." << std::endl << std::endl;
|
||||
|
||||
|
||||
std::cout << "Using Exact_predicates_exact_constructions_kernel: "
|
||||
<< std::endl;
|
||||
|
||||
|
|
@ -57,6 +52,7 @@ int main()
|
|||
<< identity(K2::Vector_3(0,1,0))<< ", "
|
||||
<< identity(K2::Vector_3(1,0,0))
|
||||
<< std::endl;
|
||||
|
||||
std::cout << " with grid sample points";
|
||||
_test_surface_neighbors_3_cube(Dt2(),identity, 75, K2::FT(1e-29));
|
||||
std::cout << " done." << std::endl;
|
||||
|
|
@ -69,6 +65,7 @@ int main()
|
|||
Transformation rotate(K2::RT(1),K2::RT(0),K2::RT(0),K2::RT(0),
|
||||
K2::RT(0),K2::RT(0.9063),K2::RT(-0.42261826),K2::RT(0),
|
||||
K2::RT(0),K2::RT(0.42261826),K2::RT(0.9063),K2::RT(0));
|
||||
|
||||
std::cout << "Testing surface_neighbors_3 on a ROTATED cube "<< std::endl;
|
||||
std::cout << " with grid sample points";
|
||||
_test_surface_neighbors_3_cube(Dh(),rotate, 75, K2::FT(1e-2), true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue