iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::Circle< T > Class Template Reference

#include <nrt/Core/Geometry/Circle.H>

template<class T>
class nrt::Circle< T >

A simple representation of a circle.

Examples:
tests/test-Geometry.C, and tests/test-UKF.C.

Definition at line 48 of file Circle.H.

Public Member Functions

 Circle ()
 Default constructor - creates a Circle with both ends at (0,0)
 
 Circle (Point2D< T > const &center, T const &radius)
 Construct a Circle from the center and the radius.
 
 Circle (T cx, T cy, T radius)
 Construct a Circle from the given x and y coordinates and radius.
 
 Circle (Circle< T > const &other)=default
 Copy Constructor.
 
 Circle (Circle< T > &&other)=default
 Move constructor.
 
template<class U >
 Circle (Circle< U > const &other)
 Conversion copy constructor, uses nrt::clamped_convert<T,U> internally.
 
Circle< T > & operator= (Circle< T > const &other)=default
 Assignment.
 
Circle< T > & operator= (Circle< T > &&other)=default
 Move assignment.
 
Point2D< T > const & center () const
 Get the center.
 
T const & radius () const
 Get the radius.
 
double area () const
 Calculate the area.
 
double circumference () const
 Calculate the circumference.
 
template<class U >
bool contains (Point2D< U > const &p) const
 Calculate whether the given point lies within this circle. More...
 

Protected Member Functions

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

Friends

class cereal::access
 

Related Functions

(Note that these are not member functions.)

template<class T >
std::ostream & operator<< (std::ostream &out, Circle< T > const &circle)
 Human-readable output to a stream: outputs "c:<center> r:<radius>". More...
 
template<class T >
Circle< T > scale (Circle< T > const &src, double const factor)
 Return a scaled version of the source object. More...
 
template<class T >
Circle< T > rotate (Circle< T > const &src, double const angle)
 Return a rotated version of the source object, about its center by a given angle in radians. More...
 
template<class T >
Circle< T > rotateAbout (Circle< T > const &src, Point2D< T > const &p, double const angle)
 Return a rotated version of the source object, about the given point and by a given angle in radians. More...
 
template<class T >
bool operator== (Circle< T > const &lhs, Circle< T > const &rhs)
 Operator overload for Circle<T> == Circle<T> More...
 
template<class T >
bool operator!= (Circle< T > const &lhs, Circle< T > const &rhs)
 Operator overload for Circle<T> != Circle<T> More...
 
template<class T >
Circle< T > operator+ (Circle< T > const &lhs, Point2D< T > const &rhs)
 Operator overload for Circle<T> + Point2D<T> More...
 
template<class T >
Circle< T > operator+ (Point2D< T > const &lhs, Circle< T > const &rhs)
 Operator overload for Point2D<T> + Circle<T> More...
 
template<class T >
Circle< T > operator- (Circle< T > const &lhs, Point2D< T > const &rhs)
 Operator overload for Circle<T> - Point2D<T> More...
 
template<class T >
Circle< T > operator- (Point2D< T > const &lhs, Circle< T > const &rhs)
 Operator overload for Point2D<T> - Circle<T> More...
 
template<class T >
Circle< T > operator* (Circle< T > const &lhs, double const rhs)
 Operator overload for Circle<T> * double. More...
 
template<class T >
Circle< T > operator* (double const lhs, Circle< T > const &rhs)
 Operator overload for double * Circle<T> More...
 
template<class T >
Circle< T > operator/ (Circle< T > const &lhs, double const rhs)
 Operator overload for Circle<T> / double. More...
 
template<class T >
Circle< T > & operator*= (Circle< T > &lhs, double const rhs)
 Operator overload for Circle<T> *= double. More...
 
template<class T >
Circle< T > & operator/= (Circle< T > &lhs, double const rhs)
 Operator overload for Circle<T> /= double. More...
 

Member Function Documentation

template<class T >
template<class U >
bool nrt::Circle< T >::contains ( nrt::Point2D< U > const &  p) const
inline

Calculate whether the given point lies within this circle.

This test is inclusive, such that points that are "radius" away from the center if the circle are considered to be contained in the circle

Definition at line 82 of file CircleImpl.H.

Friends And Related Function Documentation

template<class T >
std::ostream & operator<< ( std::ostream &  out,
Circle< T > const &  circle 
)
related

Human-readable output to a stream: outputs "c:<center> r:<radius>".

Examples:
tests/test-Log.C, and tests/test-State.C.
template<class T >
Circle< T > scale ( Circle< T > const &  src,
double const  factor 
)
related

Return a scaled version of the source object.

Note
This does not have the same effect as the multiplication or division operators, which scale everything, while here we only scale the object size without scaling its center coordinates.

Referenced by nrt::inplaceNormalize().

template<class T >
Circle< T > rotate ( Circle< T > const &  src,
double const  angle 
)
related

Return a rotated version of the source object, about its center by a given angle in radians.

For circle this operation is a no-op. It is provided for compatibility with other geometric primitives

Examples:
tests/test-stream.C.
template<class T >
Circle< T > rotateAbout ( Circle< T > const &  src,
Point2D< T > const &  p,
double const  angle 
)
related

Return a rotated version of the source object, about the given point and by a given angle in radians.

template<class T >
bool operator== ( Circle< T > const &  lhs,
Circle< T > const &  rhs 
)
related

Operator overload for Circle<T> == Circle<T>

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

Operator overload for Circle<T> != Circle<T>

template<class T >
Circle< T > operator+ ( Circle< T > const &  lhs,
Point2D< T > const &  rhs 
)
related

Operator overload for Circle<T> + Point2D<T>

Examples:
tests/test-Traits.C.
template<class T >
Circle< T > operator+ ( Point2D< T > const &  lhs,
Circle< T > const &  rhs 
)
related

Operator overload for Point2D<T> + Circle<T>

template<class T >
Circle< T > operator- ( Circle< T > const &  lhs,
Point2D< T > const &  rhs 
)
related

Operator overload for Circle<T> - Point2D<T>

Examples:
tests/test-Traits.C.
template<class T >
Circle< T > operator- ( Point2D< T > const &  lhs,
Circle< T > const &  rhs 
)
related

Operator overload for Point2D<T> - Circle<T>

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

Operator overload for Circle<T> * double.

Examples:
tests/test-Traits.C.
template<class T >
Circle< T > operator* ( double const  lhs,
Circle< T > const &  rhs 
)
related

Operator overload for double * Circle<T>

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

Operator overload for Circle<T> / double.

Examples:
tests/test-Traits.C.
template<class T >
Circle< T > & operator*= ( Circle< T > &  lhs,
double const  rhs 
)
related

Operator overload for Circle<T> *= double.

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

Operator overload for Circle<T> /= double.


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