All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Nimble::Path Class Reference

Path provides some utility functions to manipulate series of points. More...

#include <Nimble/Path.hpp>

Public Types

typedef std::vector
< Nimble::Vector2f
container
 Container for points on path.
 

Public Member Functions

void addPoint (Nimble::Vector2f p)
 Adds a point to the end of the path.
 
Nimble::Vector2f center () const
 Returns the center of the path computed from the point average.
 
void clear ()
 Clears all points.
 
bool isDegenerate () const
 Returns true if the path only contains two points that are very close to each other.
 
Nimble::Vector2f point (size_t i) const
 Returns the ith point on the path.
 
container points ()
 Returns the points that make up the path.
 
void simplify (float clusterTolerance, float dpTolerance)
 Simplifies the path using a two-pass algorithm. More...
 
void simplifyAngular (float degrees)
 
Simplifies the path by removing points based on the angle each

segment differs from the previous segment. More...

 
size_t size () const
 Returns the number of points on the path.
 
void transform (const Nimble::Matrix3f &m)
 Transforms the points on the path with the given matrix.
 

Static Public Member Functions

static bool intersect (const Path &p1, const Nimble::Matrix3f &m1, const Path &p2, const Nimble::Matrix3f &m2)
 Tests whether two transformed paths intersect.
 

Detailed Description

Path provides some utility functions to manipulate series of points.

Member Function Documentation

void Nimble::Path::simplify ( float  clusterTolerance,
float  dpTolerance 
)

Simplifies the path using a two-pass algorithm.

First, clustered points are merged together and after this a second pass simplification is performed using the Douglas-Plucker method.

Parameters
clusterTolerancepoints within this distance from eachother are merged together
dpTolerancetolerance for Douglas-Plucker method
void Nimble::Path::simplifyAngular ( float  degrees)

Simplifies the path by removing points based on the angle each

segment differs from the previous segment.

Each segment that forms an angle less than the given tolerance from the previous segment is removed.

Parameters
degreesangle tolerance