![]() |
Gorgon Game Engine
|
This class represents a set of points. More...
Public Member Functions | |
PointList ()=default | |
Empty constructor. More... | |
PointList (const PointList &)=delete | |
Due to relatively high cost, copying is disabled. Use Duplicate instead. More... | |
PointList (PointList &&other) | |
Move constructor. More... | |
PointList (std::initializer_list< P_ > points) | |
Initializer list. More... | |
PointList (std::vector< P_ > points) | |
Implicit vector to PointList casting. You may move in the data using std::move. More... | |
P_ & | Back () |
Accesses the last element in the list. More... | |
const P_ & | Back () const |
Accesses the last element in the list. More... | |
auto | begin () |
Begin iterator to underlying points vector. More... | |
auto | begin () const |
Begin iterator to underlying points vector. More... | |
void | Clear () |
Clears the elements in this list. More... | |
void | Destroy () |
Destroys the storage used by this list. More... | |
PointList | Duplicate () const |
Duplicates this PointList. More... | |
auto | end () |
End iterator to underlying points vector. More... | |
auto | end () const |
End iterator to underlying points vector. More... | |
P_ & | Front () |
Accesses the first element in the list. More... | |
const P_ & | Front () const |
Accesses the first element in the list. More... | |
P_ & | Get (long index) |
Returns the element at the given index. More... | |
const P_ & | Get (long index) const |
Returns the element at the given index. More... | |
Line< P_ > | GetLine (long index) const |
Returns the line at the given index. More... | |
auto | GetSize () const |
Returns the number of elements in the list. More... | |
template<class O_ > | |
PointList | operator* (const O_ &right) const |
Adds a point to each element of the list. More... | |
template<class O_ > | |
PointList & | operator*= (const O_ &right) |
Adds a point to each element of the list. More... | |
template<class O_ > | |
PointList | operator+ (const O_ &right) const |
Adds a point to each element of the list. More... | |
PointList | operator+ (const PointList &right) const |
Adds the coordinates of the points on the right list to the left. More... | |
template<class O_ > | |
PointList & | operator+= (const O_ &right) |
Adds a point to each element of the list. More... | |
PointList & | operator+= (const PointList &right) |
Adds the coordinates of the points on the right list to the left. More... | |
template<class O_ > | |
PointList | operator- (const O_ &right) const |
Subtracts a point to each element of the list. More... | |
PointList | operator- (const PointList &right) const |
Subtracts the coordinates of the points on the right list to the left. More... | |
template<class O_ > | |
PointList & | operator-= (const O_ &right) |
Subtracts a point to each element of the list. More... | |
PointList & | operator-= (const PointList &right) |
Subtracts the coordinates of the points on the right list to the left. More... | |
template<class O_ > | |
PointList | operator/ (const O_ &right) const |
Subtracts a point to each element of the list. More... | |
template<class O_ > | |
PointList & | operator/= (const O_ &right) |
Subtracts a point to each element of the list. More... | |
PointList & | operator= (const PointList &)=delete |
Due to relatively high cost, copying is disabled. Use Duplicate instead. More... | |
PointList & | operator= (PointList &&right) |
Move assignment. More... | |
P_ & | operator[] (std::size_t index) |
Accesses the elements in the list. More... | |
const P_ & | operator[] (std::size_t index) const |
Accesses the elements in the list. More... | |
void | Pop () |
Removes the last point from the list. More... | |
void | Push (P_ point) |
Adds a new point to the end of the point list. More... | |
template<class ... T_> | |
void | Push (T_ &&... params) |
Adds a new point to the end of the point list. More... | |
auto | rbegin () |
Begin iterator to underlying points vector. More... | |
auto | rbegin () const |
Begin iterator to underlying points vector. More... | |
auto | rend () |
End iterator to underlying points vector. More... | |
auto | rend () const |
End iterator to underlying points vector. More... | |
void | Swap (PointList< P_ > &right) |
Swaps two lists, mainly for move operations. More... | |
Public Attributes | |
std::vector< P_ > | Points |
Stored points. You may directly use this class as if it is a point vector. More... | |
This class represents a set of points.
This class can be used for contours, line lists, polygons, or even point clouds. Some of the functions may be meaningful for some of these uses.
PointList | ( | std::vector< P_ > | points | ) |
Implicit vector to PointList casting. You may move in the data using std::move.
PointList | ( | std::initializer_list< P_ > | points | ) |
Initializer list.
Due to relatively high cost, copying is disabled. Use Duplicate instead.
Move constructor.
References PointList< P_ >::Swap().
P_& Back | ( | ) |
Accesses the last element in the list.
References PointList< P_ >::Points.
const P_& Back | ( | ) | const |
Accesses the last element in the list.
References PointList< P_ >::Points.
auto begin | ( | ) |
Begin iterator to underlying points vector.
References PointList< P_ >::Points.
auto begin | ( | ) | const |
Begin iterator to underlying points vector.
References PointList< P_ >::Points.
void Clear | ( | ) |
Clears the elements in this list.
References PointList< P_ >::Points.
void Destroy | ( | ) |
Destroys the storage used by this list.
References PointList< P_ >::Points, and Gorgon::Geometry::swap().
PointList Duplicate | ( | ) | const |
Duplicates this PointList.
References PointList< P_ >::Points.
auto end | ( | ) |
End iterator to underlying points vector.
References PointList< P_ >::Points.
auto end | ( | ) | const |
End iterator to underlying points vector.
References PointList< P_ >::Points.
P_& Front | ( | ) |
Accesses the first element in the list.
References PointList< P_ >::Points.
const P_& Front | ( | ) | const |
Accesses the first element in the list.
References PointList< P_ >::Points.
P_& Get | ( | long | index | ) |
Returns the element at the given index.
This function treats the list as cyclic.
References PointList< P_ >::Points, and Gorgon::PositiveMod().
const P_& Get | ( | long | index | ) | const |
Returns the element at the given index.
This function treats the list as cyclic.
References PointList< P_ >::Points, and Gorgon::PositiveMod().
Line<P_> GetLine | ( | long | index | ) | const |
Returns the line at the given index.
This function treats the list as a cyclic line list. The list is assumed to be closed.
References PointList< P_ >::Points, and Gorgon::PositiveMod().
auto GetSize | ( | ) | const |
Returns the number of elements in the list.
References PointList< P_ >::Points.
PointList operator* | ( | const O_ & | right | ) | const |
Adds a point to each element of the list.
References PointList< P_ >::Push().
PointList& operator*= | ( | const O_ & | right | ) |
Adds a point to each element of the list.
PointList operator+ | ( | const O_ & | right | ) | const |
Adds a point to each element of the list.
References PointList< P_ >::Push().
Adds the coordinates of the points on the right list to the left.
Right list is treated as cyclic. If right list is empty, nothing is done.
References PointList< P_ >::Get(), and PointList< P_ >::Push().
PointList& operator+= | ( | const O_ & | right | ) |
Adds a point to each element of the list.
Adds the coordinates of the points on the right list to the left.
Right list is treated as cyclic. If right list is empty, nothing is done.
References PointList< P_ >::Get().
PointList operator- | ( | const O_ & | right | ) | const |
Subtracts a point to each element of the list.
References PointList< P_ >::Push().
Subtracts the coordinates of the points on the right list to the left.
Right list is treated as cyclic. If right list is empty, nothing is done.
References PointList< P_ >::Get(), and PointList< P_ >::Push().
PointList& operator-= | ( | const O_ & | right | ) |
Subtracts a point to each element of the list.
Subtracts the coordinates of the points on the right list to the left.
Right list is treated as cyclic. If right list is empty, nothing is done.
References PointList< P_ >::Get().
PointList operator/ | ( | const O_ & | right | ) | const |
Subtracts a point to each element of the list.
References PointList< P_ >::Push().
PointList& operator/= | ( | const O_ & | right | ) |
Subtracts a point to each element of the list.
Due to relatively high cost, copying is disabled. Use Duplicate instead.
Move assignment.
References PointList< P_ >::Destroy(), and PointList< P_ >::Swap().
P_& operator[] | ( | std::size_t | index | ) |
Accesses the elements in the list.
References PointList< P_ >::Points.
const P_& operator[] | ( | std::size_t | index | ) | const |
Accesses the elements in the list.
References PointList< P_ >::Points.
void Pop | ( | ) |
Removes the last point from the list.
References PointList< P_ >::Points.
void Push | ( | P_ | point | ) |
Adds a new point to the end of the point list.
References PointList< P_ >::Points.
void Push | ( | T_ &&... | params | ) |
Adds a new point to the end of the point list.
References PointList< P_ >::Points.
auto rbegin | ( | ) |
Begin iterator to underlying points vector.
References PointList< P_ >::Points.
auto rbegin | ( | ) | const |
Begin iterator to underlying points vector.
References PointList< P_ >::Points.
auto rend | ( | ) |
End iterator to underlying points vector.
References PointList< P_ >::Points.
auto rend | ( | ) | const |
End iterator to underlying points vector.
References PointList< P_ >::Points.
void Swap | ( | PointList< P_ > & | right | ) |
Swaps two lists, mainly for move operations.
References PointList< P_ >::Points, and Gorgon::Geometry::swap().
std::vector<P_> Points |
Stored points. You may directly use this class as if it is a point vector.