Cleanup of white spaces and empty lines also under examples/*/*.h.

This commit is contained in:
Sylvain Pion 2007-03-10 16:45:36 +00:00
parent 847c23a15e
commit 05840a8f17
23 changed files with 129 additions and 138 deletions

View File

@ -5,7 +5,7 @@
#ifdef CGAL_USE_GMP #ifdef CGAL_USE_GMP
// GMP is installed. Use the GMP rational number-type. // GMP is installed. Use the GMP rational number-type.
#include <CGAL/Gmpq.h> #include <CGAL/Gmpq.h>
typedef CGAL::Gmpq Number_type; typedef CGAL::Gmpq Number_type;

View File

@ -11,7 +11,7 @@ void point_location_query
// Print the result. // Print the result.
typedef typename PointLocation::Arrangement_2 Arrangement_2; typedef typename PointLocation::Arrangement_2 Arrangement_2;
typename Arrangement_2::Vertex_const_handle v; typename Arrangement_2::Vertex_const_handle v;
typename Arrangement_2::Halfedge_const_handle e; typename Arrangement_2::Halfedge_const_handle e;
typename Arrangement_2::Face_const_handle f; typename Arrangement_2::Face_const_handle f;
@ -59,7 +59,7 @@ void vertical_ray_shooting_query
// Print the result. // Print the result.
typedef typename VerticalRayShoot::Arrangement_2 Arrangement_2; typedef typename VerticalRayShoot::Arrangement_2 Arrangement_2;
typename Arrangement_2::Vertex_const_handle v; typename Arrangement_2::Vertex_const_handle v;
typename Arrangement_2::Halfedge_const_handle e; typename Arrangement_2::Halfedge_const_handle e;
typename Arrangement_2::Face_const_handle f; typename Arrangement_2::Face_const_handle f;
@ -82,8 +82,8 @@ void vertical_ray_shooting_query
{ {
// We did not hit anything: // We did not hit anything:
CGAL_assertion (f->is_unbounded()); CGAL_assertion (f->is_unbounded());
std::cout << "hit nothing." << std::endl; std::cout << "hit nothing." << std::endl;
} }
else else
{ {
@ -98,7 +98,7 @@ void vertical_ray_shooting_query
// the vertical ray-shooting examples. // the vertical ray-shooting examples.
// The function assumes that the arrangement is of line segments with integer // The function assumes that the arrangement is of line segments with integer
// coordinates. // coordinates.
// //
template <class Arrangement> template <class Arrangement>
void construct_segments_arr (Arrangement& arr) void construct_segments_arr (Arrangement& arr)
{ {

View File

@ -5,7 +5,7 @@
#ifdef CGAL_USE_GMP #ifdef CGAL_USE_GMP
// GMP is installed. Use the GMP rational number-type. // GMP is installed. Use the GMP rational number-type.
#include <CGAL/Gmpq.h> #include <CGAL/Gmpq.h>
typedef CGAL::Gmpq Number_type; typedef CGAL::Gmpq Number_type;

View File

@ -5,7 +5,7 @@
#ifdef CGAL_USE_GMP #ifdef CGAL_USE_GMP
// GMP is installed. Use the GMP rational number-type. // GMP is installed. Use the GMP rational number-type.
#include <CGAL/Gmpq.h> #include <CGAL/Gmpq.h>
typedef CGAL::Gmpq Number_type; typedef CGAL::Gmpq Number_type;

View File

@ -29,7 +29,7 @@ void print_polygon_with_holes
{ {
if (! pwh.is_unbounded()) if (! pwh.is_unbounded())
{ {
std::cout << "{ Outer boundary = "; std::cout << "{ Outer boundary = ";
print_polygon (pwh.outer_boundary()); print_polygon (pwh.outer_boundary());
} }
else else

View File

@ -17,7 +17,7 @@
// //
// $URL$ // $URL$
// $Id$ // $Id$
// //
// //
// Author(s) : Herve Bronnimann, Sylvain Pion // Author(s) : Herve Bronnimann, Sylvain Pion
@ -41,9 +41,9 @@ public:
public: public:
typedef void result_type; typedef void result_type;
typedef Arity_tag< 2 > Arity; typedef Arity_tag< 2 > Arity;
Intersect_with_iterators_2() {} Intersect_with_iterators_2() {}
template <typename OutputIterator> template <typename OutputIterator>
OutputIterator OutputIterator
operator()(const Segment_2& s1, const Segment_2& s2, OutputIterator it ) const operator()(const Segment_2& s1, const Segment_2& s2, OutputIterator it ) const
@ -52,8 +52,8 @@ public:
if(! o.is_empty()){ if(! o.is_empty()){
*it = o; *it = o;
it++; it++;
} }
return it; return it;
} }
}; };

View File

@ -27,7 +27,7 @@
//Polyhedron_traits_with_normals_3). edges with the length //Polyhedron_traits_with_normals_3). edges with the length
//---------------------------------------------------------------- //----------------------------------------------------------------
template < class Refs, class Tag, class Pt, class FGeomTraits > template < class Refs, class Tag, class Pt, class FGeomTraits >
class My_vertex:public CGAL::HalfedgeDS_vertex_base < Refs, Tag, Pt > class My_vertex:public CGAL::HalfedgeDS_vertex_base < Refs, Tag, Pt >
{ {
typedef typename FGeomTraits::Point_3 Point_3; typedef typename FGeomTraits::Point_3 Point_3;
@ -67,17 +67,17 @@ public:
template <class TPoly> template <class TPoly>
class Facet_PM : class Facet_PM :
public boost::put_get_helper<typename TPoly::Traits::Vector_3, Facet_PM<TPoly> > public boost::put_get_helper<typename TPoly::Traits::Vector_3, Facet_PM<TPoly> >
{ {
public: public:
//read_write //read_write
typedef boost::read_write_property_map_tag category; typedef boost::read_write_property_map_tag category;
typedef typename TPoly::Facet key_type; typedef typename TPoly::Facet key_type;
typedef typename TPoly::Traits::Vector_3 value_type; typedef typename TPoly::Traits::Vector_3 value_type;
typedef typename TPoly::Traits::Vector_3& reference; typedef typename TPoly::Traits::Vector_3& reference;
Facet_PM() {} Facet_PM() {}
reference operator[](key_type f) const {return f.get_unit_normal();} reference operator[](key_type f) const {return f.get_unit_normal();}
}; };
@ -90,7 +90,7 @@ namespace boost{
}; };
template <class TPoly> template <class TPoly>
Facet_PM<TPoly> get_fpm(boost::vertex_attribute_t, TPoly& P) {return Facet_PM<TPoly>();} Facet_PM<TPoly> get_fpm(boost::vertex_attribute_t, TPoly& P) {return Facet_PM<TPoly>();}
@ -117,10 +117,10 @@ public:
/*XFC: tentative ... failed so far...*/ /*XFC: tentative ... failed so far...*/
//property map associated to the half edge //property map associated to the half edge
template <class TPoly> template <class TPoly>
class HEdge_PM : class HEdge_PM :
public boost::put_get_helper<typename TPoly::Traits::FT&, HEdge_PM<TPoly> >//double public boost::put_get_helper<typename TPoly::Traits::FT&, HEdge_PM<TPoly> >//double
{ {
public: public:
//read_write or lvalue //read_write or lvalue
//typedef boost::read_write_property_map_tag category; //typedef boost::read_write_property_map_tag category;
typedef boost::lvalue_property_map_tag category; typedef boost::lvalue_property_map_tag category;
@ -133,8 +133,8 @@ public:
}; };
//use the std edge_weight_t tag... //use the std edge_weight_t tag...
template <class TPoly> template <class TPoly>
HEdge_PM<TPoly> get_hepm(boost::edge_weight_t, TPoly& P) HEdge_PM<TPoly> get_hepm(boost::edge_weight_t, TPoly& P)
{return HEdge_PM<TPoly>();} {return HEdge_PM<TPoly>();}

