mirror of https://github.com/CGAL/cgal
Cleanup of white spaces and empty lines also under examples/*/*.h.
This commit is contained in:
parent
847c23a15e
commit
05840a8f17
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#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>
|
||||
|
||||
typedef CGAL::Gmpq Number_type;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ void point_location_query
|
|||
|
||||
// Print the result.
|
||||
typedef typename PointLocation::Arrangement_2 Arrangement_2;
|
||||
|
||||
|
||||
typename Arrangement_2::Vertex_const_handle v;
|
||||
typename Arrangement_2::Halfedge_const_handle e;
|
||||
typename Arrangement_2::Face_const_handle f;
|
||||
|
|
@ -59,7 +59,7 @@ void vertical_ray_shooting_query
|
|||
|
||||
// Print the result.
|
||||
typedef typename VerticalRayShoot::Arrangement_2 Arrangement_2;
|
||||
|
||||
|
||||
typename Arrangement_2::Vertex_const_handle v;
|
||||
typename Arrangement_2::Halfedge_const_handle e;
|
||||
typename Arrangement_2::Face_const_handle f;
|
||||
|
|
@ -82,8 +82,8 @@ void vertical_ray_shooting_query
|
|||
{
|
||||
// We did not hit anything:
|
||||
CGAL_assertion (f->is_unbounded());
|
||||
|
||||
std::cout << "hit nothing." << std::endl;
|
||||
|
||||
std::cout << "hit nothing." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -98,7 +98,7 @@ void vertical_ray_shooting_query
|
|||
// the vertical ray-shooting examples.
|
||||
// The function assumes that the arrangement is of line segments with integer
|
||||
// coordinates.
|
||||
//
|
||||
//
|
||||
template <class Arrangement>
|
||||
void construct_segments_arr (Arrangement& arr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#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>
|
||||
|
||||
typedef CGAL::Gmpq Number_type;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#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>
|
||||
|
||||
typedef CGAL::Gmpq Number_type;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ void print_polygon_with_holes
|
|||
{
|
||||
if (! pwh.is_unbounded())
|
||||
{
|
||||
std::cout << "{ Outer boundary = ";
|
||||
std::cout << "{ Outer boundary = ";
|
||||
print_polygon (pwh.outer_boundary());
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Herve Bronnimann, Sylvain Pion
|
||||
|
||||
|
|
@ -41,9 +41,9 @@ public:
|
|||
public:
|
||||
typedef void result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
|
||||
Intersect_with_iterators_2() {}
|
||||
|
||||
|
||||
template <typename OutputIterator>
|
||||
OutputIterator
|
||||
operator()(const Segment_2& s1, const Segment_2& s2, OutputIterator it ) const
|
||||
|
|
@ -52,8 +52,8 @@ public:
|
|||
if(! o.is_empty()){
|
||||
*it = o;
|
||||
it++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return it;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
//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 >
|
||||
{
|
||||
typedef typename FGeomTraits::Point_3 Point_3;
|
||||
|
|
@ -67,17 +67,17 @@ public:
|
|||
|
||||
|
||||
template <class TPoly>
|
||||
class Facet_PM :
|
||||
class Facet_PM :
|
||||
public boost::put_get_helper<typename TPoly::Traits::Vector_3, Facet_PM<TPoly> >
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
//read_write
|
||||
typedef boost::read_write_property_map_tag category;
|
||||
typedef typename TPoly::Facet key_type;
|
||||
typedef typename TPoly::Traits::Vector_3 value_type;
|
||||
typedef typename TPoly::Traits::Vector_3& reference;
|
||||
|
||||
|
||||
Facet_PM() {}
|
||||
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>();}
|
||||
|
||||
|
||||
|
|
@ -117,10 +117,10 @@ public:
|
|||
/*XFC: tentative ... failed so far...*/
|
||||
//property map associated to the half edge
|
||||
template <class TPoly>
|
||||
class HEdge_PM :
|
||||
class HEdge_PM :
|
||||
public boost::put_get_helper<typename TPoly::Traits::FT&, HEdge_PM<TPoly> >//double
|
||||
{
|
||||
public:
|
||||
public:
|
||||
//read_write or lvalue
|
||||
//typedef boost::read_write_property_map_tag category;
|
||||
typedef boost::lvalue_property_map_tag category;
|
||||
|
|
@ -133,8 +133,8 @@ public:
|
|||
};
|
||||
|
||||
//use the std edge_weight_t tag...
|
||||
template <class TPoly>
|
||||
HEdge_PM<TPoly> get_hepm(boost::edge_weight_t, TPoly& P)
|
||||
template <class TPoly>
|
||||
HEdge_PM<TPoly> get_hepm(boost::edge_weight_t, TPoly& P)
|
||||
{return HEdge_PM<TPoly>();}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ using namespace std;
|
|||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// some functors
|
||||
// some functors
|
||||
//----------------------------------------------------------------
|
||||
|
||||
//computing the edge length
|
||||
struct Edge_length {
|
||||
template <class HalfEdge_handle>
|
||||
template <class HalfEdge_handle>
|
||||
double operator() (HalfEdge_handle h) {
|
||||
double l = CGAL::sqrt(CGAL::squared_distance(h->prev()->vertex()->point(),
|
||||
h->vertex()->point()));
|
||||
|
|
@ -20,11 +20,11 @@ struct Edge_length {
|
|||
|
||||
//computing a the facet normal
|
||||
struct Facet_unit_normal {
|
||||
template < class Facet >
|
||||
template < class Facet >
|
||||
typename Facet::Vector_3 operator() (Facet & f) {
|
||||
typename Facet::Halfedge_handle h = f.halfedge();
|
||||
typename Facet::Vector_3 normal =
|
||||
CGAL::cross_product(h->vertex()->point() -
|
||||
CGAL::cross_product(h->vertex()->point() -
|
||||
h->opposite()->vertex()->point(),
|
||||
h->next()->vertex()->point() -
|
||||
h->opposite()->vertex()->point());
|
||||
|
|
@ -45,13 +45,13 @@ protected:
|
|||
typedef typename TPoly::Halfedge Halfedge;
|
||||
typedef typename TPoly::Facet_handle Facet_handle;
|
||||
typedef typename TPoly::Facet Facet;
|
||||
|
||||
|
||||
typedef typename TPoly::Vertex_iterator Vertex_iterator;
|
||||
typedef typename TPoly::Halfedge_iterator Halfedge_iterator;
|
||||
typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
public:
|
||||
|
||||
static void compute_edges_length(TPoly& P, 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::Facet_handle Facet_handle;
|
||||
typedef typename TPoly::Facet Facet;
|
||||
|
||||
|
||||
typedef typename TPoly::Vertex_iterator Vertex_iterator;
|
||||
typedef typename TPoly::Halfedge_iterator Halfedge_iterator;
|
||||
typedef typename TPoly::Facet_iterator Facet_iterator;
|
||||
typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator;
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
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);
|
||||
};
|
||||
|
|
@ -116,7 +116,7 @@ compute_facets_normals(TPoly& P, FacetPropertyMap& fpm)
|
|||
{
|
||||
//iterator returning facet handles
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ compute_vertex_average_unit_normal(Vertex * v, const FacetPropertyMap& fpm)
|
|||
hedgeb++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
f = hedgeb->facet();
|
||||
n = get(fpm, f);
|
||||
sum = (sum + n);
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ protected:
|
|||
typedef typename TPoly::Facet Facet;
|
||||
typedef typename TPoly::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator;
|
||||
typedef typename TPoly::Vertex_iterator Vertex_iterator;
|
||||
|
||||
|
||||
//vertex property map
|
||||
// typedef typename boost::property_traits<VertexPropertyMap>::value_type vpm_value_type;
|
||||
// typedef typename boost::property_traits<VertexPropertyMap>::key_type vpm_key_type;
|
||||
|
||||
|
||||
//vertex indices are initialised to -1
|
||||
static void reset_ring_indices(std::vector < Vertex * >&vces,
|
||||
VertexPropertyMap& vpm);
|
||||
|
|
@ -35,20 +35,20 @@ protected:
|
|||
std::vector < Vertex * >&nextRing,
|
||||
std::vector < Vertex * >&all,
|
||||
VertexPropertyMap& vpm);
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
//collect i>=1 rings : all neighbours up to the ith ring,
|
||||
static void
|
||||
collect_i_rings(Vertex* v,
|
||||
int ring_i,
|
||||
std::vector < Vertex * >& all,
|
||||
collect_i_rings(Vertex* v,
|
||||
int ring_i,
|
||||
std::vector < Vertex * >& all,
|
||||
VertexPropertyMap& vpm);
|
||||
|
||||
//collect enough rings (at least 1), to get at least min_nb of neighbors
|
||||
static void
|
||||
collect_enough_rings(Vertex* v,
|
||||
unsigned int min_nb,
|
||||
std::vector < Vertex * >& all,
|
||||
std::vector < Vertex * >& all,
|
||||
VertexPropertyMap& vpm);
|
||||
};
|
||||
|
||||
|
|
@ -61,15 +61,15 @@ push_neighbours_of(Vertex * start, int ith,
|
|||
std::vector < Vertex * >&all,
|
||||
VertexPropertyMap& vpm)
|
||||
{
|
||||
Vertex *v;
|
||||
Vertex *v;
|
||||
Halfedge_around_vertex_circulator
|
||||
hedgeb = start->vertex_begin(), hedgee = hedgeb;
|
||||
|
||||
|
||||
CGAL_For_all(hedgeb, hedgee)
|
||||
{
|
||||
v = &*(hedgeb->opposite()->vertex());
|
||||
if(get(vpm, v) != -1) continue;//if visited: next
|
||||
|
||||
|
||||
put(vpm, v, ith);
|
||||
nextRing.push_back(v);
|
||||
all.push_back(v);
|
||||
|
|
@ -83,9 +83,9 @@ collect_ith_ring(int ith, std::vector < Vertex * >¤tRing,
|
|||
std::vector < Vertex * >&all,
|
||||
VertexPropertyMap& vpm)
|
||||
{
|
||||
typename std::vector < Vertex * >::iterator
|
||||
typename std::vector < Vertex * >::iterator
|
||||
itb = currentRing.begin(), ite = currentRing.end();
|
||||
|
||||
|
||||
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,
|
||||
VertexPropertyMap& vpm)
|
||||
{
|
||||
typename std::vector < Vertex * >::iterator
|
||||
typename std::vector < Vertex * >::iterator
|
||||
itb = vces.begin(), ite = vces.end();
|
||||
CGAL_For_all(itb, ite) put(vpm, *itb, -1);
|
||||
}
|
||||
|
||||
|
||||
template <class TPoly, class VertexPropertyMap>
|
||||
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||
collect_i_rings(Vertex* v,
|
||||
int ring_i,
|
||||
std::vector < Vertex * >& all,
|
||||
collect_i_rings(Vertex* v,
|
||||
int ring_i,
|
||||
std::vector < Vertex * >& all,
|
||||
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;
|
||||
assert(ring_i >= 1);
|
||||
//initialize
|
||||
|
|
@ -131,10 +131,10 @@ template <class TPoly, class VertexPropertyMap>
|
|||
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||
collect_enough_rings(Vertex* v,
|
||||
unsigned int min_nb,
|
||||
std::vector < Vertex * >& all,
|
||||
std::vector < Vertex * >& all,
|
||||
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;
|
||||
|
||||
//initialize
|
||||
|
|
@ -146,7 +146,7 @@ collect_enough_rings(Vertex* v,
|
|||
|
||||
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);
|
||||
//next round must be launched from p_nextRing...
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public:
|
|||
typedef MyConstruct_point_2<Kernel, OldK> Construct_point_2;
|
||||
typedef const double* 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_point_2
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public:
|
|||
*(vec+1) = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MyPointC2(const double x, const double y, int c = 0)
|
||||
: col(c)
|
||||
{
|
||||
|
|
@ -40,8 +40,8 @@ public:
|
|||
int color() const { return col; }
|
||||
|
||||
int& color() { return col; }
|
||||
|
||||
|
||||
|
||||
|
||||
bool operator==(const MyPointC2 &p) const
|
||||
{
|
||||
return ( *vec == *(p.vec) ) && ( *(vec+1) == *(p.vec + 1) && ( col == p.col) );
|
||||
|
|
@ -110,8 +110,8 @@ public:
|
|||
|
||||
Point_2
|
||||
operator()(const RT& x, const RT& y) const
|
||||
{
|
||||
return MyPointC2(x, y, 0);
|
||||
{
|
||||
return MyPointC2(x, y, 0);
|
||||
}
|
||||
|
||||
Point_2
|
||||
|
|
@ -121,7 +121,7 @@ public:
|
|||
Point_2 p = base_operator(l);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
Point_2
|
||||
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
|
||||
Point_2
|
||||
operator()(const RT& x, const RT& y, const RT& w) const
|
||||
{
|
||||
{
|
||||
if(w != 1){
|
||||
return MyPointC2(x/w, y/w, 0);
|
||||
return MyPointC2(x/w, y/w, 0);
|
||||
} else {
|
||||
return MyPointC2(x,y, 0);
|
||||
}
|
||||
|
|
@ -186,5 +186,3 @@ operator>>(std::istream &is, MyPointC2 &p)
|
|||
|
||||
|
||||
#endif // MY_POINTC2_H
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ CGAL_KERNEL_INLINE
|
|||
const typename MySegmentC2<R>::Point_2 &
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ CGAL_KERNEL_INLINE
|
|||
const typename MySegmentC2<R>::Point_2 &
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#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>
|
||||
|
||||
typedef CGAL::Gmpq Number_type;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ void print_polygon_with_holes
|
|||
{
|
||||
if (! pwh.is_unbounded())
|
||||
{
|
||||
std::cout << "{ Outer boundary = ";
|
||||
std::cout << "{ Outer boundary = ";
|
||||
print_polygon (pwh.outer_boundary());
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ CGAL_BEGIN_NAMESPACE
|
|||
|
||||
template < class Triang >
|
||||
void
|
||||
triangulation_print_OFF( std::ostream& out,
|
||||
const Triang& triang,
|
||||
bool binary = false,
|
||||
triangulation_print_OFF( std::ostream& out,
|
||||
const Triang& triang,
|
||||
bool binary = false,
|
||||
bool noc = false,
|
||||
bool verbose = false) {
|
||||
CGAL_precondition( triang.is_valid());
|
||||
|
|
@ -71,4 +71,3 @@ CGAL_END_NAMESPACE
|
|||
|
||||
#endif // CGAL_TRIANGULATION_PRINT_OFF_H //
|
||||
// EOF //
|
||||
|
||||
|
|
|
|||
|
|
@ -14,18 +14,18 @@ struct Homogeneous_begin {
|
|||
}
|
||||
};
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// for the internal computations
|
||||
template <class Point_d, class RandomAccessIterator, class ET>
|
||||
CGAL::Quadratic_program_solution<ET>
|
||||
solve_convex_hull_containment_lp (const Point_d& p,
|
||||
RandomAccessIterator begin,
|
||||
RandomAccessIterator end, const ET& dummy)
|
||||
CGAL::Quadratic_program_solution<ET>
|
||||
solve_convex_hull_containment_lp (const Point_d& p,
|
||||
RandomAccessIterator begin,
|
||||
RandomAccessIterator end, const ET& dummy)
|
||||
{
|
||||
// Constraint matrix type: A[j][i] is the i-th homogeneous coordinate of p_j
|
||||
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
|
||||
typedef typename Point_d::Homogeneous_const_iterator B_it;
|
||||
// Relation type ("=")
|
||||
|
|
@ -40,9 +40,9 @@ solve_convex_hull_containment_lp (const Point_d& p,
|
|||
Program;
|
||||
|
||||
// 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
|
||||
A_it (begin), B_it (p.homogeneous_begin()),
|
||||
A_it (begin), B_it (p.homogeneous_begin()),
|
||||
R_it (CGAL::EQUAL), C_it (0));
|
||||
return CGAL::solve_nonnegative_linear_program (lp, dummy);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@ struct Homogeneous_begin {
|
|||
// function to test whether point is in the convex hull of other points;
|
||||
// the type ET is an exact type used for the computations
|
||||
template <class Point_d, class RandomAccessIterator, class ET>
|
||||
CGAL::Quadratic_program_solution<ET>
|
||||
solve_convex_hull_containment_lp (const Point_d& p,
|
||||
RandomAccessIterator begin,
|
||||
RandomAccessIterator end, const ET& dummy)
|
||||
CGAL::Quadratic_program_solution<ET>
|
||||
solve_convex_hull_containment_lp (const Point_d& p,
|
||||
RandomAccessIterator begin,
|
||||
RandomAccessIterator end, const ET& dummy)
|
||||
{
|
||||
// the right-hand side type
|
||||
typedef typename Point_d::Homogeneous_const_iterator B_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
|
||||
(end-begin, // n
|
||||
p.dimension()+1, // m
|
||||
|
|
@ -36,4 +36,3 @@ solve_convex_hull_containment_lp (const Point_d& p,
|
|||
CGAL::Const_oneset_iterator
|
||||
<typename CGAL::Kernel_traits<Point_d>::Kernel::RT> (0)), dummy); // c
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@
|
|||
#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
|
||||
//---------------------------------------------------------------
|
||||
|
||||
|
|
@ -71,8 +71,3 @@ public:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
//the facet stores the normal
|
||||
struct Facet_unit_normal {
|
||||
template < class Facet >
|
||||
void operator() (Facet & f)
|
||||
template < class Facet >
|
||||
void operator() (Facet & f)
|
||||
{
|
||||
typename Facet::Halfedge_handle h = f.halfedge();
|
||||
typename Facet::Vector_3 normal =
|
||||
CGAL::cross_product(h->vertex()->point() -
|
||||
CGAL::cross_product(h->vertex()->point() -
|
||||
h->opposite()->vertex()->point(),
|
||||
h->next()->vertex()->point() -
|
||||
h->opposite()->vertex()->point());
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ protected:
|
|||
};
|
||||
typedef std::map<Vertex_const_handle, int, Vertex_cmp> Vertex2int_map;
|
||||
Vertex2int_map ring_index_map;
|
||||
|
||||
|
||||
//vertex indices are initialised to -1
|
||||
void reset_ring_indices(std::vector <Vertex_const_handle> &vces);
|
||||
|
||||
|
|
@ -40,13 +40,13 @@ protected:
|
|||
std::vector < Vertex_const_handle > ¤tRing,
|
||||
std::vector < Vertex_const_handle > &nextRing,
|
||||
std::vector < Vertex_const_handle > &all);
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
T_PolyhedralSurf_rings(const TPoly& P);
|
||||
|
||||
|
||||
//collect i>=1 rings : all neighbours up to the ith ring,
|
||||
void collect_i_rings(const Vertex_const_handle v,
|
||||
const int ring_i,
|
||||
void collect_i_rings(const Vertex_const_handle v,
|
||||
const int ring_i,
|
||||
std::vector < Vertex_const_handle >& all);
|
||||
|
||||
//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
|
||||
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 >
|
||||
|
|
@ -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 > &all)
|
||||
{
|
||||
Vertex_const_handle v;
|
||||
Vertex_const_handle v;
|
||||
Halfedge_around_vertex_const_circulator
|
||||
hedgeb = start->vertex_begin(), hedgee = hedgeb;
|
||||
|
||||
|
||||
CGAL_For_all(hedgeb, hedgee)
|
||||
{
|
||||
v = hedgeb->opposite()->vertex();
|
||||
if (ring_index_map[v] != -1) continue;//if visited: next
|
||||
|
||||
|
||||
ring_index_map[v] = ith;
|
||||
nextRing.push_back(v);
|
||||
all.push_back(v);
|
||||
|
|
@ -93,9 +93,9 @@ collect_ith_ring(const int ith, std::vector < Vertex_const_handle > ¤tRing
|
|||
std::vector < Vertex_const_handle > &nextRing,
|
||||
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();
|
||||
|
||||
|
||||
CGAL_For_all(itb, ite) push_neighbours_of(*itb, ith, nextRing, all);
|
||||
}
|
||||
|
||||
|
|
@ -103,18 +103,18 @@ template <class TPoly>
|
|||
void T_PolyhedralSurf_rings <TPoly>::
|
||||
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();
|
||||
CGAL_For_all(itb, ite) ring_index_map[*itb] = -1;
|
||||
}
|
||||
|
||||
|
||||
template <class TPoly>
|
||||
void T_PolyhedralSurf_rings <TPoly>::
|
||||
collect_i_rings(const Vertex_const_handle v,
|
||||
const int ring_i,
|
||||
collect_i_rings(const Vertex_const_handle v,
|
||||
const int ring_i,
|
||||
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;
|
||||
assert(ring_i >= 1);
|
||||
//initialize
|
||||
|
|
@ -141,7 +141,7 @@ collect_enough_rings(const Vertex_const_handle v,
|
|||
const unsigned int min_nb,
|
||||
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;
|
||||
|
||||
//initialize
|
||||
|
|
@ -153,7 +153,7 @@ collect_enough_rings(const Vertex_const_handle v,
|
|||
|
||||
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);
|
||||
//next round must be launched from p_nextRing...
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
template <class SkinSurface, class Polyhedron>
|
||||
/// Write polyhedron with normals:
|
||||
void write_polyhedron_with_normals(SkinSurface &skin,
|
||||
Polyhedron &p,
|
||||
void write_polyhedron_with_normals(SkinSurface &skin,
|
||||
Polyhedron &p,
|
||||
std::ostream &out)
|
||||
{
|
||||
typedef typename Polyhedron::Vertex_iterator Vertex_iterator;
|
||||
|
|
@ -26,8 +26,8 @@ void write_polyhedron_with_normals(SkinSurface &skin,
|
|||
<< " " << p.size_of_halfedges()
|
||||
<< std::endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Write vertices
|
||||
for (Vertex_iterator vit = p.vertices_begin();
|
||||
vit != p.vertices_end(); vit ++) {
|
||||
|
|
@ -51,6 +51,6 @@ void write_polyhedron_with_normals(SkinSurface &skin,
|
|||
} while (++hc != hc_end);
|
||||
out << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CGAL_SKIN_SURFACE_WRITER_H
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ struct Distance {
|
|||
|
||||
template <class TreeTraits>
|
||||
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();
|
||||
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));
|
||||
|
|
@ -22,15 +22,15 @@ struct Distance {
|
|||
if (h > b.max_coord(2)) distance += (h-b.max_coord(2))*(h-b.max_coord(2));
|
||||
return distance;
|
||||
}
|
||||
|
||||
|
||||
template <class TreeTraits>
|
||||
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 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=p.y();
|
||||
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);
|
||||
|
|
@ -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);
|
||||
return d0 + d1 + d2;
|
||||
}
|
||||
|
||||
|
||||
double new_distance(double& dist, double old_off, double new_off,
|
||||
int cutting_dimension) const {
|
||||
return dist + new_off*new_off - old_off*old_off;
|
||||
}
|
||||
|
||||
|
||||
double transformed_distance(double d) const { return d*d; }
|
||||
|
||||
|
||||
double inverse_of_transformed_distance(double d) { return std::sqrt(d); }
|
||||
|
||||
|
||||
}; // end of struct Distance
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ struct Point {
|
|||
|
||||
Point() { vec[0]= vec[1] = vec[2] = 0; }
|
||||
Point (double x, double y, double z) { vec[0]=x; vec[1]=y; vec[2]=z; }
|
||||
|
||||
|
||||
double x() const { return vec[ 0 ]; }
|
||||
double y() const { return vec[ 1 ]; }
|
||||
double z() const { return vec[ 2 ]; }
|
||||
|
|
@ -11,8 +11,8 @@ struct Point {
|
|||
double& x() { return vec[ 0 ]; }
|
||||
double& y() { return vec[ 1 ]; }
|
||||
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()) ;
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ namespace CGAL {
|
|||
|
||||
|
||||
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); }
|
||||
|
||||
const double* operator()(const Point& p, int) const
|
||||
|
|
|
|||
Loading…
Reference in New Issue