xc
PolyPos.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //PolyPos.h
22 
23 #ifndef POLYPOS_H
24 #define POLYPOS_H
25 
26 #include <deque>
27 #include "../cgal_types.h"
28 #include "utility/utils/misc_utils/matem.h"
29 #include "utility/geom/proximity.h"
30 
32 //
34 template<class pos>
35 class PolyPos : public std::deque<pos>
36  {
37  protected:
38  typedef std::deque<pos> deque_pos;
39  //Auxiliary function.
40  static GEOM_FT g(GEOM_FT v1, GEOM_FT v2)
41  { return (sqr(v1) + v1 * v2 + sqr(v2)); }
42  public:
43  typedef typename deque_pos::iterator iterator;
44  typedef typename deque_pos::const_iterator const_iterator;
45  typedef typename pos::vector vector;
46 
47  protected:
48  void simplify_select(GEOM_FT epsilon, iterator it1, iterator it2, std::set<const_iterator> &selected);
49  void remove_selected(std::set<const_iterator> &selected);
50  void select_repeated(std::set<const_iterator> &selected, const GEOM_FT &tol= 0.0);
51  void select_backward_segments(std::set<const_iterator> &selected, const GEOM_FT &tol);
52  public:
53 
54  PolyPos(void): deque_pos() {}
55 
56  explicit PolyPos(const std::deque<pos> &dq_pos)
57  : std::deque<pos>(dq_pos) {}
58 
59  pos getFromPoint(void) const
60  { return this->front(); }
61 
62  pos getToPoint(void) const
63  { return this->back(); }
64 
65  bool operator==(const PolyPos<pos> &other) const
66  {
67  return ( (const deque_pos &) (*this) == (const deque_pos &) other );
68  }
69  inline pos *Agrega(const pos &p)
70  {
71  deque_pos::push_back(p);
72  return &(this->back());
73  }
74  inline void Agrega(const PolyPos<pos> &p)
75  { Cat(p); }
76  inline void AgregaSiNuevo(const PolyPos<pos> &p);
79  template <class InputIterator>
80  void extend(InputIterator first, InputIterator last)
81  {
82  for(InputIterator i= first;i!=last; i++)
83  Agrega(*i);
84  }
85  void AgregaSiNuevo(const pos &);
86  const_iterator find(const pos &p) const
87  { return std::find(this->begin(),this->end(),p); }
88  iterator find(const pos &p)
89  { return std::find(this->begin(),this->end(),p); }
90  bool In(const pos &p) const;
91  void close(void);
92  bool isClosed(const GEOM_FT &tol= 1e-6) const;
93  GEOM_FT getLength(void) const;
94  std::vector<GEOM_FT> getLengths(void) const;
95  boost::python::list getLengthsPy(void) const;
96  GEOM_FT getLengthUntilVertex(const_iterator) const;
97  const_iterator getSegmentAtLength(const GEOM_FT &s) const;
98  int getIndexOfSegmentAtLength(const GEOM_FT &s) const;
99  int getIndexOfSegmentAtParam(const GEOM_FT &lambda) const;
100  boost::python::list getIthCoordinates(unsigned short i) const;
101  GEOM_FT GetMax(unsigned short i) const;
102  GEOM_FT GetMin(unsigned short i) const;
103  PolyPos GetMayores(unsigned short int i,const GEOM_FT &d) const;
104  PolyPos GetMenores(unsigned short int i,const GEOM_FT &d) const;
105  pos getCenterOfMass(void) const;
106  pos getWeightedCenterOfMass(const std::deque<GEOM_FT> &) const;
107  PolyPos<pos> getSwap(void) const;
108  void swap(void)
109  { *this= this->getSwap(); }
110  std::deque<GEOM_FT> &GetSeparaciones(void) const;
111  GEOM_FT GetSeparacionMedia(void) const;
112 
113  iterator getNearestPoint(const pos &);
114  const_iterator getNearestPoint(const pos &) const;
115  iterator getFarthestPoint(const pos &);
116  const_iterator getFarthestPoint(const pos &) const;
117  virtual iterator getFarthestPointFromSegment(iterator it1, iterator it2, GEOM_FT &pMaxDist);
118  void simplify(GEOM_FT epsilon, iterator it1, iterator it2);
119  void simplify(GEOM_FT epsilon);
120  PolyPos<pos> getSimplified(GEOM_FT epsilon) const;
121  void removeRepeated(const GEOM_FT &tol= 0.0);
122  void removeBackwardSegments(const GEOM_FT &tol);
123 
124  void Cat(const PolyPos<pos> &l);
125  template <class inputIterator>
126  void Cat(inputIterator begin, inputIterator end);
127  };
128 
129 
131 template <class pos>
132 bool PolyPos<pos>::In(const pos &p) const
133  { return (find(p)!=this->end()); }
134 
136 template <class pos>
137 void PolyPos<pos>::AgregaSiNuevo(const pos &p)
138  {
139  if(!In(p))
140  this->push_back(p);
141  }
142 
144 template <class pos>
146  {
147  if(!isClosed())
148  {
149  const pos &first= this->front();
150  this->push_back(first);
151  }
152  }
153 
155 template <class pos>
156 bool PolyPos<pos>::isClosed(const GEOM_FT &tol) const
157  {
158  bool retval= false;
159  const GEOM_FT treshold= tol*getLength();
160  const pos &first= this->front();
161  const pos &last= this->back();
162  if(dist(first,last)<treshold)
163  retval= true;
164  return retval;
165  }
166 
168 template <class pos>
169 GEOM_FT PolyPos<pos>::getLength(void) const
170  { return getLengthUntilVertex(this->end()); }
171 
174 //
176 template <class pos>
177 GEOM_FT PolyPos<pos>::getLengthUntilVertex(const_iterator nth) const
178  {
179  if(this->size()<2) return 0.0;
180  GEOM_FT temp = 0;
181  const_iterator last= this->end();
182  if(nth<last)
183  last= nth;
184  const_iterator j;
185  for(const_iterator i=this->begin(); i != last; i++)
186  {
187  j= i;j++;
188  if (j!=this->end()) temp += dist(*i,*j);
189  }
190  return temp;
191  }
192 
194 template <class pos>
195 std::vector<GEOM_FT> PolyPos<pos>::getLengths(void) const
196  {
197  const size_t sz= this->size();
198  std::vector<GEOM_FT> retval(sz, 0.0);
199  if(sz>1)
200  {
201  GEOM_FT temp = 0;
202  const_iterator last= this->end();
203  const_iterator j;
204  size_t count= 1;
205  for(const_iterator i=this->begin(); i != std::prev(last); i++, count++)
206  {
207  j= std::next(i);
208  temp+= dist(*i,*j);
209  retval[count]= temp;
210  }
211  }
212  return retval;
213  }
214 
216 template <class pos>
217 boost::python::list PolyPos<pos>::getLengthsPy(void) const
218  {
219  const std::vector<GEOM_FT> lengths= this->getLengths();
220  boost::python::list retval;
221  for(std::vector<GEOM_FT>::const_iterator i= lengths.begin(); i!=lengths.end(); i++)
222  retval.append(*i);
223  return retval;
224  }
225 
228 //
230 template <class pos>
231 typename PolyPos<pos>::const_iterator PolyPos<pos>::getSegmentAtLength(const GEOM_FT &s) const
232  {
233  const_iterator retval= this->end(); // past the end
234  const size_t sz= this->size();
235  if(sz<2)
236  {
237  std::cerr << "PolyPos<>::" << __FUNCTION__
238  << ";ERROR: no segments, so no length." << std::endl;
239  }
240  else
241  {
242  if(s<=0.0)
243  {
244  retval= this->begin();
245  if(s<0.0)
246  std::clog << "PolyPos<>::" << __FUNCTION__
247  << ";WARNING: length argument: " << s
248  << " negative. First segment returned."
249  << std::endl;
250  }
251  else
252  {
253  GEOM_FT totalLength= this->getLength();
254  if(s<=totalLength)
255  {
256  GEOM_FT temp = 0; //Distance from origin.
257  retval= this->begin();
258  const_iterator j;
259  for(const_iterator i=this->begin(); i != this->end(); i++)
260  {
261  j= i;j++;
262  if(j!=this->end())
263  {
264  temp+= dist(*i,*j); // increment distance.
265  if(temp>=s) //we found it.
266  {
267  retval= i;
268  break;
269  }
270  }
271  }
272  }
273  else
274  {
275  std::clog << "PolyPos<>::" << __FUNCTION__
276  << ";WARNING: length argument: " << s
277  << " greater than total length: " << totalLength
278  << std::endl;
279  retval= this->end()-2; // return last segment.
280  }
281  }
282  }
283  return retval;
284  }
285 
290 template <class pos>
291 int PolyPos<pos>::getIndexOfSegmentAtLength(const GEOM_FT &s) const
292  {
293  const_iterator i= this->getSegmentAtLength(s);
294  return std::distance(this->begin(), i);
295  }
296 
301 template <class pos>
302 int PolyPos<pos>::getIndexOfSegmentAtParam(const GEOM_FT &lambda) const
303  { return this->getIndexOfSegmentAtParam(lambda*this->getLength()); }
304 
306 template <class pos>
307 boost::python::list PolyPos<pos>::getIthCoordinates(unsigned short j) const
308  {
309  boost::python::list retval;
310  if(!this->empty())
311  {
312  for(const_iterator i=this->begin();i!=this->end(); i++)
313  {
314  const GEOM_FT value= (*i)[j];
315  retval.append(value);
316  }
317  }
318  return retval;
319  }
320 
322 template <class pos>
323 GEOM_FT PolyPos<pos>::GetMax(unsigned short j) const
324  {
325  GEOM_FT retval(0.0);
326  if(!this->empty())
327  {
328  const_iterator i=this->begin();
329  retval= (*i)(j);
330  for(; i != this->end(); i++)
331  retval= std::max(retval,(*i)(j));
332  }
333  return retval;
334  }
335 
337 template <class pos>
338 GEOM_FT PolyPos<pos>::GetMin(unsigned short j) const
339  {
340  GEOM_FT retval(0.0);
341  if(!this->empty())
342  {
343  const_iterator i=this->begin();
344  retval= (*i)(j);
345  for(; i != this->end(); i++)
346  retval= std::min(retval,(*i)(j));
347  }
348  return retval;
349  }
350 
351 template <class pos>
354  {
355  const size_t sz= this->size();
356  const pos org= pos();
357  if(sz<1) return org;
358  if(sz<2) return *(this->begin());
359  const_iterator i= this->begin();
360  vector vpos_center_of_mass((*i).VectorPos());
361  i++;
362  for(; i != this->end(); i++)
363  vpos_center_of_mass= vpos_center_of_mass + (*i).VectorPos();
364  vpos_center_of_mass= vpos_center_of_mass * (1.0/sz);
365  return org+ vpos_center_of_mass;
366  }
367 
368 template <class pos>
370 pos PolyPos<pos>::getWeightedCenterOfMass(const std::deque<GEOM_FT> &areas) const
371  {
372  pos retval;
373  const size_t sz= this->size();
374  if(sz>0)
375  {
376  assert(sz==areas.size());
377  if(sz<2)
378  retval= *(this->begin());
379  else
380  {
381  std::deque<GEOM_FT>::const_iterator iArea= areas.begin();
382  GEOM_FT areaTot(0.0);
383  const_iterator i= this->begin();
384  vector vpos_center_of_mass((*i).VectorPos()*(*iArea));
385  areaTot+= *iArea;
386  i++; iArea++;
387  for(; i != this->end(); i++)
388  {
389  vpos_center_of_mass= vpos_center_of_mass + (*i).VectorPos()*(*iArea);
390  areaTot+= *iArea;
391  }
392  if(areaTot!=0.0)
393  {
394  vpos_center_of_mass= vpos_center_of_mass * (1.0/areaTot);
395  retval= pos()+vpos_center_of_mass;
396  }
397  }
398  }
399  return retval;
400  }
401 
403 template <class pos>
405  {
406  PolyPos<pos> retval(*this);
407  const size_t sz= this->size();
408  if (sz<2) return retval;
409  for(size_t i=0; i<sz; i++)
410  retval[sz-i-1]= (*this)[i];
411  return retval;
412  }
413 
415 template <class pos>
416 std::deque<GEOM_FT> &PolyPos<pos>::GetSeparaciones(void) const
417  {
418  const size_t sz= this->size();
419  static std::deque<GEOM_FT> retval;
420  retval.resize(sz);
421  const GEOM_FT grande= 10.0*getBnd((*this)).Diagonal().GetModulus();
422  for(size_t i= 0;i<sz;i++)
423  retval[i]= grande;
424  if(sz>1)
425  {
426  GEOM_FT d;
427  for(size_t i= 0;i<sz;i++)
428  {
429  const pos &pi= (*this)[i];
430  for(size_t j= 0;j<sz;j++)
431  if(i!=j)
432  {
433  const pos &pj= (*this)[j];
434  d= dist(pi,pj);
435  if(d<retval[i] && d>0.0)
436  retval[i]= d;
437  }
438  }
439  }
440  return retval;
441  }
442 
444 template <class pos>
446  {
447  GEOM_FT retval(0);
448  const size_t sz= this->size();
449  if(sz>0)
450  {
451  const std::deque<GEOM_FT> &seps= this->GetSeparaciones();
452  for(size_t i= 0;i<sz;i++)
453  retval+= seps[i];
454  retval/=sz;
455  }
456  return retval;
457  }
458 
459 template <class pos>
460 PolyPos<pos> PolyPos<pos>::GetMayores(unsigned short int i,const GEOM_FT &d) const
461  {
462  PolyPos<pos> retval;
463  for(const_iterator j=this->begin();j != this->end();j++)
464  if ((*j)(i) > d) retval.push_back(*j);
465  return retval;
466  }
467 
468 template <class pos>
469 PolyPos<pos> PolyPos<pos>::GetMenores(unsigned short int i,const GEOM_FT &d) const
470  {
471  PolyPos<pos> retval;
472  for(const_iterator j=this->begin();j != this->end();j++)
473  if ((*j)(i) < d) retval.push_back(*j);
474  return retval;
475  }
476 
478 template <class pos>
479 typename PolyPos<pos>::iterator PolyPos<pos>::getNearestPoint(const pos &p)
480  { return nearest(this->begin(), this->end(),p); }
481 
483 template <class pos>
484 typename PolyPos<pos>::const_iterator PolyPos<pos>::getNearestPoint(const pos &p) const
485  { return nearest(this->begin(), this->end(),p); }
486 
488 template <class pos>
489 typename PolyPos<pos>::iterator PolyPos<pos>::getFarthestPoint(const pos &p)
490  {
491  iterator i= this->begin();
492  iterator retval= i; i++;
493  GEOM_FT maxDist= dist(p,*retval);
494  GEOM_FT d= 0.0;
495  for(;i!= this->end();i++)
496  {
497  d= dist(p,*i);
498  if(d>maxDist)
499  {
500  maxDist= d;
501  retval= i;
502  }
503  }
504  return retval;
505  }
506 
508 template <class pos>
509 typename PolyPos<pos>::const_iterator PolyPos<pos>::getFarthestPoint(const pos &p) const
510  {
511  PolyPos<pos> *this_no_const= const_cast<PolyPos<pos> *>(this);
512  return this_no_const->getFarthestPoint(p);
513  }
514 
521 template <class pos>
522 typename PolyPos<pos>::iterator PolyPos<pos>::getFarthestPointFromSegment(iterator , iterator , GEOM_FT &)
523  {
524  std::cerr << "PolyPos<>::" << __FUNCTION__
525  << ";must be redefined in derived classes." << std::endl;
526  return this->begin();
527  }
528 
534 template <class pos>
535 void PolyPos<pos>::select_repeated(std::set<const_iterator> &selected, const GEOM_FT &tol)
536  {
537  GEOM_FT localTol= 10*DBL_EPSILON; // default tolerance.
538  if(tol>0.0)
539  localTol= tol;
540  const size_t sz= this->size();
541  if(sz>1) // if more than one vertex.
542  {
543  iterator i= this->begin();
544  pos p0= *i; i++;
545  for(; i!= this->end(); i++)
546  {
547  const pos &p1= *i;
548  const GEOM_FT d= dist(p1, p0);
549  if(d<localTol)
550  selected.insert(i);
551  p0= p1;
552  }
553  }
554  }
555 
561 template <class pos>
562 void PolyPos<pos>::select_backward_segments(std::set<const_iterator> &selected, const GEOM_FT &tol)
563  {
564  const size_t sz= this->size();
565  if(sz>2) // if more than one segment.
566  {
567  iterator i= this->begin();
568  pos p0= *i; i++;
569  pos p1= *i; i++;
570  vector iVector0= (p1-p0).getNormalized();
571  GEOM_FT dot= 0.0;
572  for(; i!= this->end(); i++)
573  {
574  if(dot>=tol) // don't update p0 if the vertex will be removed.
575  p0= p1;
576  p1= *i;
577  vector iVector1= (p1-p0).getNormalized();
578  dot= iVector1.GetDot(iVector0);
579  if(dot<tol)
580  selected.insert(i);
581  else // don't update iVector0 if the vertex will be removed.
582  iVector0= iVector1;
583  }
584  }
585  if(10*selected.size()>2*sz)
586  std::clog << "PolyPos<>::" << __FUNCTION__
587  << ";WARNING: many backwards segments (" << selected.size()
588  << "/" << sz << "), check input data."
589  << std::endl;
590  }
591 
596 template <class pos>
597 void PolyPos<pos>::removeRepeated(const GEOM_FT &tol)
598  {
599  std::set<const_iterator> repeated;
600  select_repeated(repeated, tol);
601  remove_selected(repeated);
602  }
603 
608 template <class pos>
609 void PolyPos<pos>::removeBackwardSegments(const GEOM_FT &tol)
610  {
611  std::set<const_iterator> backwards;
612  select_backward_segments(backwards, tol);
613  remove_selected(backwards);
614  }
615 
624 template <class pos>
625 void PolyPos<pos>::simplify_select(GEOM_FT epsilon, iterator it1, iterator it2, std::set<const_iterator> &selected)
626  {
627  if (distance(it1, it2) <= 1) return;
628 
629  // Acquire the farthest point from the segment it1, it2
630  GEOM_FT dist= -1.0;
631  iterator index= getFarthestPointFromSegment(it1, it2, dist);
632 
633  // If the farthest point exceeds epsilon, recurse, with index as pivot.
634  if(dist > epsilon)
635  {
636  simplify_select(epsilon, it1, index, selected);
637  simplify_select(epsilon, index, it2, selected);
638  }
639  else
640  {
641  // Mark to delete everything except it1 and it2.
642  auto it = it1;
643  it++;
644  for(; it < it2; it++)
645  {
646  selected.insert(it); // add it to the deletion list.
647  }
648  }
649  }
650 
653 template <class pos>
654 void PolyPos<pos>::remove_selected(std::set<const_iterator> &selected)
655  {
656  static std::deque<pos> tmp;
657  tmp.clear();
658  for(const_iterator i= this->begin(); i!= this->end(); i++)
659  if(selected.find(i)==selected.end()) // not selected to remove.
660  tmp.push_back(*i);
661  this->clear();
662  this->assign(tmp.begin(), tmp.end());
663  }
664 
672 template <class pos>
673 void PolyPos<pos>::simplify(GEOM_FT epsilon, iterator it1, iterator it2)
674  {
675  if (distance(it1, it2) <= 1) return;
676 
677  std::set<const_iterator> selected;
678  simplify_select(epsilon, it1, it2, selected);
679  remove_selected(selected);
680  }
681 
688 template <class pos>
689 void PolyPos<pos>::simplify(GEOM_FT epsilon)
690  {
691  const bool closed= this->isClosed();
692  if(closed)
693  {
694  std::set<const_iterator> selected;
695  iterator i= this->begin();
696  iterator j= this->getFarthestPoint(*i);
697  simplify_select(epsilon,i,j, selected);
698  i= j;
699  j= this->end(); --j; //Last point.
700  simplify_select(epsilon,i,j, selected);
701  // Erase the simplified vertexes.
702  remove_selected(selected);
703  }
704  else
705  {
706  iterator i= this->begin();
707  iterator j= this->end(); --j; //Last point.
708  simplify(epsilon,i,j);
709  }
710  }
711 
717 template <class pos>
719  {
720  PolyPos<pos> retval(*this);
721  retval->simplify(epsilon);
722  return retval;
723  }
724 
725 template <class pos>
727  {
728  for(typename PolyPos<pos>::const_iterator k= l.begin();k!=l.end();k++)
729  this->AgregaSiNuevo(*k);
730  }
731 
732 template <class pos>
733 void PolyPos<pos>::Cat(const PolyPos<pos> &l)
734  {
735  for(typename PolyPos<pos>::const_iterator k= l.begin();k!=l.end();k++)
736  this->push_back(*k);
737  }
738 
740 template <class pos> template<class inputIterator>
741 void PolyPos<pos>::Cat(inputIterator begin, inputIterator end)
742  {
743  for(inputIterator i= begin;i!=end;i++)
744  this->push_back(*i);
745  }
746 
747 template <class pos>
748 std::ostream &operator<<(std::ostream &os,const PolyPos<pos> &l)
749  {
750  if(l.size()<1) return os;
751  typedef typename PolyPos<pos>::const_iterator c_iterator;
752  c_iterator i= l.begin();
753  os << *i; i++;
754  for(;i!= l.end();i++)
755  os << " , " << *i;
756  return os;
757  }
758 
759 
760 #endif
761 
762 
763 
764 
765 
766 
bool In(const pos &p) const
Return true if the points is on en la lista.
Definition: PolyPos.h:132
bool isClosed(const GEOM_FT &tol=1e-6) const
True if dist(lastPoint,firstPoint)< tol*length.
Definition: PolyPos.h:156
void simplify_select(GEOM_FT epsilon, iterator it1, iterator it2, std::set< const_iterator > &selected)
Douglas Peucker algorithm implementation.
Definition: PolyPos.h:625
std::vector< GEOM_FT > getLengths(void) const
Return the lengths corresponding to each vertex.
Definition: PolyPos.h:195
PolyPos< pos > getSwap(void) const
Return a list with the elements in reverse order.
Definition: PolyPos.h:404
Base class for position lists.
Definition: PolyPos.h:35
void remove_selected(std::set< const_iterator > &selected)
Removes the selected items.
Definition: PolyPos.h:654
virtual GEOM_FT GetModulus(void) const
Return el módulo del vector.
Definition: Vector2d.cc:193
GEOM_FT GetSeparacionMedia(void) const
Return the average distance between points.
Definition: PolyPos.h:445
void close(void)
Close the point list (insert the first point as its last one)
Definition: PolyPos.h:145
pos getCenterOfMass(void) const
Return the center of mass del polígono.
Definition: PolyPos.h:353
iterator getNearestPoint(const pos &)
Returns the nearest point from those of the list.
Definition: PolyPos.h:479
virtual iterator getFarthestPointFromSegment(iterator it1, iterator it2, GEOM_FT &pMaxDist)
Definition: PolyPos.h:522
void select_backward_segments(std::set< const_iterator > &selected, const GEOM_FT &tol)
Select backward segments.
Definition: PolyPos.h:562
const_iterator getSegmentAtLength(const GEOM_FT &s) const
Return an iterator pointing to the vertex that is just before the point at a distance "s" measured al...
Definition: PolyPos.h:231
void removeBackwardSegments(const GEOM_FT &tol)
remove backward segments.
Definition: PolyPos.h:609
int getIndexOfSegmentAtLength(const GEOM_FT &s) const
Return the index of the segment that lies at the point at a distance "s" measured along the polyline ...
Definition: PolyPos.h:291
iterator getFarthestPoint(const pos &)
Returns the farthest point from those of the list.
Definition: PolyPos.h:489
std::deque< GEOM_FT > & GetSeparaciones(void) const
Compute the distance from each point to the nearest one.
Definition: PolyPos.h:416
boost::python::list getIthCoordinates(unsigned short i) const
Return the list of values for j-th coordinate.
Definition: PolyPos.h:307
GEOM_FT GetMin(unsigned short i) const
Return the minimum value of j-th coordinate.
Definition: PolyPos.h:338
PolyPos< pos > getSimplified(GEOM_FT epsilon) const
!
Definition: PolyPos.h:718
int getIndexOfSegmentAtParam(const GEOM_FT &lambda) const
Return the index of the segment that lies at the point at a distance "lambda*L" measured along the po...
Definition: PolyPos.h:302
GEOM_FT getLengthUntilVertex(const_iterator) const
Return the length of the PolyPos until the vertex pointed by the iterator.
Definition: PolyPos.h:177
pos getWeightedCenterOfMass(const std::deque< GEOM_FT > &) const
Return the center of mass del polígono.
Definition: PolyPos.h:370
GEOM_FT getLength(void) const
Return the length of the PolyPos.
Definition: PolyPos.h:169
GEOM_FT GetMax(unsigned short i) const
Return the maximum value of j-th coordinate.
Definition: PolyPos.h:323
void removeRepeated(const GEOM_FT &tol=0.0)
remove repeated vertexes.
Definition: PolyPos.h:597
boost::python::list getLengthsPy(void) const
Return the lengths corresponding to each vertex in a Python list.
Definition: PolyPos.h:217
void simplify(GEOM_FT epsilon, iterator it1, iterator it2)
Douglas Peucker algorithm implementation.
Definition: PolyPos.h:673
void select_repeated(std::set< const_iterator > &selected, const GEOM_FT &tol=0.0)
Select repeated vertexes.
Definition: PolyPos.h:535
void extend(InputIterator first, InputIterator last)
Append the vertices between [first,last) to thebefore end of the list.
Definition: PolyPos.h:80