iLab Neuromorphic Robotics Toolkit  0.1
nrt::Point< T, Dimensions > Class Template Reference

`#include <nrt/Core/Geometry/Point.H>`

### template<class T, size_t Dimensions> class nrt::Point< T, Dimensions >

A N-Dimensional Point Class.

The nrt::Point class is a general container useful for representing points in N-Dimentional space. Most users will just want to use the specialized Point2D and Point3D classes.

Definition at line 64 of file Point.H.

Inherits nrt::PointBase.

## Public Member Functions

Point ()
Construct an uninitialized point.

template<typename... S>
Point (S...args)
Construct a Point by specifying the value of each Dimension. More...

Point (std::array< T, Dimensions > const &init)
Construct a point from an std::array.

Point (Point< T, Dimensions > const &other)=default
Copy constructor.

Point (Point< T, Dimensions > &&other)=default
Move constructor.

template<class U >
Point (Point< U, Dimensions > const &other)
Conversion copy constructor, uses nrt::clamped_convert<T,U> internally.

Point< T, Dimensions > & operator= (Point< T, Dimensions > const &other)=default
Assignment.

Point< T, Dimensions > & operator= (Point< T, Dimensions > &&other)=default
Move assignment.

T & operator[] (size_t index)
Access a single dimension of the Point.

T const & operator[] (size_t index) const
Access a single dimension of the Point - const version.

template<class U >
double distanceTo (Point< U, Dimensions > const &other) const
Compute the Euclidian distance to another point.

template<class U >
double squaredDistanceTo (Point< U, Dimensions > const &other) const
Compute the squared Euclidian distance to another point.

double magnitude () const
Compute the magnitude (the Euclidian distance from the origin)

template<class U >
double manhattanDistanceTo (Point< U, Dimensions > const &other) const
Compute the Manhattan distance to another point.

T * begin ()
Access the beginning of the underlying array.

T * end ()
Access the end of the underlying array.

T const * begin () const
Access the beginning of the underlying array - const version.

T const * end () const
Access the end of the underlying array - const version.

## Protected Member Functions

template<class Archive >
void serialize (Archive &ar)
Serialization.

## Protected Attributes

std::array< T, Dimensions > itsData

## Friends

class cereal::access

## Related Functions

(Note that these are not member functions.)

template<class T , size_t S>
std::istream & operator>> (std::istream &in, nrt::Point< T, S > &p)

template<class T , size_t S>
void paramValToString (Point< T, S > const &val, std::string &result)
Machine-readable output to a string, for use in nrt::Parameter: outputs x1,x2,x3,...,xN. More...

template<class T , size_t S>
void paramStringToVal (std::string const &valstring, Point< T, S > &result)
Machine-readable input from a string, for use in nrt::Parameter: reads x1,x2,x3,...,xN. More...

template<class T , size_t S>
Point< T, S > scale (Point< T, S > const &src, double const factor)
Return a scaled version of the source object. More...

template<class T , size_t S>
bool operator== (Point< T, S > const &lhs, Point< T, S > const &rhs)
Operator overload for Point<T, S> == Point<T, S> More...

template<class T , size_t S>
bool operator!= (Point< T, S > const &lhs, Point< T, S > const &rhs)
Operator overload for Point<T, S> != Point<T, S> More...

template<class T , size_t S>
Point< T, S > operator+ (Point< T, S > const &lhs, Point< T, S > const &rhs)
Operator overload for Point2D<T> + Point<T, S> More...

template<class T , size_t S>
Point< T, S > operator- (Point< T, S > const &lhs, Point< T, S > const &rhs)
Operator overload for Point2D<T> - Point<T, S> More...

template<class T , size_t S>
Point< T, S > operator* (Point< T, S > const &lhs, double const rhs)
Operator overload for Point<T, S> * double. More...

template<class T , size_t S>
Point< T, S > operator* (double const lhs, Point< T, S > const &rhs)
Operator overload for double * Point<T, S> More...

template<class T , size_t S>
Point< T, S > operator/ (Point< T, S > const &lhs, double const rhs)
Operator overload for Point<T, S> / double. More...

template<class T , size_t S>
Point< T, S > & operator*= (Point< T, S > &lhs, double const rhs)
Operator overload for Point<T, S> *= double. More...

template<class T , size_t S>
Point< T, S > & operator/= (Point< T, S > &lhs, double const rhs)
Operator overload for Point<T, S> /= double. More...

