Core 1.0
Public Member Functions | Protected Attributes | List of all members
SegmentSet2 Class Reference

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< Segment2GetSegments () 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< Polygon2GetPolygons () 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< Vector2vertices
 Vertices.
 
QVector< int > indices
 % Segment vertex indices.
 

Detailed Description

Set of line segments in the plane.

Segments are stored as set of vertexes, and an index array.

Constructor & Destructor Documentation

◆ SegmentSet2()

SegmentSet2::SegmentSet2 ( const QVector< Vector2 > &  v,
const QVector< int > &  i 
)
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.

See also
Mesh2
Parameters
vSet of vertices.
iIndexes that represent the segments.

Member Function Documentation

◆ Draw()

void SegmentSet2::Draw ( QGraphicsScene &  scene,
const QPen &  pen = QPen() 
) const

Draw a set of line segments.

Parameters
sceneGraphics scene.
penThe pen.

◆ GetPolygons()

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.

◆ GetSegment()

Segment2 SegmentSet2::GetSegment ( int  k) const
inline

Return the k-th segment.

Parameters
kIndex.

◆ Vertex()

Vector2 SegmentSet2::Vertex ( int  k) const
inline

Return the k-th vertex.

Parameters
kIndex.