Core 1.0
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.
 
QVector< Segment2GetSegments () const
 Get the set of line segments.
 
Segment2 GetSegment (int) const
 Return the k-th segment.
 
Vector2 Vertex (int) const
 Return the k-th vertex.
 
bool IsEmpty () const
 Check is the set of segments is empty.
 
int SegmentSize () const
 Return the number of segments.
 
Polygons2 GetPolygons () const
 Get the subset of closed polygons.
 
void Draw (QGraphicsScene &, const QPen &=QPen()) const
 Draw a set of line segments.
 

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.

This structure is effective for generating the contours of a ScalarField2.

See also
ScalarField2::LineSegments

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()

Polygons2 SegmentSet2::GetPolygons ( ) const

Get the subset of closed polygons.

Detects all loops in the structure and create closed polygons, open polylines are not returned.

◆ 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.