template<class T , size_t S>
Point< T, S > & operator+= (Point< T, S > &lhs, Point< T, S > const &rhs)
Operator overload for Point<T, S> += Point<T, S> More...

template<class T , size_t S>
Point< T, S > & operator-= (Point< T, S > &lhs, Point< T, S > const &rhs)
Operator overload for Point<T, S> -= Point<T, S> More...

template<class T , size_t S>
Point< T, S > operator* (Point< T, S > const &lhs, Point< T, S > const &rhs)
Operator overload for Point2D<T> * Point<T, S> More...

template<class T , size_t S>
Point< T, S > operator/ (Point< T, S > const &lhs, Point< T, S > const &rhs)
Operator overload for Point2D<T> / Point<T, S> More...

## Constructor & Destructor Documentation

template<class T , size_t Dimensions>
template<typename... S>
 nrt::Point< T, Dimensions >::Point ( S... args)
explicit

Construct a Point by specifying the value of each Dimension.

e.g. Point<float, 3> p(1.0F, 2.0F, 3.0F);

Definition at line 48 of file PointImpl.H.

## Friends And Related Function Documentation

template<class T , size_t S>
 std::istream & operator>> ( std::istream & in, nrt::Point< T, S > & p )
related

Exceptions
 nrt::exception::Exception if input is malformed
template<class T , size_t S>
 void paramValToString ( Point< T, S > const & val, std::string & result )
related

Machine-readable output to a string, for use in nrt::Parameter: outputs x1,x2,x3,...,xN.

This is an overload for Point<T,S> of the function template in nrt/Core/Model/ParameterStringConversion.H.

template<class T , size_t S>
 void paramStringToVal ( std::string const & valstring, Point< T, S > & result )
related

Exceptions
 nrt::exception::Exception if input is malformed. This is an overload for Dims of the function template in nrt/Core/Model/ParameterStringConversion.H.
template<class T , size_t S>
 Point< T, S > scale ( Point< T, S > const & src, double const factor )
related

Return a scaled version of the source object.

Note
For a Point, scale() is a no-op. This does not have the same effect as the multiplication or division operators, which scale everything, while here we only scale the object size (and that size is zero for a point) without scaling its center coordinates.
template<class T , size_t S>
 bool operator== ( Point< T, S > const & lhs, Point< T, S > const & rhs )
related

Operator overload for Point<T, S> == Point<T, S>

template<class T , size_t S>
 bool operator!= ( Point< T, S > const & lhs, Point< T, S > const & rhs )
related

Operator overload for Point<T, S> != Point<T, S>

template<class T , size_t S>
 Point< T, S > operator+ ( Point< T, S > const & lhs, Point< T, S > const & rhs )
related

Operator overload for Point2D<T> + Point<T, S>

template<class T , size_t S>
 Point< T, S > operator- ( Point< T, S > const & lhs, Point< T, S > const & rhs )
related

Operator overload for Point2D<T> - Point<T, S>

template<class T , size_t S>
 Point< T, S > operator* ( Point< T, S > const & lhs, double const rhs )
related

Operator overload for Point<T, S> * double.

template<class T , size_t S>
 Point< T, S > operator* ( double const lhs, Point< T, S > const & rhs )
related

Operator overload for double * Point<T, S>

template<class T , size_t S>
 Point< T, S > operator/ ( Point< T, S > const & lhs, double const rhs )
related

Operator overload for Point<T, S> / double.

template<class T , size_t S>
 Point< T, S > & operator*= ( Point< T, S > & lhs, double const rhs )
related

Operator overload for Point<T, S> *= double.

template<class T , size_t S>
 Point< T, S > & operator/= ( Point< T, S > & lhs, double const rhs )
related

Operator overload for Point<T, S> /= double.

template<class T , size_t S>
 Point< T, S > & operator+= ( Point< T, S > & lhs, Point< T, S > const & rhs )
related

Operator overload for Point<T, S> += Point<T, S>

template<class T , size_t S>
 Point< T, S > & operator-= ( Point< T, S > & lhs, Point< T, S > const & rhs )
related

Operator overload for Point<T, S> -= Point<T, S>

template<class T , size_t S>
 Point< T, S > operator* ( Point< T, S > const & lhs, Point< T, S > const & rhs )
related

Operator overload for Point2D<T> * Point<T, S>

Deprecated:
template<class T , size_t S>
 Point< T, S > operator/ ( Point< T, S > const & lhs, Point< T, S > const & rhs )
related

Operator overload for Point2D<T> / Point<T, S>

Deprecated:

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