Gorgon Game Engine
PointList< P_ > Class Template Reference

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_ >
PointListoperator*= (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_ >
PointListoperator+= (const O_ &right)
 Adds a point to each element of the list. More...
 
PointListoperator+= (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_ >
PointListoperator-= (const O_ &right)
 Subtracts a point to each element of the list. More...
 
PointListoperator-= (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_ >
PointListoperator/= (const O_ &right)
 Subtracts a point to each element of the list. More...
 
PointListoperator= (const PointList &)=delete
 Due to relatively high cost, copying is disabled. Use Duplicate instead. More...
 
PointListoperator= (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...
 

Detailed Description

template<class P_ = Pointf>
class Gorgon::Geometry::PointList< P_ >

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.

Constructor & Destructor Documentation

◆ PointList() [1/5]

PointList ( )
default

Empty constructor.

◆ PointList() [2/5]

PointList ( std::vector< P_ >  points)

Implicit vector to PointList casting. You may move in the data using std::move.

◆ PointList() [3/5]

PointList ( std::initializer_list< P_ >  points)

Initializer list.

◆ PointList() [4/5]

PointList ( const PointList< P_ > &  )
delete

Due to relatively high cost, copying is disabled. Use Duplicate instead.

◆ PointList() [5/5]

PointList ( PointList< P_ > &&  other)

Move constructor.

References PointList< P_ >::Swap().

Member Function Documentation

◆ Back() [1/2]

P_& Back ( )

Accesses the last element in the list.

References PointList< P_ >::Points.

◆ Back() [2/2]

const P_& Back ( ) const

Accesses the last element in the list.

References PointList< P_ >::Points.

◆ begin() [1/2]

auto begin ( )

Begin iterator to underlying points vector.

References PointList< P_ >::Points.

◆ begin() [2/2]

auto begin ( ) const

Begin iterator to underlying points vector.

References PointList< P_ >::Points.

◆ Clear()

void Clear ( )

Clears the elements in this list.

References PointList< P_ >::Points.

◆ Destroy()

void Destroy ( )

Destroys the storage used by this list.

References PointList< P_ >::Points, and Gorgon::Geometry::swap().

◆ Duplicate()

PointList Duplicate ( ) const

Duplicates this PointList.

References PointList< P_ >::Points.

◆ end() [1/2]

auto end ( )

End iterator to underlying points vector.

References PointList< P_ >::Points.

◆ end() [2/2]

auto end ( ) const

End iterator to underlying points vector.

References PointList< P_ >::Points.

◆ Front() [1/2]

P_& Front ( )

Accesses the first element in the list.

References PointList< P_ >::Points.

◆ Front() [2/2]

const P_& Front ( ) const

Accesses the first element in the list.

References PointList< P_ >::Points.

◆ Get() [1/2]

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().

◆ Get() [2/2]

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().

◆ GetLine()

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().

◆ GetSize()

auto GetSize ( ) const

Returns the number of elements in the list.

References PointList< P_ >::Points.

◆ operator*()

PointList operator* ( const O_ &  right) const

Adds a point to each element of the list.

References PointList< P_ >::Push().

◆ operator*=()

PointList& operator*= ( const O_ &  right)

Adds a point to each element of the list.

◆ operator+() [1/2]

PointList operator+ ( const O_ &  right) const

Adds a point to each element of the list.

References PointList< P_ >::Push().

◆ operator+() [2/2]

PointList operator+ ( const PointList< P_ > &  right) const

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().

◆ operator+=() [1/2]

PointList& operator+= ( const O_ &  right)

Adds a point to each element of the list.

◆ operator+=() [2/2]

PointList& operator+= ( const PointList< P_ > &  right)

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().

◆ operator-() [1/2]

PointList operator- ( const O_ &  right) const

Subtracts a point to each element of the list.

References PointList< P_ >::Push().

◆ operator-() [2/2]

PointList operator- ( const PointList< P_ > &  right) const

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().

◆ operator-=() [1/2]

PointList& operator-= ( const O_ &  right)

Subtracts a point to each element of the list.

◆ operator-=() [2/2]

PointList& operator-= ( const PointList< P_ > &  right)

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().

◆ operator/()

PointList operator/ ( const O_ &  right) const

Subtracts a point to each element of the list.

References PointList< P_ >::Push().

◆ operator/=()

PointList& operator/= ( const O_ &  right)

Subtracts a point to each element of the list.

◆ operator=() [1/2]

PointList& operator= ( const PointList< P_ > &  )
delete

Due to relatively high cost, copying is disabled. Use Duplicate instead.

◆ operator=() [2/2]

PointList& operator= ( PointList< P_ > &&  right)

Move assignment.

References PointList< P_ >::Destroy(), and PointList< P_ >::Swap().

◆ operator[]() [1/2]

P_& operator[] ( std::size_t  index)

Accesses the elements in the list.

References PointList< P_ >::Points.

◆ operator[]() [2/2]

const P_& operator[] ( std::size_t  index) const

Accesses the elements in the list.

References PointList< P_ >::Points.

◆ Pop()

void Pop ( )

Removes the last point from the list.

References PointList< P_ >::Points.

◆ Push() [1/2]

void Push ( P_  point)

Adds a new point to the end of the point list.

References PointList< P_ >::Points.

◆ Push() [2/2]

void Push ( T_ &&...  params)

Adds a new point to the end of the point list.

References PointList< P_ >::Points.

◆ rbegin() [1/2]

auto rbegin ( )

Begin iterator to underlying points vector.

References PointList< P_ >::Points.

◆ rbegin() [2/2]

auto rbegin ( ) const

Begin iterator to underlying points vector.

References PointList< P_ >::Points.

◆ rend() [1/2]

auto rend ( )

End iterator to underlying points vector.

References PointList< P_ >::Points.

◆ rend() [2/2]

auto rend ( ) const

End iterator to underlying points vector.

References PointList< P_ >::Points.

◆ Swap()

void Swap ( PointList< P_ > &  right)

Swaps two lists, mainly for move operations.

References PointList< P_ >::Points, and Gorgon::Geometry::swap().

Member Data Documentation

◆ Points

std::vector<P_> Points

Stored points. You may directly use this class as if it is a point vector.


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