Core 1.0
|
Set of line segments in the plane. More...
#include <segment.h>
Public Member Functions | |
SegmentSet2 () | |
Empty. | |
SegmentSet2 (const QVector< Vector2 > &, const QVector< int > &) | |
Create a set of line segments from a list of vertices and a indexes. More... | |
QVector< Segment2 > | GetSegments () const |
Get the set of line segments. | |
Segment2 | GetSegment (int) const |
Return the k-th segment. More... | |
Vector2 | Vertex (int) const |
Return the k-th vertex. More... | |
bool | IsEmpty () const |
Check is the set of segments is empty. | |
int | SegmentSize () const |
Return the number of segments. | |
QVector< Polygon2 > | GetPolygons () const |
Get the subset of closed polygons. More... | |
void | Draw (QGraphicsScene &, const QPen &=QPen()) const |
Draw a set of line segments. More... | |
Protected Attributes | |
QVector< Vector2 > | vertices |
Vertices. | |
QVector< int > | indices |
% Segment vertex indices. | |
Set of line segments in the plane.
Segments are stored as set of vertexes, and an index array.
|
explicit |
Create a set of line segments from a list of vertices and a indexes.
Indices should be a multiple of two; the number of segments is derived from the size of the array.
v | Set of vertices. |
i | Indexes that represent the segments. |
void SegmentSet2::Draw | ( | QGraphicsScene & | scene, |
const QPen & | pen = QPen() |
||
) | const |
Draw a set of line segments.
scene | Graphics scene. |
pen | The pen. |
QVector< Polygon2 > SegmentSet2::GetPolygons | ( | ) | const |
Get the subset of closed polygons.
Detects all loops in the structure, open polylines are not returned in the set of polygons.
|
inline |
Return the k-th segment.
k | Index. |
|
inline |
Return the k-th vertex.
k | Index. |