#include <HxPolyline2d.h>
Public Methods | |
| HxPolyline2d () | |
| Construct an empty polyline. More... | |
| HxPolyline2d (const HxPointSetR2 &v, int close) | |
| Construct a polyline or polygon (closed) from the given set of points. More... | |
| HxPolyline2d (double *px, double *py, int np, int close) | |
| Construct a polyline or polygon (closed) from the given set of coordinates. More... | |
| ~HxPolyline2d () | |
| Destructor. More... | |
| int | ident () const |
| Get the identifier of this object. More... | |
| HxPointSetR2 | getPoints () const |
| Get the points of the object. More... | |
| int | getClosed () const |
| Indicate whether this is a polyline or polygon. More... | |
| int | getNrPoints () const |
| Get the number of points. More... | |
| HxPointR2 | getPoint (int index) const |
| Get the points at the given index. More... | |
| void | getPoints (double *px, double *py) const |
| Fill the given arrays with the coordinates of the points of this object. More... | |
| STD_OSTREAM & | put (STD_OSTREAM &) const |
| Put this object on the given output stream. More... | |
The difference between a polyline and polygon is the closed parameter. The number of points is the same, i.e. in a polygon the start/end point is NOT repeated in the list of points.
|
|
Construct an empty polyline.
00080 {
00081 _ident = _nr++;
00082 }
|
|
||||||||||||
|
Construct a polyline or polygon (closed) from the given set of points.
00085 :
00086 _points(v), _closed(close)
00087 {
00088 _ident = _nr++;
00089 }
|
|
||||||||||||||||||||
|
Construct a polyline or polygon (closed) from the given set of coordinates.
00093 {
00094 for (int i=0 ; i<np ; i++)
00095 _points.push_back(HxPointR2(*px++, *py++));
00096 _closed = close;
00097 _ident = _nr++;
00098 }
|
|
|
Destructor.
00102 {
00103 }
|
|
|
Get the identifier of this object.
00107 {
00108 return _ident;
00109 }
|
|
|
Get the points of the object.
00113 {
00114 return _points;
00115 }
|
|
|
Indicate whether this is a polyline or polygon.
00119 {
00120 return _closed;
00121 }
|
|
|
Get the number of points.
00125 {
00126 return _points.size();
00127 }
|
|
|
Get the points at the given index.
00131 {
00132 return _points[index];
00133 }
|
|
||||||||||||
|
Fill the given arrays with the coordinates of the points of this object. The size of the araays is assumed to match the number of points.
00018 {
00019 HxPointSetR2::const_iterator it = _points.begin();
00020 while (it != _points.end()) {
00021 *px++ = (*it).x();
00022 *py++ = (*it).y();
00023 it++;
00024 }
00025 }
|
|
|
Put this object on the given output stream.
00029 {
00030 HxPointSetR2::const_iterator it = _points.begin();
00031 while (it != _points.end()) {
00032 os << (*it) << ", ";
00033 it++;
00034 }
00035 return os << "closed: " << _closed << STD_ENDL;
00036 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001