Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
frechet::poly::Segment Class Reference

Detailed Description

Represents a polygon line segment from node i to j.

Note that polygon edges are meant to be oriented, i.e. j==i+1 The last edge back to the starting point is therefore encoded as (n-1,n) (instead of (n-1,0)). The equation j==i+1 indicates proper polygon edges and indices should be taken modulo n.

However. For diagonals, orientation is not encoded, therefore i < j so that we can sort and identify diagonals.

If this seems confusing, we should think about introducing two data types, (one for edges, another one for diagonals), or introduce a flag for edges.

Author
Peter Schäfer

Definition at line 39 of file types.h.

#include <types.h>

Inherits pair< int, int >.

Public Member Functions

 Segment ()
 empty constructor; creates an invalid polygon segment More...
 
 Segment (int i, int j)
 default constructor with vertices. For poylgon edge segments, j==i+1 or j+1==i is expected. For diagonal segements, j!=i+1. More...
 
bool empty () const
 
bool is_diagonal (int n) const
 
bool is_edge (int n) const
 
bool operator< (const Segment &that) const
 ordering operator. Imposes a natural ordering on segments, which is useful for sorting sets of segments. More...
 
QLineF map (const Curve &curve) const
 map (embed) segment to a line in the plane More...
 

Static Public Member Functions

static QPointF map (const Curve &curve, int i)
 map a polygon vertex to a point in the plane More...
 

Constructor & Destructor Documentation

◆ Segment() [1/2]

frechet::poly::Segment::Segment ( )
inline

empty constructor; creates an invalid polygon segment

Definition at line 45 of file types.h.

◆ Segment() [2/2]

frechet::poly::Segment::Segment ( int  i,
int  j 
)
inline

default constructor with vertices. For poylgon edge segments, j==i+1 or j+1==i is expected. For diagonal segements, j!=i+1.

Parameters
ifirst vertex
jsecond vertex

Definition at line 53 of file types.h.

Member Function Documentation

◆ empty()

bool frechet::poly::Segment::empty ( ) const
inline
Returns
true if the segment is empty, or invalid

Definition at line 62 of file types.h.

◆ is_diagonal()

bool frechet::poly::Segment::is_diagonal ( int  n) const
inline
Parameters
nnumber of vertices in polygon
Returns
true if this segment describes a polygon diagonal

Definition at line 69 of file types.h.

◆ is_edge()

bool frechet::poly::Segment::is_edge ( int  n) const
inline
Parameters
nnumber of vertices in polygon
Returns
true if this segment describes a polygon egde segment

Definition at line 76 of file types.h.

◆ map() [1/2]

QLineF frechet::poly::Segment::map ( const Curve curve) const
inline

map (embed) segment to a line in the plane

Parameters
curvea polygonal curve
Returns
segment embedded in the plane

Definition at line 98 of file types.h.

◆ map() [2/2]

static QPointF frechet::poly::Segment::map ( const Curve curve,
int  i 
)
inlinestatic

map a polygon vertex to a point in the plane

Parameters
curvea polygonal curve
iindex of vertex (modulo n)
Returns
point in the plane

Definition at line 107 of file types.h.

◆ operator<()

bool frechet::poly::Segment::operator< ( const Segment that) const
inline

ordering operator. Imposes a natural ordering on segments, which is useful for sorting sets of segments.

Parameters
thatsegment to compare with
Returns
true if *this < that

Definition at line 86 of file types.h.


The documentation for this class was generated from the following file: