Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
frechet::fs::Grid Class Reference

Detailed Description

performs mappings to and from the free-space grid

Calculations are done in three coordinate systems:

(1) the unit square [0..1]x[0..1] free-space segments are usually in this coordinate system

(2) [0..n]x[0..m] each free-space cell is mapped to its location in the grid with each segment having length 1

2-intervals for the k-Frechet algorithm are expressed in this coordinate system

(3) [0..|P|]x[0..|Q|] each free-space cell is scaled to arc-length. this is the coordinate system used for visualisation.

The Grid class provides functions for converting from one coordinate system to another.

In particular from: [1] to [2] and [3] [2] to [3] and back to [1]

Author
Peter Schäfer

Definition at line 118 of file grid.h.

#include <grid.h>

Public Types

typedef boost::shared_ptr< Gridptr
 smart pointer to a Grid object More...
 

Public Member Functions

 Grid ()
 empty constructor More...
 
void setCurves (const Curve &P, const Curve &Q)
 calculate grid from input curves More...
 
const GridAxishor () const
 
const GridAxisvert () const
 
GridAxishor ()
 
GridAxisvert ()
 
QSizeF size () const
 
QSizeF extent () const
 
QRectF cellBounds (int i, int j) const
 
Point mapPoint (Point p)
 map a point from [0..n]x[0..m] to the grid coordinates [0..|P|]x[0..|Q|] More...
 
QLineF mapLine (QLineF l)
 map a line segment from [0..n]x[0..m] to the grid coordinates [0..|P|]x[0..|Q|] More...
 
QRectF mapRect (QRectF r)
 map a rectangle from [0..n]x[0..m] to the grid coordinates [0..|P|]x[0..|Q|] More...
 
Curve mapCurve (Curve c)
 map a sequence of line segments from [0..n]x[0..m] to the grid coordinates [0..|P|]x[0..|Q|] More...
 
QLineF verticalGridLine (int i)
 map a vertical line More...
 
QLineF horizontalGridLine (int j)
 map a horizontal line More...
 
QRectF sceneRect ()
 

Static Public Member Functions

static Point mapToPoint (const Curve &C, double x)
 given a polygonal curve and an offset, compute the point on the curve More...
 
static QLineF mapToSegment (const Curve &C, double x1, double x2)
 given a polygonal curve and two offsets, compute the corresponding line segment More...
 
static Curve mapToSequence (const Curve &C, double x1, double x2)
 given a polygonal curve and two offsets, compute the sequence of line segment connecting both offsets More...
 
static Curve mapToSequence (const Curve &C, const std::vector< double > &seq)
 given a polygonal curve and list of offsets, compute the sequence of line segment connects the offsets More...
 

Private Attributes

GridAxis _hor
 arc lengths of P == horizontal grid coordinates More...
 
GridAxis _vert
 arc lengths of Q == vertical grid coordinates More...
 

Member Typedef Documentation

◆ ptr

typedef boost::shared_ptr<Grid> frechet::fs::Grid::ptr

smart pointer to a Grid object

Definition at line 128 of file grid.h.

Constructor & Destructor Documentation

◆ Grid()

frechet::fs::Grid::Grid ( )
inline

empty constructor

Definition at line 131 of file grid.h.

Member Function Documentation

◆ cellBounds()

QRectF Grid::cellBounds ( int  i,
int  j 
) const
Parameters
igrid column
jgrid row
Returns
bounding box for a grid cell

Definition at line 76 of file grid.cpp.

◆ extent()

QSizeF Grid::extent ( ) const
Returns
total size of the grid == lengths of input curves

Definition at line 70 of file grid.cpp.

◆ hor() [1/2]

const GridAxis& frechet::fs::Grid::hor ( ) const
inline
Returns
mapping for horizontal grid axis

Definition at line 141 of file grid.h.

◆ hor() [2/2]

GridAxis& frechet::fs::Grid::hor ( )
inline
Returns
mapping for horizontal grid axis

Definition at line 146 of file grid.h.

◆ horizontalGridLine()

QLineF Grid::horizontalGridLine ( int  j)

map a horizontal line

Parameters
jgrid row
Returns
a horizontal grid line, in grid coordinates

Definition at line 118 of file grid.cpp.

◆ mapCurve()

