Volume Cartographer 2.27.0
Public Types | Static Public Attributes | Protected Attributes | List of all members
volcart::PointSet< T > Class Template Reference

Holds a collection of points. More...

#include <vc/core/types/PointSet.hpp>

Inheritance diagram for volcart::PointSet< T >:
[legend]

Public Types

using Point = T
 
using value_type = Point
 
using Container = std::vector< Point >
 
using Iterator = typename Container::iterator
 
using ConstIterator = typename Container::const_iterator
 
using Pointer = std::shared_ptr< PointSet< T > >
 

Public Member Functions

 PointSet ()=default
 Default constructor.
 
 PointSet (std::size_t initSize)
 Construct and preallocate a number of Point elements. More...
 
 PointSet (std::size_t initSize, T initVal)
 Construct and fill a number of elements with an initial value. More...
 
const T & operator[] (std::size_t idx) const
 Get a Point by index. More...
 
T & operator[] (std::size_t idx)
 Get a Point by index. More...
 
std::size_t size () const
 Get the size of the PointSet. More...
 
bool empty () const
 Return whether the PointSet is empty. More...
 
Container as_vector ()
 Get the PointSet storage container. More...
 
void clear ()
 Remove all elements from the PointSet. More...
 
void push_back (const T &val)
 Add a Point to the PointSet. More...
 
void push_back (T &&val)
 
template<class... Args>
void emplace_back (Args &&... args)
 Emplace a Point at the back of the PointSet. More...
 
template<class ContainerType >
void append (const ContainerType &c)
 Append a PointSet to the end of the current one. More...
 
Iterator begin ()
 Return an iterator that points to the first element in the PointSet. More...
 
ConstIterator begin () const
 Return an iterator that points to the first element in the PointSet. More...
 
Iterator end ()
 Return an iterator that points to the past-the-end element in the PointSet. More...
 
ConstIterator end () const
 Return an iterator that points to the past-the-end element in the PointSet. More...
 
T & front ()
 Return a reference to the first element in the PointSet. More...
 
const T & front () const
 Return a reference to the first element in the PointSet. More...
 
T & back ()
 Return a reference to the last element in the PointSet. More...
 
const T & back () const
 Return a reference to the last element in the PointSet. More...
 
min () const
 Return the element with the smallest absolute norm (L2) More...
 
max () const
 Return the element with the largest absolute norm (L2) More...
 
std::pair< T, T > minMax () const
 Return a pair of elements containing the points with the smallest and largest absolute norm (L2) More...
 

Static Public Member Functions

static PointSet Fill (std::size_t initSize, T initVal)
 Create a PointSet of a specific size, filled with an initial value. More...
 

Static Public Attributes

static constexpr int FORMAT_VERSION = 1
 
static constexpr auto HEADER_TERMINATOR = "<>"
 
static constexpr auto HEADER_TERMINATOR_REGEX = "^<>$"
 

Protected Attributes

Container data_
 

Detailed Description

template<typename T>
class volcart::PointSet< T >

Holds a collection of points.

Author
Sean Karlage

Definition at line 25 of file PointSet.hpp.

Member Typedef Documentation

◆ ConstIterator

template<typename T >
using volcart::PointSet< T >::ConstIterator = typename Container::const_iterator

Const iterator type

Definition at line 42 of file PointSet.hpp.

◆ Container

template<typename T >
using volcart::PointSet< T >::Container = std::vector<Point>

Container type. Defines the underlying data structure. Should supply an STL compliant interface.

Definition at line 36 of file PointSet.hpp.

◆ Iterator

template<typename T >
using volcart::PointSet< T >::Iterator = typename Container::iterator

Iterator type

Definition at line 39 of file PointSet.hpp.

◆ Point

template<typename T >
using volcart::PointSet< T >::Point = T

Point type

Definition at line 29 of file PointSet.hpp.

◆ Pointer

template<typename T >
using volcart::PointSet< T >::Pointer = std::shared_ptr<PointSet<T> >

Pointer type

Definition at line 54 of file PointSet.hpp.

◆ value_type

template<typename T >
using volcart::PointSet< T >::value_type = Point

Iterator value type

Definition at line 32 of file PointSet.hpp.

Constructor & Destructor Documentation

◆ PointSet() [1/2]

template<typename T >
volcart::PointSet< T >::PointSet ( std::size_t  initSize)
inlineexplicit

Construct and preallocate a number of Point elements.

Definition at line 61 of file PointSet.hpp.

◆ PointSet() [2/2]

template<typename T >
volcart::PointSet< T >::PointSet ( std::size_t  initSize,
initVal 
)
inlineexplicit

Construct and fill a number of elements with an initial value.

Definition at line 64 of file PointSet.hpp.

Member Function Documentation

◆ append()

template<typename T >
template<class ContainerType >
void volcart::PointSet< T >::append ( const ContainerType &  c)
inline

Append a PointSet to the end of the current one.

Definition at line 116 of file PointSet.hpp.

◆ as_vector()

template<typename T >
Container volcart::PointSet< T >::as_vector ( )
inline

Get the PointSet storage container.

Definition at line 94 of file PointSet.hpp.

◆ back() [1/2]

