Mapper  0.9.0
API documentation
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
OpenOrienteering::PathCoord Class Reference

A PathCoord represents a node in a polygonal approximation of a path. More...

#include <path_coord.h>

Inheritance diagram for OpenOrienteering::PathCoord:
Inheritance graph
[legend]
Collaboration diagram for OpenOrienteering::PathCoord:
Collaboration graph
[legend]

Public Types

using size_type = quint32
 A reaonably sized unsigned integer type for map coord vector sizes and indexes. More...
 
using length_type = float
 A reaonably precise float type for lengths and distances. More...
 
using param_type = float
 A reaonably precise float type for relative position in the range [0, 1). More...
 

Public Member Functions

constexpr PathCoord () noexcept
 Default constructor. More...
 
constexpr PathCoord (const PathCoord &) noexcept=default
 Copy constructor. More...
 
 PathCoord (PathCoord &&) noexcept=default
 Move constructor. More...
 
constexpr PathCoord (const MapCoordF &pos, size_type index, param_type param, length_type clen) noexcept
 Explicit construction with all member values. More...
 
PathCoordoperator= (const PathCoord &) noexcept=default
 Assignment operator. More...
 
PathCoordoperator= (PathCoord &&) noexcept=default
 Move assignment operator. More...
 

Static Public Member Functions

static double bezierError ()
 Global position error threshold for approximating bezier curves with straight segments. More...
 
static bool indexLessThanValue (const PathCoord &coord, size_type value)
 Returns true if the PathCoord's index is lower than value. More...
 
static bool valueLessThanIndex (size_type value, const PathCoord &coord)
 Returns true if the value is lower than the PathCoord's index. More...
 
static void splitBezierCurve (MapCoordF c0, MapCoordF c1, MapCoordF c2, MapCoordF c3, float p, MapCoordF &o0, MapCoordF &o1, MapCoordF &o2, MapCoordF &o3, MapCoordF &o4)
 Splits a cubic bezier curve. More...
 
static constexpr qreal tangentEpsilonSquared ()
 The minimum required (squared) distance of neighboring nodes which are to be considered for determining path tangents. More...
 

Public Attributes

MapCoordF pos
 Position. More...
 
size_type index
 MapCoordVector(F) index of the start of the edge which this position belongs to. More...
 
param_type param
 Relative location of this position on the MapCoordVector edge ([0.0, 1.0)). More...
 
length_type clen
 Cumulative length of the path since the start of the current part. More...
 

Friends

class PathCoordVector
 

Detailed Description

A PathCoord represents a node in a polygonal approximation of a path.

Complex paths which may consist of straight edges and curves are processed into PathCoordVectors, approximating the path with straight edges only.

Apart from a point on this polygonal path, a PathCoord contains additional information about that point:

Member Typedef Documentation

◆ length_type

A reaonably precise float type for lengths and distances.

◆ param_type

A reaonably precise float type for relative position in the range [0, 1).

◆ size_type

A reaonably sized unsigned integer type for map coord vector sizes and indexes.

Constructor & Destructor Documentation

◆ PathCoord() [1/4]

constexpr OpenOrienteering::PathCoord::PathCoord ( )
noexcept

Default constructor.

◆ PathCoord() [2/4]

constexpr OpenOrienteering::PathCoord::PathCoord ( const PathCoord )
defaultnoexcept

Copy constructor.

◆ PathCoord() [3/4]

OpenOrienteering::PathCoord::PathCoord ( PathCoord &&  )
defaultnoexcept

Move constructor.

◆ PathCoord() [4/4]

constexpr OpenOrienteering::PathCoord::PathCoord ( const MapCoordF pos,
size_type  index,
param_type  param,
PathCoord::length_type  clen 
)
noexcept

Explicit construction with all member values.

Member Function Documentation

◆ bezierError()

double OpenOrienteering::PathCoord::bezierError ( )
static

Global position error threshold for approximating bezier curves with straight segments.

Todo:
Make bezier error configurable

◆ indexLessThanValue()

bool OpenOrienteering::PathCoord::indexLessThanValue ( const PathCoord coord,
size_type  value 
)
static

Returns true if the PathCoord's index is lower than value.

This function can be used for doing a binary search on a sorted container of PathCoords.

See also
std::lower_bound

◆ operator=() [1/2]

PathCoord& OpenOrienteering::PathCoord::operator= ( const PathCoord )
defaultnoexcept

Assignment operator.

◆ operator=() [2/2]

PathCoord& OpenOrienteering::PathCoord::operator= ( PathCoord &&  )
defaultnoexcept

Move assignment operator.

◆ splitBezierCurve()

void OpenOrienteering::PathCoord::splitBezierCurve ( MapCoordF  c0,
MapCoordF  c1,
MapCoordF  c2,
MapCoordF  c3,
float  p,
MapCoordF o0,
MapCoordF o1,
MapCoordF o2,
MapCoordF o3,
MapCoordF o4 
)
static

Splits a cubic bezier curve.

The curve made up by the points c0 ... c3 is split up at the relative position p (0..1). The new intermediate points (between c0 and c3) are returned in o0 ... o4.

If not all returned values are needed, it is possible to have a subset of o0..o4 point to the same memory.

◆ tangentEpsilonSquared()

constexpr qreal OpenOrienteering::PathCoord::tangentEpsilonSquared ( )
static

The minimum required (squared) distance of neighboring nodes which are to be considered for determining path tangents.

◆ valueLessThanIndex()

bool OpenOrienteering::PathCoord::valueLessThanIndex ( size_type  value,
const PathCoord coord 
)
static

Returns true if the value is lower than the PathCoord's index.

This function can be used for doing a binary search on a sorted container of PathCoords.

See also
std::upper_bound

Friends And Related Function Documentation

◆ PathCoordVector

friend class PathCoordVector
friend

Member Data Documentation

◆ clen

length_type OpenOrienteering::PathCoord::clen

Cumulative length of the path since the start of the current part.

◆ index

size_type OpenOrienteering::PathCoord::index

MapCoordVector(F) index of the start of the edge which this position belongs to.

◆ param

param_type OpenOrienteering::PathCoord::param

Relative location of this position on the MapCoordVector edge ([0.0, 1.0)).

◆ pos

MapCoordF OpenOrienteering::PathCoord::pos

Position.


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