Curve Grid::mapCurve ( Curve  c)

map a sequence of line segments from [0..n]x[0..m] to the grid coordinates [0..|P|]x[0..|Q|]

Parameters
ca sequence of line segments in free-space [0..n]x[0..m]
Returns
the mapped curve in the grid

Definition at line 105 of file grid.cpp.

◆ mapLine()

QLineF Grid::mapLine ( QLineF  l)

map a line segment from [0..n]x[0..m] to the grid coordinates [0..|P|]x[0..|Q|]

Parameters
la line segment in free-space [0..n]x[0..m]
Returns
the mapped line segment in the grid

Definition at line 93 of file grid.cpp.

◆ mapPoint()

Point Grid::mapPoint ( Point  p)

map a point from [0..n]x[0..m] to the grid coordinates [0..|P|]x[0..|Q|]

Parameters
pa location in free-space [0..n]x[0..m]
Returns
the mapped location in the grid

Definition at line 87 of file grid.cpp.

◆ mapRect()

QRectF Grid::mapRect ( QRectF  r)

map a rectangle from [0..n]x[0..m] to the grid coordinates [0..|P|]x[0..|Q|]

Parameters
ra rectangle in free-space [0..n]x[0..m]
Returns
the mapped rectangle in the grid

Definition at line 99 of file grid.cpp.

◆ mapToPoint()

Point Grid::mapToPoint ( const Curve C,
double  x 
)
static

given a polygonal curve and an offset, compute the point on the curve

Parameters
Ca polygonal curve
xoffset on the curve
Returns
point that corresponds to the offset

Definition at line 130 of file grid.cpp.

◆ mapToSegment()

QLineF Grid::mapToSegment ( const Curve C,
double  x1,
double  x2 
)
static

given a polygonal curve and two offsets, compute the corresponding line segment

Parameters
Ca polygonal curve
x1first offset on the curve
x2second offset on the curve
Returns
line segment that connects both offsets

Definition at line 144 of file grid.cpp.

◆ mapToSequence() [1/2]

Curve Grid::mapToSequence ( const Curve C,
double  x1,
double  x2 
)
static

given a polygonal curve and two offsets, compute the sequence of line segment connecting both offsets

Parameters
Ca polygonal curve
x1first offset on the curve
x2second offset on the curve
Returns
sequence of line segments that connects both offsets

Definition at line 149 of file grid.cpp.

◆ mapToSequence() [2/2]

Curve Grid::mapToSequence ( const Curve C,
const std::vector< double > &  seq 
)
static

given a polygonal curve and list of offsets, compute the sequence of line segment connects the offsets

Parameters
Ca polygonal curve
seqa list of offsets on the curve
Returns
sequence of line segments that connects the offsets

Definition at line 163 of file grid.cpp.

◆ sceneRect()

QRectF Grid::sceneRect ( )
Returns
the bounding rectangle for the complete grid

Definition at line 124 of file grid.cpp.

◆ setCurves()

void Grid::setCurves ( const Curve P,
const Curve Q 
)

calculate grid from input curves

Parameters
Pfirst input curve
Qsecond input curve

Definition at line 64 of file grid.cpp.

◆ size()

QSizeF frechet::fs::Grid::size ( ) const
inline
Returns
number of grid cells = number of curve segments = number of curve vertexes-1

Definition at line 154 of file grid.h.

◆ vert() [1/2]

const GridAxis& frechet::fs::Grid::vert ( ) const
inline
Returns
mapping for vertical grid axis

Definition at line 143 of file grid.h.

◆ vert() [2/2]

GridAxis& frechet::fs::Grid::vert ( )
inline
Returns
mapping for vertical grid axis

Definition at line 148 of file grid.h.

◆ verticalGridLine()

QLineF Grid::verticalGridLine ( int  i)

map a vertical line

Parameters
igrid column
Returns
a vertical grid line, in grid coordinates

Definition at line 112 of file grid.cpp.

Member Data Documentation

◆ _hor

GridAxis frechet::fs::Grid::_hor
private

arc lengths of P == horizontal grid coordinates

Definition at line 122 of file grid.h.

◆ _vert

GridAxis frechet::fs::Grid::_vert
private

arc lengths of Q == vertical grid coordinates

Definition at line 124 of file grid.h.


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