View File

@ -5,12 +5,12 @@ using namespace std;
//---------------------------------------------------------------- //----------------------------------------------------------------
// some functors // some functors
//---------------------------------------------------------------- //----------------------------------------------------------------
//computing the edge length //computing the edge length
struct Edge_length { struct Edge_length {
template <class HalfEdge_handle> template <class HalfEdge_handle>
double operator() (HalfEdge_handle h) { double operator() (HalfEdge_handle h) {
double l = CGAL::sqrt(CGAL::squared_distance(h->prev()->vertex()->point(), double l = CGAL::sqrt(CGAL::squared_distance(h->prev()->vertex()->point(),
h->vertex()->point())); h->vertex()->point()));
@ -20,11 +20,11 @@ struct Edge_length {
//computing a the facet normal //computing a the facet normal
struct Facet_unit_normal { struct Facet_unit_normal {
template < class Facet > template < class Facet >
typename Facet::Vector_3 operator() (Facet & f) { typename Facet::Vector_3 operator() (Facet & f) {
typename Facet::Halfedge_handle h = f.halfedge(); typename Facet::Halfedge_handle h = f.halfedge();
typename Facet::Vector_3 normal = typename Facet::Vector_3 normal =
CGAL::cross_product(h->vertex()->point() - CGAL::cross_product(h->vertex()->point() -
h->opposite()->vertex()->point(), h->opposite()->vertex()->point(),
h->next()->vertex()->point() - h->next()->vertex()->point() -
h->opposite()->vertex()->point()); h->opposite()->vertex()->point());
@ -45,13 +45,13 @@ protected:
typedef typename TPoly::Halfedge Halfedge; typedef typename TPoly::Halfedge Halfedge;
typedef typename TPoly::Facet_handle Facet_handle; typedef typename TPoly::Facet_handle Facet_handle;
typedef typename TPoly::Facet Facet; typedef typename TPoly::Facet Facet;
typedef typename TPoly::Vertex_iterator Vertex_iterator; typedef typename TPoly::Vertex_iterator Vertex_iterator;
typedef typename TPoly::Halfedge_iterator Halfedge_iterator; typedef typename TPoly::Halfedge_iterator Halfedge_iterator;
typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator; typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator;
public: public:
static void compute_edges_length(TPoly& P, HEdgePropertyMap& hepm); static void compute_edges_length(TPoly& P, HEdgePropertyMap& hepm);
static double compute_mean_edges_length_around_vertex(Vertex * v, HEdgePropertyMap& hepm); static double compute_mean_edges_length_around_vertex(Vertex * v, HEdgePropertyMap& hepm);
}; };
@ -96,13 +96,13 @@ protected:
typedef typename TPoly::Halfedge Halfedge; typedef typename TPoly::Halfedge Halfedge;
typedef typename TPoly::Facet_handle Facet_handle; typedef typename TPoly::Facet_handle Facet_handle;
typedef typename TPoly::Facet Facet; typedef typename TPoly::Facet Facet;
typedef typename TPoly::Vertex_iterator Vertex_iterator; typedef typename TPoly::Vertex_iterator Vertex_iterator;
typedef typename TPoly::Halfedge_iterator Halfedge_iterator; typedef typename TPoly::Halfedge_iterator Halfedge_iterator;
typedef typename TPoly::Facet_iterator Facet_iterator; typedef typename TPoly::Facet_iterator Facet_iterator;
typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator; typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator;
public: public:
static void compute_facets_normals(TPoly& P, FacetPropertyMap& fpm); static void compute_facets_normals(TPoly& P, FacetPropertyMap& fpm);
static typename TPoly::Traits::Vector_3 compute_vertex_average_unit_normal(Vertex * v, const FacetPropertyMap& fpm); static typename TPoly::Traits::Vector_3 compute_vertex_average_unit_normal(Vertex * v, const FacetPropertyMap& fpm);
}; };
@ -116,7 +116,7 @@ compute_facets_normals(TPoly& P, FacetPropertyMap& fpm)
{ {
//iterator returning facet handles //iterator returning facet handles
Facet_iterator itb = P.facets_begin(), ite = P.facets_end(); Facet_iterator itb = P.facets_begin(), ite = P.facets_end();
for(; itb!=ite; itb++) for(; itb!=ite; itb++)
put(fpm, itb, Facet_unit_normal()(*itb)); put(fpm, itb, Facet_unit_normal()(*itb));
} }
@ -134,7 +134,7 @@ compute_vertex_average_unit_normal(Vertex * v, const FacetPropertyMap& fpm)
hedgeb++; hedgeb++;
continue; continue;
} }
f = hedgeb->facet(); f = hedgeb->facet();
n = get(fpm, f); n = get(fpm, f);
sum = (sum + n); sum = (sum + n);

View File

@ -12,11 +12,11 @@ protected:
typedef typename TPoly::Facet Facet; typedef typename TPoly::Facet Facet;
typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator; typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator;
typedef typename TPoly::Vertex_iterator Vertex_iterator; typedef typename TPoly::Vertex_iterator Vertex_iterator;
//vertex property map //vertex property map
// typedef typename boost::property_traits<VertexPropertyMap>::value_type vpm_value_type; // typedef typename boost::property_traits<VertexPropertyMap>::value_type vpm_value_type;
// typedef typename boost::property_traits<VertexPropertyMap>::key_type vpm_key_type; // typedef typename boost::property_traits<VertexPropertyMap>::key_type vpm_key_type;
//vertex indices are initialised to -1 //vertex indices are initialised to -1
static void reset_ring_indices(std::vector < Vertex * >&vces, static void reset_ring_indices(std::vector < Vertex * >&vces,
VertexPropertyMap& vpm); VertexPropertyMap& vpm);
@ -35,20 +35,20 @@ protected:
std::vector < Vertex * >&nextRing, std::vector < Vertex * >&nextRing,
std::vector < Vertex * >&all, std::vector < Vertex * >&all,
VertexPropertyMap& vpm); VertexPropertyMap& vpm);
public: public:
//collect i>=1 rings : all neighbours up to the ith ring, //collect i>=1 rings : all neighbours up to the ith ring,
static void static void
collect_i_rings(Vertex* v, collect_i_rings(Vertex* v,
int ring_i, int ring_i,
std::vector < Vertex * >& all, std::vector < Vertex * >& all,
VertexPropertyMap& vpm); VertexPropertyMap& vpm);
//collect enough rings (at least 1), to get at least min_nb of neighbors //collect enough rings (at least 1), to get at least min_nb of neighbors
static void static void
collect_enough_rings(Vertex* v, collect_enough_rings(Vertex* v,
unsigned int min_nb, unsigned int min_nb,
std::vector < Vertex * >& all, std::vector < Vertex * >& all,
VertexPropertyMap& vpm); VertexPropertyMap& vpm);
}; };
@ -61,15 +61,15 @@ push_neighbours_of(Vertex * start, int ith,
std::vector < Vertex * >&all, std::vector < Vertex * >&all,
VertexPropertyMap& vpm) VertexPropertyMap& vpm)
{ {
Vertex *v; Vertex *v;
Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator
hedgeb = start->vertex_begin(), hedgee = hedgeb; hedgeb = start->vertex_begin(), hedgee = hedgeb;
CGAL_For_all(hedgeb, hedgee) CGAL_For_all(hedgeb, hedgee)
{ {
v = &*(hedgeb->opposite()->vertex()); v = &*(hedgeb->opposite()->vertex());
if(get(vpm, v) != -1) continue;//if visited: next if(get(vpm, v) != -1) continue;//if visited: next
put(vpm, v, ith); put(vpm, v, ith);
nextRing.push_back(v); nextRing.push_back(v);
all.push_back(v); all.push_back(v);
@ -83,9 +83,9 @@ collect_ith_ring(int ith, std::vector < Vertex * >&currentRing,
std::vector < Vertex * >&all, std::vector < Vertex * >&all,
VertexPropertyMap& vpm) VertexPropertyMap& vpm)
{ {
typename std::vector < Vertex * >::iterator typename std::vector < Vertex * >::iterator
itb = currentRing.begin(), ite = currentRing.end(); itb = currentRing.begin(), ite = currentRing.end();
CGAL_For_all(itb, ite) push_neighbours_of(*itb, ith, nextRing, all, vpm); CGAL_For_all(itb, ite) push_neighbours_of(*itb, ith, nextRing, all, vpm);
} }
@ -94,19 +94,19 @@ template <class TPoly, class VertexPropertyMap>
reset_ring_indices(std::vector < Vertex * >&vces, reset_ring_indices(std::vector < Vertex * >&vces,
VertexPropertyMap& vpm) VertexPropertyMap& vpm)
{ {
typename std::vector < Vertex * >::iterator typename std::vector < Vertex * >::iterator
itb = vces.begin(), ite = vces.end(); itb = vces.begin(), ite = vces.end();
CGAL_For_all(itb, ite) put(vpm, *itb, -1); CGAL_For_all(itb, ite) put(vpm, *itb, -1);
} }
template <class TPoly, class VertexPropertyMap> template <class TPoly, class VertexPropertyMap>
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>:: void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
collect_i_rings(Vertex* v, collect_i_rings(Vertex* v,
int ring_i, int ring_i,
std::vector < Vertex * >& all, std::vector < Vertex * >& all,
VertexPropertyMap& vpm) VertexPropertyMap& vpm)
{ {
std::vector<Vertex*> current_ring, next_ring; std::vector<Vertex*> current_ring, next_ring;
std::vector<Vertex*> *p_current_ring, *p_next_ring; std::vector<Vertex*> *p_current_ring, *p_next_ring;
assert(ring_i >= 1); assert(ring_i >= 1);
//initialize //initialize
@ -131,10 +131,10 @@ template <class TPoly, class VertexPropertyMap>
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>:: void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
collect_enough_rings(Vertex* v, collect_enough_rings(Vertex* v,
unsigned int min_nb, unsigned int min_nb,
std::vector < Vertex * >& all, std::vector < Vertex * >& all,
VertexPropertyMap& vpm) VertexPropertyMap& vpm)
{ {
std::vector<Vertex*> current_ring, next_ring; std::vector<Vertex*> current_ring, next_ring;
std::vector<Vertex*> *p_current_ring, *p_next_ring; std::vector<Vertex*> *p_current_ring, *p_next_ring;
//initialize //initialize
@ -146,7 +146,7 @@ collect_enough_rings(Vertex* v,
int i = 1; int i = 1;
while ( (all.size() < min_nb) && (p_current_ring->size() != 0) ) while ( (all.size() < min_nb) && (p_current_ring->size() != 0) )
{ {
collect_ith_ring(i, *p_current_ring, *p_next_ring, all, vpm); collect_ith_ring(i, *p_current_ring, *p_next_ring, all, vpm);
//next round must be launched from p_nextRing... //next round must be launched from p_nextRing...

View File

@ -18,7 +18,7 @@ public:
typedef MyConstruct_point_2<Kernel, OldK> Construct_point_2; typedef MyConstruct_point_2<Kernel, OldK> Construct_point_2;
typedef const double* Cartesian_const_iterator_2; typedef const double* Cartesian_const_iterator_2;
typedef MyConstruct_coord_iterator Construct_cartesian_const_iterator_2; typedef MyConstruct_coord_iterator Construct_cartesian_const_iterator_2;
typedef MyConstruct_bbox_2<typename OldK::Construct_bbox_2> typedef MyConstruct_bbox_2<typename OldK::Construct_bbox_2>
Construct_bbox_2; Construct_bbox_2;
Construct_point_2 Construct_point_2

View File

@ -21,7 +21,7 @@ public:
*(vec+1) = 0; *(vec+1) = 0;
} }
MyPointC2(const double x, const double y, int c = 0) MyPointC2(const double x, const double y, int c = 0)
: col(c) : col(c)
{ {
@ -40,8 +40,8 @@ public:
int color() const { return col; } int color() const { return col; }
int& color() { return col; } int& color() { return col; }
bool operator==(const MyPointC2 &p) const bool operator==(const MyPointC2 &p) const
{ {
return ( *vec == *(p.vec) ) && ( *(vec+1) == *(p.vec + 1) && ( col == p.col) ); return ( *vec == *(p.vec) ) && ( *(vec+1) == *(p.vec + 1) && ( col == p.col) );
@ -110,8 +110,8 @@ public:
Point_2 Point_2
operator()(const RT& x, const RT& y) const operator()(const RT& x, const RT& y) const
{ {
return MyPointC2(x, y, 0); return MyPointC2(x, y, 0);
} }
Point_2 Point_2
@ -121,7 +121,7 @@ public:
Point_2 p = base_operator(l); Point_2 p = base_operator(l);
return p; return p;
} }
Point_2 Point_2
operator()(const Line_2& l, int i) const operator()(const Line_2& l, int i) const
{ {
@ -132,9 +132,9 @@ public:
// We need this one, as such a functor is in the Filtered_kernel // We need this one, as such a functor is in the Filtered_kernel
Point_2 Point_2
operator()(const RT& x, const RT& y, const RT& w) const operator()(const RT& x, const RT& y, const RT& w) const
{ {
if(w != 1){ if(w != 1){
return MyPointC2(x/w, y/w, 0); return MyPointC2(x/w, y/w, 0);
} else { } else {
return MyPointC2(x,y, 0); return MyPointC2(x,y, 0);
} }
@ -186,5 +186,3 @@ operator>>(std::istream &is, MyPointC2 &p)
#endif // MY_POINTC2_H #endif // MY_POINTC2_H

View File

@ -88,7 +88,7 @@ CGAL_KERNEL_INLINE
const typename MySegmentC2<R>::Point_2 & const typename MySegmentC2<R>::Point_2 &
MySegmentC2<R>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const MySegmentC2<R>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ {
typename R::Less_xy_2 less_xy; typename R::Less_xy_2 less_xy;
return less_xy(source(),target()) ? source() : target(); return less_xy(source(),target()) ? source() : target();
} }
@ -97,7 +97,7 @@ CGAL_KERNEL_INLINE
const typename MySegmentC2<R>::Point_2 & const typename MySegmentC2<R>::Point_2 &
MySegmentC2<R>::max BOOST_PREVENT_MACRO_SUBSTITUTION() const MySegmentC2<R>::max BOOST_PREVENT_MACRO_SUBSTITUTION() const
{ {
typename R::Less_xy_2 less_xy; typename R::Less_xy_2 less_xy;
return less_xy(source(),target()) ? target() : source(); return less_xy(source(),target()) ? target() : source();
} }

View File

@ -5,7 +5,7 @@
#ifdef CGAL_USE_GMP #ifdef CGAL_USE_GMP
// GMP is installed. Use the GMP rational number-type. // GMP is installed. Use the GMP rational number-type.
#include <CGAL/Gmpq.h> #include <CGAL/Gmpq.h>
typedef CGAL::Gmpq Number_type; typedef CGAL::Gmpq Number_type;

View File

@ -29,7 +29,7 @@ void print_polygon_with_holes
{ {
if (! pwh.is_unbounded()) if (! pwh.is_unbounded())
{ {
std::cout << "{ Outer boundary = "; std::cout << "{ Outer boundary = ";
print_polygon (pwh.outer_boundary()); print_polygon (pwh.outer_boundary());
} }
else else

View File

@ -9,9 +9,9 @@ CGAL_BEGIN_NAMESPACE
template < class Triang > template < class Triang >
void void
triangulation_print_OFF( std::ostream& out, triangulation_print_OFF( std::ostream& out,
const Triang& triang, const Triang& triang,
bool binary = false, bool binary = false,
bool noc = false, bool noc = false,
bool verbose = false) { bool verbose = false) {
CGAL_precondition( triang.is_valid()); CGAL_precondition( triang.is_valid());
@ -71,4 +71,3 @@ CGAL_END_NAMESPACE
#endif // CGAL_TRIANGULATION_PRINT_OFF_H // #endif // CGAL_TRIANGULATION_PRINT_OFF_H //
// EOF // // EOF //

View File

@ -14,18 +14,18 @@ struct Homogeneous_begin {
} }
}; };
// function to solve the LP that tests whether a point is in the // function to solve the LP that tests whether a point is in the
// convex hull of other points; the type ET is an exact type used // convex hull of other points; the type ET is an exact type used
// for the internal computations // for the internal computations
template <class Point_d, class RandomAccessIterator, class ET> template <class Point_d, class RandomAccessIterator, class ET>
CGAL::Quadratic_program_solution<ET> CGAL::Quadratic_program_solution<ET>
solve_convex_hull_containment_lp (const Point_d& p, solve_convex_hull_containment_lp (const Point_d& p,
RandomAccessIterator begin, RandomAccessIterator begin,
RandomAccessIterator end, const ET& dummy) RandomAccessIterator end, const ET& dummy)
{ {
// Constraint matrix type: A[j][i] is the i-th homogeneous coordinate of p_j // Constraint matrix type: A[j][i] is the i-th homogeneous coordinate of p_j
typedef boost::transform_iterator typedef boost::transform_iterator
<Homogeneous_begin<Point_d>, RandomAccessIterator> A_it; <Homogeneous_begin<Point_d>, RandomAccessIterator> A_it;
// Right-hand side type: b[i] is the i-th homogeneous coordinate of p // Right-hand side type: b[i] is the i-th homogeneous coordinate of p
typedef typename Point_d::Homogeneous_const_iterator B_it; typedef typename Point_d::Homogeneous_const_iterator B_it;
// Relation type ("=") // Relation type ("=")
@ -40,9 +40,9 @@ solve_convex_hull_containment_lp (const Point_d& p,
Program; Program;
// ok, we are prepared now: construct program and solve it // ok, we are prepared now: construct program and solve it
Program lp (end-begin, // number of variables Program lp (end-begin, // number of variables
p.dimension()+1, // number of constraints p.dimension()+1, // number of constraints
A_it (begin), B_it (p.homogeneous_begin()), A_it (begin), B_it (p.homogeneous_begin()),
R_it (CGAL::EQUAL), C_it (0)); R_it (CGAL::EQUAL), C_it (0));
return CGAL::solve_nonnegative_linear_program (lp, dummy); return CGAL::solve_nonnegative_linear_program (lp, dummy);
} }

View File

@ -16,16 +16,16 @@ struct Homogeneous_begin {
// function to test whether point is in the convex hull of other points; // function to test whether point is in the convex hull of other points;
// the type ET is an exact type used for the computations // the type ET is an exact type used for the computations
template <class Point_d, class RandomAccessIterator, class ET> template <class Point_d, class RandomAccessIterator, class ET>
CGAL::Quadratic_program_solution<ET> CGAL::Quadratic_program_solution<ET>
solve_convex_hull_containment_lp (const Point_d& p, solve_convex_hull_containment_lp (const Point_d& p,
RandomAccessIterator begin, RandomAccessIterator begin,
RandomAccessIterator end, const ET& dummy) RandomAccessIterator end, const ET& dummy)
{ {
// the right-hand side type // the right-hand side type
typedef typename Point_d::Homogeneous_const_iterator B_it; typedef typename Point_d::Homogeneous_const_iterator B_it;
// construct program and solve it // construct program and solve it
return CGAL::solve_nonnegative_linear_program return CGAL::solve_nonnegative_linear_program
(CGAL::make_nonnegative_linear_program_from_iterators (CGAL::make_nonnegative_linear_program_from_iterators
(end-begin, // n (end-begin, // n
p.dimension()+1, // m p.dimension()+1, // m
@ -36,4 +36,3 @@ solve_convex_hull_containment_lp (const Point_d& p,
CGAL::Const_oneset_iterator CGAL::Const_oneset_iterator
<typename CGAL::Kernel_traits<Point_d>::Kernel::RT> (0)), dummy); // c <typename CGAL::Kernel_traits<Point_d>::Kernel::RT> (0)), dummy); // c
} }

View File

@ -12,10 +12,10 @@
#include <list> #include <list>
#include "PolyhedralSurf_operations.h" #include "PolyhedralSurf_operations.h"
//---------------------------------------------------------------- //----------------------------------------------------------------
// A redefined items class for the Polyhedron_3 with // A redefined items class for the Polyhedron_3 with
// a refined facet with a normal vector // a refined facet with a normal vector
//--------------------------------------------------------------- //---------------------------------------------------------------
@ -71,8 +71,3 @@ public:
}; };
#endif #endif

View File

@ -3,12 +3,12 @@
//the facet stores the normal //the facet stores the normal
struct Facet_unit_normal { struct Facet_unit_normal {
template < class Facet > template < class Facet >
void operator() (Facet & f) void operator() (Facet & f)
{ {
typename Facet::Halfedge_handle h = f.halfedge(); typename Facet::Halfedge_handle h = f.halfedge();
typename Facet::Vector_3 normal = typename Facet::Vector_3 normal =
CGAL::cross_product(h->vertex()->point() - CGAL::cross_product(h->vertex()->point() -
h->opposite()->vertex()->point(), h->opposite()->vertex()->point(),
h->next()->vertex()->point() - h->next()->vertex()->point() -
h->opposite()->vertex()->point()); h->opposite()->vertex()->point());

View File

@ -24,7 +24,7 @@ protected:
}; };
typedef std::map<Vertex_const_handle, int, Vertex_cmp> Vertex2int_map; typedef std::map<Vertex_const_handle, int, Vertex_cmp> Vertex2int_map;
Vertex2int_map ring_index_map; Vertex2int_map ring_index_map;
//vertex indices are initialised to -1 //vertex indices are initialised to -1
void reset_ring_indices(std::vector <Vertex_const_handle> &vces); void reset_ring_indices(std::vector <Vertex_const_handle> &vces);
@ -40,13 +40,13 @@ protected:
std::vector < Vertex_const_handle > &currentRing, std::vector < Vertex_const_handle > &currentRing,
std::vector < Vertex_const_handle > &nextRing, std::vector < Vertex_const_handle > &nextRing,
std::vector < Vertex_const_handle > &all); std::vector < Vertex_const_handle > &all);
public: public:
T_PolyhedralSurf_rings(const TPoly& P); T_PolyhedralSurf_rings(const TPoly& P);
//collect i>=1 rings : all neighbours up to the ith ring, //collect i>=1 rings : all neighbours up to the ith ring,
void collect_i_rings(const Vertex_const_handle v, void collect_i_rings(const Vertex_const_handle v,
const int ring_i, const int ring_i,
std::vector < Vertex_const_handle >& all); std::vector < Vertex_const_handle >& all);
//collect enough rings (at least 1), to get at least min_nb of neighbors //collect enough rings (at least 1), to get at least min_nb of neighbors
@ -63,7 +63,7 @@ T_PolyhedralSurf_rings(const TPoly& P)
{ {
//init the ring_index_map //init the ring_index_map
Vertex_const_iterator itb = P.vertices_begin(), ite = P.vertices_end(); Vertex_const_iterator itb = P.vertices_begin(), ite = P.vertices_end();
for(;itb!=ite;itb++) ring_index_map[itb] = -1; for(;itb!=ite;itb++) ring_index_map[itb] = -1;
} }
template < class TPoly > template < class TPoly >
@ -72,15 +72,15 @@ push_neighbours_of(const Vertex_const_handle start, const int ith,
std::vector < Vertex_const_handle > &nextRing, std::vector < Vertex_const_handle > &nextRing,
std::vector < Vertex_const_handle > &all) std::vector < Vertex_const_handle > &all)
{ {
Vertex_const_handle v; Vertex_const_handle v;
Halfedge_around_vertex_const_circulator Halfedge_around_vertex_const_circulator
hedgeb = start->vertex_begin(), hedgee = hedgeb; hedgeb = start->vertex_begin(), hedgee = hedgeb;
CGAL_For_all(hedgeb, hedgee) CGAL_For_all(hedgeb, hedgee)
{ {
v = hedgeb->opposite()->vertex(); v = hedgeb->opposite()->vertex();
if (ring_index_map[v] != -1) continue;//if visited: next if (ring_index_map[v] != -1) continue;//if visited: next
ring_index_map[v] = ith; ring_index_map[v] = ith;
nextRing.push_back(v); nextRing.push_back(v);
all.push_back(v); all.push_back(v);
@ -93,9 +93,9 @@ collect_ith_ring(const int ith, std::vector < Vertex_const_handle > &currentRing
std::vector < Vertex_const_handle > &nextRing, std::vector < Vertex_const_handle > &nextRing,
std::vector < Vertex_const_handle > &all) std::vector < Vertex_const_handle > &all)
{ {
typename std::vector < Vertex_const_handle >::const_iterator typename std::vector < Vertex_const_handle >::const_iterator
itb = currentRing.begin(), ite = currentRing.end(); itb = currentRing.begin(), ite = currentRing.end();
CGAL_For_all(itb, ite) push_neighbours_of(*itb, ith, nextRing, all); CGAL_For_all(itb, ite) push_neighbours_of(*itb, ith, nextRing, all);
} }
@ -103,18 +103,18 @@ template <class TPoly>
void T_PolyhedralSurf_rings <TPoly>:: void T_PolyhedralSurf_rings <TPoly>::
reset_ring_indices(std::vector < Vertex_const_handle >&vces) reset_ring_indices(std::vector < Vertex_const_handle >&vces)
{ {
typename std::vector < Vertex_const_handle >::const_iterator typename std::vector < Vertex_const_handle >::const_iterator
itb = vces.begin(), ite = vces.end(); itb = vces.begin(), ite = vces.end();
CGAL_For_all(itb, ite) ring_index_map[*itb] = -1; CGAL_For_all(itb, ite) ring_index_map[*itb] = -1;
} }
template <class TPoly> template <class TPoly>
void T_PolyhedralSurf_rings <TPoly>:: void T_PolyhedralSurf_rings <TPoly>::
collect_i_rings(const Vertex_const_handle v, collect_i_rings(const Vertex_const_handle v,
const int ring_i, const int ring_i,
std::vector < Vertex_const_handle >& all) std::vector < Vertex_const_handle >& all)
{ {
std::vector<Vertex_const_handle> current_ring, next_ring; std::vector<Vertex_const_handle> current_ring, next_ring;
std::vector<Vertex_const_handle> *p_current_ring, *p_next_ring; std::vector<Vertex_const_handle> *p_current_ring, *p_next_ring;
assert(ring_i >= 1); assert(ring_i >= 1);
//initialize //initialize
@ -141,7 +141,7 @@ collect_enough_rings(const Vertex_const_handle v,
const unsigned int min_nb, const unsigned int min_nb,
std::vector < Vertex_const_handle >& all) std::vector < Vertex_const_handle >& all)
{ {
std::vector<Vertex_const_handle> current_ring, next_ring; std::vector<Vertex_const_handle> current_ring, next_ring;
std::vector<Vertex_const_handle> *p_current_ring, *p_next_ring; std::vector<Vertex_const_handle> *p_current_ring, *p_next_ring;
//initialize //initialize
@ -153,7 +153,7 @@ collect_enough_rings(const Vertex_const_handle v,
int i = 1; int i = 1;
while ( (all.size() < min_nb) && (p_current_ring->size() != 0) ) while ( (all.size() < min_nb) && (p_current_ring->size() != 0) )
{ {
collect_ith_ring(i, *p_current_ring, *p_next_ring, all); collect_ith_ring(i, *p_current_ring, *p_next_ring, all);
//next round must be launched from p_nextRing... //next round must be launched from p_nextRing...

View File

@ -8,8 +8,8 @@
template <class SkinSurface, class Polyhedron> template <class SkinSurface, class Polyhedron>
/// Write polyhedron with normals: /// Write polyhedron with normals:
void write_polyhedron_with_normals(SkinSurface &skin, void write_polyhedron_with_normals(SkinSurface &skin,
Polyhedron &p, Polyhedron &p,
std::ostream &out) std::ostream &out)
{ {
typedef typename Polyhedron::Vertex_iterator Vertex_iterator; typedef typename Polyhedron::Vertex_iterator Vertex_iterator;
@ -26,8 +26,8 @@ void write_polyhedron_with_normals(SkinSurface &skin,
<< " " << p.size_of_halfedges() << " " << p.size_of_halfedges()
<< std::endl; << std::endl;
// Write vertices // Write vertices
for (Vertex_iterator vit = p.vertices_begin(); for (Vertex_iterator vit = p.vertices_begin();
vit != p.vertices_end(); vit ++) { vit != p.vertices_end(); vit ++) {
@ -51,6 +51,6 @@ void write_polyhedron_with_normals(SkinSurface &skin,
} while (++hc != hc_end); } while (++hc != hc_end);
out << "\n"; out << "\n";
} }
} }
#endif // CGAL_SKIN_SURFACE_WRITER_H #endif // CGAL_SKIN_SURFACE_WRITER_H

View File

@ -10,7 +10,7 @@ struct Distance {
template <class TreeTraits> template <class TreeTraits>
double min_distance_to_rectangle(const Point& p, double min_distance_to_rectangle(const Point& p,
const CGAL::Kd_tree_rectangle<TreeTraits>& b) const { const CGAL::Kd_tree_rectangle<TreeTraits>& b) const {
double distance(0.0), h = p.x(); double distance(0.0), h = p.x();
if (h < b.min_coord(0)) distance += (b.min_coord(0)-h)*(b.min_coord(0)-h); if (h < b.min_coord(0)) distance += (b.min_coord(0)-h)*(b.min_coord(0)-h);
if (h > b.max_coord(0)) distance += (h-b.max_coord(0))*(h-b.max_coord(0)); if (h > b.max_coord(0)) distance += (h-b.max_coord(0))*(h-b.max_coord(0));
@ -22,15 +22,15 @@ struct Distance {
if (h > b.max_coord(2)) distance += (h-b.max_coord(2))*(h-b.max_coord(2)); if (h > b.max_coord(2)) distance += (h-b.max_coord(2))*(h-b.max_coord(2));
return distance; return distance;
} }
template <class TreeTraits> template <class TreeTraits>
double max_distance_to_rectangle(const Point& p, double max_distance_to_rectangle(const Point& p,
const CGAL::Kd_tree_rectangle<TreeTraits>& b) const { const CGAL::Kd_tree_rectangle<TreeTraits>& b) const {
double h = p.x(); double h = p.x();
double d0 = (h >= (b.min_coord(0)+b.max_coord(0))/2.0) ? double d0 = (h >= (b.min_coord(0)+b.max_coord(0))/2.0) ?
(h-b.min_coord(0))*(h-b.min_coord(0)) : (b.max_coord(0)-h)*(b.max_coord(0)-h); (h-b.min_coord(0))*(h-b.min_coord(0)) : (b.max_coord(0)-h)*(b.max_coord(0)-h);
h=p.y(); h=p.y();
double d1 = (h >= (b.min_coord(1)+b.max_coord(1))/2.0) ? double d1 = (h >= (b.min_coord(1)+b.max_coord(1))/2.0) ?
(h-b.min_coord(1))*(h-b.min_coord(1)) : (b.max_coord(1)-h)*(b.max_coord(1)-h); (h-b.min_coord(1))*(h-b.min_coord(1)) : (b.max_coord(1)-h)*(b.max_coord(1)-h);
@ -39,14 +39,14 @@ struct Distance {
(h-b.min_coord(2))*(h-b.min_coord(2)) : (b.max_coord(2)-h)*(b.max_coord(2)-h); (h-b.min_coord(2))*(h-b.min_coord(2)) : (b.max_coord(2)-h)*(b.max_coord(2)-h);
return d0 + d1 + d2; return d0 + d1 + d2;
} }
double new_distance(double& dist, double old_off, double new_off, double new_distance(double& dist, double old_off, double new_off,
int cutting_dimension) const { int cutting_dimension) const {
return dist + new_off*new_off - old_off*old_off; return dist + new_off*new_off - old_off*old_off;
} }
double transformed_distance(double d) const { return d*d; } double transformed_distance(double d) const { return d*d; }
double inverse_of_transformed_distance(double d) { return std::sqrt(d); } double inverse_of_transformed_distance(double d) { return std::sqrt(d); }
}; // end of struct Distance }; // end of struct Distance

View File

@ -3,7 +3,7 @@ struct Point {
Point() { vec[0]= vec[1] = vec[2] = 0; } Point() { vec[0]= vec[1] = vec[2] = 0; }
Point (double x, double y, double z) { vec[0]=x; vec[1]=y; vec[2]=z; } Point (double x, double y, double z) { vec[0]=x; vec[1]=y; vec[2]=z; }
double x() const { return vec[ 0 ]; } double x() const { return vec[ 0 ]; }
double y() const { return vec[ 1 ]; } double y() const { return vec[ 1 ]; }
double z() const { return vec[ 2 ]; } double z() const { return vec[ 2 ]; }
@ -11,8 +11,8 @@ struct Point {
double& x() { return vec[ 0 ]; } double& x() { return vec[ 0 ]; }
double& y() { return vec[ 1 ]; } double& y() { return vec[ 1 ]; }
double& z() { return vec[ 2 ]; } double& z() { return vec[ 2 ]; }
bool operator==(const Point& p) const bool operator==(const Point& p) const
{ {
return (x() == p.x()) && (y() == p.y()) && (z() == p.z()) ; return (x() == p.x()) && (y() == p.y()) && (z() == p.z()) ;
} }
@ -35,7 +35,7 @@ namespace CGAL {
struct Construct_coord_iterator { struct Construct_coord_iterator {
const double* operator()(const Point& p) const const double* operator()(const Point& p) const
{ return static_cast<const double*>(p.vec); } { return static_cast<const double*>(p.vec); }
const double* operator()(const Point& p, int) const const double* operator()(const Point& p, int) const