![]() |
Gamedev Framework (gf)
0.4.0
A C++11 framework for 2D games
|
A polyline. More...
#include <gf/Polyline.h>
Public Types | |
enum | Type { Chain, Loop } |
Public Member Functions | |
Polyline (Type type=Chain) | |
Default constructor. More... | |
Polyline (ArrayRef< Vector2f > points, Type type=Chain) | |
Constructor from an array. More... | |
template<typename Iterator > | |
Polyline (Iterator first, Iterator last, Type type=Chain) | |
Constructor from points. More... | |
void | addPoint (Vector2f point) |
Add a point to the polyline. More... | |
std::size_t | getPointCount () const |
Get the number of points of the polyline. More... | |
Vector2f | getPoint (std::size_t index) const |
Get the i-th point of the polyline. More... | |
const Vector2f * | begin () const |
Get an iterator to the first point. More... | |
const Vector2f * | end () const |
Get an iterator past the last point. More... | |
bool | hasPrevPoint (std::size_t i) const |
Check if there is a point before the i-th point. More... | |
Vector2f | getPrevPoint (std::size_t i) const |
Get the point before the i-th point. More... | |
bool | hasNextPoint (std::size_t i) const |
Check if there is a point after the i-th point. More... | |
Vector2f | getNextPoint (std::size_t i) const |
Get the point after the i-th point. More... | |
void | setType (Type type) |
Set the type of the polyline. More... | |
bool | isLoop () const |
Check is the polyline is a loop. More... | |
bool | isChain () const |
Check is the polyline is a chain. More... | |
A polyline.
A polyline is a set of consecutive segments. It is defined by the points ending the segments. A polyline can be open (chain) or closed (loop).
Default constructor.
type | The type of polyline (default: chain) |
Constructor from an array.
points | The array of points |
type | The type of polyline (default: chain) |
|
inline |
Constructor from points.
first | Iterator to the first point |
last | Iterator after the last point |
type | The type of polyline (default: chain) |
void gf::Polyline::addPoint | ( | Vector2f | point | ) |
Add a point to the polyline.
point | The point to add to the polyline |
const Vector2f* gf::Polyline::begin | ( | ) | const |
const Vector2f* gf::Polyline::end | ( | ) | const |
Vector2f gf::Polyline::getNextPoint | ( | std::size_t | i | ) | const |
Get the point after the i-th point.
i | The index of the current point |
Vector2f gf::Polyline::getPoint | ( | std::size_t | index | ) | const |
Get the i-th point of the polyline.
index | The index of the point |
std::size_t gf::Polyline::getPointCount | ( | ) | const |
Get the number of points of the polyline.
Vector2f gf::Polyline::getPrevPoint | ( | std::size_t | i | ) | const |
Get the point before the i-th point.
i | The index of the current point |
bool gf::Polyline::hasNextPoint | ( | std::size_t | i | ) | const |
Check if there is a point after the i-th point.
i | The index of the current point |
bool gf::Polyline::hasPrevPoint | ( | std::size_t | i | ) | const |
Check if there is a point before the i-th point.
i | The index of the current point |
|
inline |
|
inline |
|
inline |
Set the type of the polyline.
type | The new type of the polyline |