template<typename T >
T & volcart::PointSet< T >::back ( )
inline

Return a reference to the last element in the PointSet.

Definition at line 144 of file PointSet.hpp.

◆ back() [2/2]

template<typename T >
const T & volcart::PointSet< T >::back ( ) const
inline

Return a reference to the last element in the PointSet.

Definition at line 147 of file PointSet.hpp.

◆ begin() [1/2]

template<typename T >
Iterator volcart::PointSet< T >::begin ( )
inline

Return an iterator that points to the first element in the PointSet.

Definition at line 125 of file PointSet.hpp.

◆ begin() [2/2]

template<typename T >
ConstIterator volcart::PointSet< T >::begin ( ) const
inline

Return an iterator that points to the first element in the PointSet.

Definition at line 128 of file PointSet.hpp.

◆ clear()

template<typename T >
void volcart::PointSet< T >::clear ( )
inline

Remove all elements from the PointSet.

Definition at line 97 of file PointSet.hpp.

◆ emplace_back()

template<typename T >
template<class... Args>
void volcart::PointSet< T >::emplace_back ( Args &&...  args)
inline

Emplace a Point at the back of the PointSet.

Definition at line 109 of file PointSet.hpp.

◆ empty()

template<typename T >
bool volcart::PointSet< T >::empty ( ) const
inline

Return whether the PointSet is empty.

Definition at line 91 of file PointSet.hpp.

◆ end() [1/2]

template<typename T >
Iterator volcart::PointSet< T >::end ( )
inline

Return an iterator that points to the past-the-end element in the PointSet.

Definition at line 132 of file PointSet.hpp.

◆ end() [2/2]

template<typename T >
ConstIterator volcart::PointSet< T >::end ( ) const
inline

Return an iterator that points to the past-the-end element in the PointSet.

Definition at line 135 of file PointSet.hpp.

◆ Fill()

template<typename T >
static PointSet volcart::PointSet< T >::Fill ( std::size_t  initSize,
initVal 
)
inlinestatic

Create a PointSet of a specific size, filled with an initial value.

Definition at line 199 of file PointSet.hpp.

◆ front() [1/2]

template<typename T >
T & volcart::PointSet< T >::front ( )
inline

Return a reference to the first element in the PointSet.

Definition at line 138 of file PointSet.hpp.

◆ front() [2/2]

template<typename T >
const T & volcart::PointSet< T >::front ( ) const
inline

Return a reference to the first element in the PointSet.

Definition at line 141 of file PointSet.hpp.

◆ max()

template<typename T >
T volcart::PointSet< T >::max ( ) const
inline

Return the element with the largest absolute norm (L2)

Warning
Point type must be convertible to an OpenCV cv::_InputArray.

Definition at line 169 of file PointSet.hpp.

◆ min()

template<typename T >
T volcart::PointSet< T >::min ( ) const
inline

Return the element with the smallest absolute norm (L2)

Warning
Point type must be convertible to an OpenCV cv::_InputArray.

Definition at line 155 of file PointSet.hpp.

◆ minMax()

template<typename T >
std::pair< T, T > volcart::PointSet< T >::minMax ( ) const
inline

Return a pair of elements containing the points with the smallest and largest absolute norm (L2)

Warning
Point type must be convertible to an OpenCV cv::_InputArray.

Definition at line 184 of file PointSet.hpp.

◆ operator[]() [1/2]

template<typename T >
T & volcart::PointSet< T >::operator[] ( std::size_t  idx)
inline

Get a Point by index.

Definition at line 79 of file PointSet.hpp.

◆ operator[]() [2/2]

template<typename T >
const T & volcart::PointSet< T >::operator[] ( std::size_t  idx) const
inline

Get a Point by index.

Definition at line 72 of file PointSet.hpp.

◆ push_back() [1/2]

template<typename T >
volcart::PointSet< T >::push_back ( const T &  val)
inline

Add a Point to the PointSet.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 102 of file PointSet.hpp.

◆ push_back() [2/2]

template<typename T >
void volcart::PointSet< T >::push_back ( T &&  val)
inline

Definition at line 105 of file PointSet.hpp.

◆ size()

template<typename T >
std::size_t volcart::PointSet< T >::size ( ) const
inline

Get the size of the PointSet.

Definition at line 88 of file PointSet.hpp.

Member Data Documentation

◆ data_

template<typename T >
Container volcart::PointSet< T >::data_
protected

Point container

Definition at line 207 of file PointSet.hpp.

◆ FORMAT_VERSION

template<typename T >
constexpr int volcart::PointSet< T >::FORMAT_VERSION = 1
staticconstexpr

PointSet version number

Definition at line 45 of file PointSet.hpp.

◆ HEADER_TERMINATOR

template<typename T >
constexpr auto volcart::PointSet< T >::HEADER_TERMINATOR = "<>"
staticconstexpr

PointSet header terminator

Definition at line 48 of file PointSet.hpp.

◆ HEADER_TERMINATOR_REGEX

template<typename T >
constexpr auto volcart::PointSet< T >::HEADER_TERMINATOR_REGEX = "^<>$"
staticconstexpr

Regex for header terminator

Definition at line 51 of file PointSet.hpp.


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