333
335
#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
338
template <class IndicesIterator>
339
std::size_t insert_constraints( const std::vector<Point>& points,
340
IndicesIterator indices_first,
341
IndicesIterator indices_beyond )
343
typedef std::vector<std::ptrdiff_t> Vertex_indices;
344
typedef std::vector<Vertex_handle> Vertices;
346
Vertex_indices vertex_indices;
347
vertex_indices.resize(points.size());
349
std::copy(boost::counting_iterator<std::ptrdiff_t>(0),
350
boost::counting_iterator<std::ptrdiff_t>(points.size()),
351
std::back_inserter(vertex_indices));
353
size_type n = this->number_of_vertices();
354
Spatial_sort_traits_adapter_2<Gt, const Point*> sort_traits(&(points[0]));
356
spatial_sort(vertex_indices.begin(), vertex_indices.end(), sort_traits);
359
vertices.resize(points.size());
362
for(typename Vertex_indices::const_iterator
363
it_pti = vertex_indices.begin(), end = vertex_indices.end();
364
it_pti != end; ++it_pti)
366
vertices[*it_pti] = insert(points[*it_pti], hint);
367
hint=vertices[*it_pti]->face();
370
for(IndicesIterator it_cst=indices_first, end=indices_beyond;
371
it_cst!=end; ++it_cst)
373
Vertex_handle v1 = vertices[it_cst->first];
374
Vertex_handle v2 = vertices[it_cst->second];
375
if(v1 != v2) insert_constraint(v1, v2);
378
return this->number_of_vertices() - n;
381
template <class PointIterator, class IndicesIterator>
382
std::size_t insert_constraints(PointIterator points_first,
383
PointIterator points_beyond,
384
IndicesIterator indices_first,
385
IndicesIterator indices_beyond)
387
std::vector<Point> points(points_first, points_beyond);
388
return insert_constraints(points, indices_first, indices_beyond);
391
template <class Segment_2>
392
static const Point& get_source(const Segment_2& segment){
393
return segment.source();
395
template <class Segment_2>
396
static const Point& get_target(const Segment_2& segment){
397
return segment.target();
400
static const Point& get_source(const Constraint& cst){
403
static const Point& get_target(const Constraint& cst){
407
template <class ConstraintIterator>
408
std::size_t insert_constraints(ConstraintIterator first,
409
ConstraintIterator beyond)
411
std::vector<Point> points;
412
for (ConstraintIterator s_it=first; s_it!=beyond; ++s_it)
414
points.push_back( get_source(*s_it) );
415
points.push_back( get_target(*s_it) );
418
std::vector< std::pair<std::size_t, std::size_t> > segment_indices;
419
std::size_t nb_segments = points.size() / 2;
420
segment_indices.reserve( nb_segments );
421
for (std::size_t k=0; k < nb_segments; ++k)
422
segment_indices.push_back( std::make_pair(2*k,2*k+1) );
424
return insert_constraints( points,
425
segment_indices.begin(),
426
segment_indices.end() );
335
429
template <class OutputItFaces, class OutputItBoundaryEdges>
336
430
std::pair<OutputItFaces,OutputItBoundaryEdges>
337
431
get_conflicts_and_boundary(const Point &p,