#include <girl/girlPath.hpp>
Public Member Functions | |
path (const girl::point &startPt=girl::point(0, 0)) | |
Default constructor. | |
path (const girl::point &startPt, const std::deque< girl::direction > &dirs) | |
Constructor. | |
path (const girl::point &startPt, const girl::point &endPt, const std::deque< girl::direction > &dirs) | |
Constructor. | |
path (const girl::contour &c) | |
Constructor. | |
void | set (const girl::point &startPt, const std::deque< girl::direction > &dirs) |
Set path from a starting point startPt and a deque of directions dirs. | |
void | set (const girl::point &startPt, const girl::point &endPt, const std::deque< girl::direction > &dirs) |
Set path from a starting point startPt ending at endPt, and with directions dirs. | |
bool | isClosed () const |
Checks if path self is closed, that is start point and end point are equal. | |
girl::point | startPt () const |
Gives starting point of path self. | |
girl::point | endPt () const |
Gives end point of path self. | |
size_t | length () const |
Path length, i.e. number of directions. | |
bool | isValid () const |
Tells if the freemanCodePath is valid. that is two succesive directions are not in opposite way. | |
bool | operator== (const path &o) |
equality operator | |
bool | operator!= (const path &o) |
inequality operator | |
void | invertOrientation () |
Inverts orientation of freemanCodePath. | |
void | add (girl::direction d) |
Adds a direction d to the end of path. | |
void | append (const girl::path &p) |
Appends direction of path p. | |
void | move (const girl::point &newStartPt) |
Moves starting point to new point newStartPt. | |
void | crop (size_t startIndex, size_t length) |
Crop path to keep only length directions after the startIndex first directions. |
girl::path::path | ( | const girl::point & | startPt = girl::point(0, 0) |
) | [inline] |
girl::path::path | ( | const girl::point & | startPt, | |
const std::deque< girl::direction > & | dirs | |||
) |
girl::path::path | ( | const girl::point & | startPt, | |
const girl::point & | endPt, | |||
const std::deque< girl::direction > & | dirs | |||
) | [inline] |
girl::path::path | ( | const girl::contour & | c | ) | [inline] |
void girl::path::add | ( | girl::direction | d | ) |
void girl::path::crop | ( | size_t | startIndex, | |
size_t | length | |||
) |
Crop path to keep only length directions after the startIndex first directions.
We must have startIndex+length<=length().
void girl::path::invertOrientation | ( | ) |
Inverts orientation of freemanCodePath.
For example, a freemanCodePath with four directions Right, Up, Left, and Down, will be changed to Up, Right, Down, and Left.
start and end points are swaped.
size_t girl::path::length | ( | ) | const [inline] |
Path length, i.e. number of directions.
O(1).
void girl::path::move | ( | const girl::point & | newStartPt | ) |
void girl::path::set | ( | const girl::point & | startPt, | |
const girl::point & | endPt, | |||
const std::deque< girl::direction > & | dirs | |||
) | [inline] |