Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::math::Point< Dimension, T > Class Template Reference

Point. More...

#include "vector.h"

Inheritance diagram for ion::math::Point< Dimension, T >:
Collaboration diagram for ion::math::Point< Dimension, T >:

Public Types

typedef Vector< Dimension, TVectorType
 Convenience typedef for the corresponding Vector type. More...
 
enum  { kDimension = Dimension }
 The dimension of the vector (number of elements). More...
 
typedef T ValueType
 

Public Member Functions

 Point ()
 The default constructor zero-intializes all elements. More...
 
 Point (T e0)
 Dimension-specific constructors that are passed individual element values. More...
 
 Point (T e0, T e1)
 
 Point (T e0, T e1, T e2)
 
 Point (T e0, T e1, T e2, T e3)
 
 Point (const Point< Dimension-1, T > &p, T s)
 Constructor for a Point of dimension N from a Point of dimension N-1 and a scalar of the correct type, assuming N is at least 2. More...
 
template<typename U >
 Point (const Point< Dimension, U > &p)
 Copy constructor from a Point of the same Dimension and any value type that is compatible (via static_cast) with this Point's type. More...
 
void operator+= (const Point &v)
 Self-modifying operators. More...
 
void operator+= (const VectorType &v)
 
void operator-= (const VectorType &v)
 
void operator*= (T s)
 
void operator/= (T s)
 
const Point operator- () const
 Unary operators. More...
 
void Set (T e0)
 Sets the vector values. More...
 
void Set (T e0, T e1)
 
void Set (T e0, T e1, T e2)
 
void Set (T e0, T e1, T e2, T e3)
 
Toperator[] (int index)
 Mutable element accessor. More...
 
const Toperator[] (int index) const
 Read-only element accessor. More...
 
TData ()
 Returns a pointer to the data for interfacing with other libraries. More...
 
const TData () const
 
void Print (std::ostream &out, const char tag) const
 This is used for printing Vectors and Points to a stream. More...
 
template<char tag>
void Read (std::istream &in)
 This is used for reading Vectors and Points from a stream. More...
 

Static Public Member Functions

static const Point Zero ()
 Returns a Point containing all zeroes. More...
 
static const Point Fill (T value)
 Returns a Point with all elements set to the given value. More...
 
static bool AreValuesEqual (const VectorBase &v0, const VectorBase &v1)
 Returns true if all values in two instances are equal. More...
 

Protected Member Functions

void Add (const VectorBase &v)
 Derived classes use these protected functions to implement type-safe functions and operators. More...
 
void Subtract (const VectorBase &v)
 Self-modifying subtraction. More...
 
void Multiply (T s)
 Self-modifying multiplication by a scalar. More...
 
void Divide (T s)
 Self-modifying division by a scalar. More...
 
const VectorBase Negation () const
 Unary negation. More...
 

Static Protected Member Functions

static const VectorBase Divide (const VectorBase &v, T s)
 Binary division by a scalar. More...
 
static const VectorBase Product (const VectorBase &v0, const VectorBase &v1)
 Binary component-wise multiplication. More...
 
static const VectorBase Quotient (const VectorBase &v0, const VectorBase &v1)
 Binary component-wise division. More...
 
static const VectorBase Sum (const VectorBase &v0, const VectorBase &v1)
 Binary component-wise addition. More...
 
static const VectorBase Difference (const VectorBase &v0, const VectorBase &v1)
 Binary component-wise subtraction. More...
 
static const VectorBase Scale (const VectorBase &v, T s)
 Binary multiplication by a scalar. More...
 

Friends

const Point operator+ (const Point &p0, const Point &p1)
 Adding two Points produces another Point. More...
 
const Point operator+ (const Point &p, const VectorType &v)
 Adding a Vector to a Point produces another Point. More...
 
const Point operator+ (const VectorType &v, const Point &p)
 
const Point operator- (const Point &p, const VectorType &v)
 Subtracting a Vector from a Point produces another Point. More...
 
const VectorType operator- (const Point &p0, const Point &p1)
 Subtracting two Points results in a Vector. More...
 
const Point operator* (const Point &p, T s)
 Binary scale and division operators. More...
 
const Point operator* (T s, const Point &p)
 
const Point operator* (const Point &v, const Point &s)
 
const Point operator/ (const Point &v, const Point &s)
 
const Point operator/ (const Point &p, T s)
 
bool operator== (const Point &p0, const Point &p1)
 Exact equality and inequality comparisons. More...
 
bool operator!= (const Point &p0, const Point &p1)
 

Detailed Description

template<int Dimension, typename T>
class ion::math::Point< Dimension, T >

Point.

Geometric N-dimensional Point class.

Definition at line 296 of file vector.h.

Member Typedef Documentation

template<int Dimension, typename T>
typedef T ion::math::VectorBase< Dimension, T >::ValueType
inherited

Definition at line 47 of file vector.h.

template<int Dimension, typename T>
typedef Vector<Dimension, T> ion::math::Point< Dimension, T >::VectorType

Convenience typedef for the corresponding Vector type.

Definition at line 299 of file vector.h.

Member Enumeration Documentation

template<int Dimension, typename T>
anonymous enum
inherited

The dimension of the vector (number of elements).

Enumerator
kDimension 

Definition at line 46 of file vector.h.

Constructor & Destructor Documentation

template<int Dimension, typename T>
ion::math::Point< Dimension, T >::Point ( )
inline

The default constructor zero-intializes all elements.

Definition at line 302 of file vector.h.

template<int Dimension, typename T>
ion::math::Point< Dimension, T >::Point ( T  e0)
inlineexplicit

Dimension-specific constructors that are passed individual element values.

Definition at line 305 of file vector.h.

template<int Dimension, typename T>
ion::math::Point< Dimension, T >::Point ( T  e0,
T  e1 
)
inline

Definition at line 306 of file vector.h.

template<int Dimension, typename T>
ion::math::Point< Dimension, T >::Point ( T  e0,
T  e1,
T  e2 
)
inline

Definition at line 307 of file vector.h.

template<int Dimension, typename T>
ion::math::Point< Dimension, T >::Point ( T  e0,
T  e1,
T  e2,
T  e3 
)
inline

Definition at line 308 of file vector.h.

template<int Dimension, typename T>
ion::math::Point< Dimension, T >::Point ( const Point< Dimension-1, T > &  p,
T  s 
)
inline

Constructor for a Point of dimension N from a Point of dimension N-1 and a scalar of the correct type, assuming N is at least 2.

Definition at line 312 of file vector.h.

template<int Dimension, typename T>
template<typename U >
ion::math::Point< Dimension, T >::Point ( const Point< Dimension, U > &  p)
inlineexplicit

Copy constructor from a Point of the same Dimension and any value type that is compatible (via static_cast) with this Point's type.

Definition at line 316 of file vector.h.

Member Function Documentation

template<int Dimension, typename T >
void ion::math::VectorBase< Dimension, T >::Add ( const VectorBase< Dimension, T > &  v)
protectedinherited

Derived classes use these protected functions to implement type-safe functions and operators.

Self-modifying addition.

Definition at line 606 of file vector.h.

Referenced by ion::math::Vector< 4, T >::operator+=().

template<int Dimension, typename T >
bool ion::math::VectorBase< Dimension, T >::AreValuesEqual ( const VectorBase< Dimension, T > &  v0,
const VectorBase< Dimension, T > &  v1 
)
staticinherited

Returns true if all values in two instances are equal.

Definition at line 694 of file vector.h.

template<int Dimension, typename T>
T* ion::math::VectorBase< Dimension, T >::Data ( )
inlineinherited

Returns a pointer to the data for interfacing with other libraries.

Definition at line 79 of file vector.h.

template<int Dimension, typename T>
const T* ion::math::VectorBase< Dimension, T >::Data ( ) const
inlineinherited

Definition at line 80 of file vector.h.

template<int Dimension, typename T >
const VectorBase< Dimension, T > ion::math::VectorBase< Dimension, T >::Difference ( const VectorBase< Dimension, T > &  v0,
const VectorBase< Dimension, T > &  v1 
)
staticprotectedinherited

Binary component-wise subtraction.

Definition at line 667 of file vector.h.

template<int Dimension, typename T >
void ion::math::VectorBase< Dimension, T >::Divide ( T  s)
protectedinherited

Self-modifying division by a scalar.

Definition at line 624 of file vector.h.

Referenced by ion::math::Vector< 4, T >::operator/=().

template<int Dimension, typename T >
const VectorBase< Dimension, T > ion::math::VectorBase< Dimension, T >::Divide ( const VectorBase< Dimension, T > &  v,
T  s 
)
staticprotectedinherited

Binary division by a scalar.

Definition at line 685 of file vector.h.

template<int Dimension, typename T>
static const Point ion::math::Point< Dimension, T >::Fill ( T  value)
inlinestatic

Returns a Point with all elements set to the given value.

Definition at line 323 of file vector.h.

template<int Dimension, typename T >
void ion::math::VectorBase< Dimension, T >::Multiply ( T  s)
protectedinherited

Self-modifying multiplication by a scalar.

Definition at line 618 of file vector.h.

Referenced by ion::math::Vector< 4, T >::operator*=().

template<int Dimension, typename T >
const VectorBase< Dimension, T > ion::math::VectorBase< Dimension, T >::Negation ( ) const
protectedinherited

Unary negation.

Definition at line 632 of file vector.h.

Referenced by ion::math::Vector< 4, T >::operator-().

template<int Dimension, typename T>
void ion::math::Point< Dimension, T >::operator*= ( T  s)
inline

Definition at line 329 of file vector.h.

template<int Dimension, typename T>
void ion::math::Point< Dimension, T >::operator+= ( const Point< Dimension, T > &  v)
inline

Self-modifying operators.

Definition at line 326 of file vector.h.

template<int Dimension, typename T>
void ion::math::Point< Dimension, T >::operator+= ( const VectorType v)
inline

Definition at line 327 of file vector.h.

template<int Dimension, typename T>
const Point ion::math::Point< Dimension, T >::operator- ( ) const
inline

Unary operators.

Definition at line 333 of file vector.h.

template<int Dimension, typename T>
void ion::math::Point< Dimension, T >::operator-= ( const VectorType v)
inline

Definition at line 328 of file vector.h.

template<int Dimension, typename T>
void ion::math::Point< Dimension, T >::operator/= ( T  s)
inline

Definition at line 330 of file vector.h.

template<int Dimension, typename T>
T& ion::math::VectorBase< Dimension, T >::operator[] ( int  index)
inlineinherited

Mutable element accessor.

Definition at line 56 of file vector.h.

References DCHECK.

template<int Dimension, typename T>
const T& ion::math::VectorBase< Dimension, T >::operator[] ( int  index) const
inlineinherited

Read-only element accessor.

Definition at line 66 of file vector.h.

References DCHECK.

template<int Dimension, typename T>
void ion::math::VectorBase< Dimension, T >::Print ( std::ostream &  out,
const char  tag 
) const
inlineinherited

This is used for printing Vectors and Points to a stream.

Definition at line 83 of file vector.h.

Referenced by ion::math::operator<<().

template<int Dimension, typename T >
const VectorBase< Dimension, T > ion::math::VectorBase< Dimension, T >::Product ( const VectorBase< Dimension, T > &  v0,
const VectorBase< Dimension, T > &  v1 
)
staticprotectedinherited

Binary component-wise multiplication.

Definition at line 640 of file vector.h.

template<int Dimension, typename T >
const VectorBase< Dimension, T > ion::math::VectorBase< Dimension, T >::Quotient ( const VectorBase< Dimension, T > &  v0,
const VectorBase< Dimension, T > &  v1 
)
staticprotectedinherited

Binary component-wise division.

Definition at line 649 of file vector.h.

template<int Dimension, typename T>
template<char tag>
void ion::math::VectorBase< Dimension, T >::Read ( std::istream &  in)
inlineinherited

This is used for reading Vectors and Points from a stream.

Definition at line 95 of file vector.h.

References ion::base::GetExpectedChar().

template<int Dimension, typename T >
const VectorBase< Dimension, T > ion::math::VectorBase< Dimension, T >::Scale ( const VectorBase< Dimension, T > &  v,
T  s 
)
staticprotectedinherited

Binary multiplication by a scalar.

Definition at line 676 of file vector.h.

template<int Dimension, typename T >
void ion::math::VectorBase< Dimension, T >::Set ( T  e0)
inherited

Sets the vector values.

Definition at line 464 of file vector.h.

References ION_STATIC_ASSERT.

Referenced by ion::math::Rotation< T >::Rotation(), and ion::math::ScaleRangeNonUniformly().

template<int Dimension, typename T >
void ion::math::VectorBase< Dimension, T >::Set ( T  e0,
T  e1 
)
inherited

Definition at line 470 of file vector.h.

References ION_STATIC_ASSERT.

template<int Dimension, typename T >
void ion::math::VectorBase< Dimension, T >::Set ( T  e0,
T  e1,
T  e2 
)
inherited

Definition at line 477 of file vector.h.

References ION_STATIC_ASSERT.

template<int Dimension, typename T >
void ion::math::VectorBase< Dimension, T >::Set ( T  e0,
T  e1,
T  e2,
T  e3 
)
inherited

Definition at line 485 of file vector.h.

References ION_STATIC_ASSERT.

template<int Dimension, typename T >
void ion::math::VectorBase< Dimension, T >::Subtract ( const VectorBase< Dimension, T > &  v)
protectedinherited

Self-modifying subtraction.

Definition at line 612 of file vector.h.

Referenced by ion::math::Vector< 4, T >::operator-=().

template<int Dimension, typename T >
const VectorBase< Dimension, T > ion::math::VectorBase< Dimension, T >::Sum ( const VectorBase< Dimension, T > &  v0,
const VectorBase< Dimension, T > &  v1 
)
staticprotectedinherited

Binary component-wise addition.

Definition at line 658 of file vector.h.

template<int Dimension, typename T>
static const Point ion::math::Point< Dimension, T >::Zero ( )
inlinestatic

Friends And Related Function Documentation

template<int Dimension, typename T>
bool operator!= ( const Point< Dimension, T > &  p0,
const Point< Dimension, T > &  p1 
)
friend

Definition at line 378 of file vector.h.

template<int Dimension, typename T>
const Point operator* ( const Point< Dimension, T > &  p,
T  s 
)
friend

Binary scale and division operators.

Definition at line 357 of file vector.h.

template<int Dimension, typename T>
const Point operator* ( T  s,
const Point< Dimension, T > &  p 
)
friend

Definition at line 360 of file vector.h.

template<int Dimension, typename T>
const Point operator* ( const Point< Dimension, T > &  v,
const Point< Dimension, T > &  s 
)
friend

Definition at line 364 of file vector.h.

template<int Dimension, typename T>
const Point operator+ ( const Point< Dimension, T > &  p0,
const Point< Dimension, T > &  p1 
)
friend

Adding two Points produces another Point.

Definition at line 336 of file vector.h.

template<int Dimension, typename T>
const Point operator+ ( const Point< Dimension, T > &  p,
const VectorType v 
)
friend

Adding a Vector to a Point produces another Point.

Definition at line 340 of file vector.h.

template<int Dimension, typename T>
const Point operator+ ( const VectorType v,
const Point< Dimension, T > &  p 
)
friend

Definition at line 343 of file vector.h.

template<int Dimension, typename T>
const Point operator- ( const Point< Dimension, T > &  p,
const VectorType v 
)
friend

Subtracting a Vector from a Point produces another Point.

Definition at line 348 of file vector.h.

template<int Dimension, typename T>
const VectorType operator- ( const Point< Dimension, T > &  p0,
const Point< Dimension, T > &  p1 
)
friend

Subtracting two Points results in a Vector.

Definition at line 352 of file vector.h.

template<int Dimension, typename T>
const Point operator/ ( const Point< Dimension, T > &  v,
const Point< Dimension, T > &  s 
)
friend

Definition at line 367 of file vector.h.

template<int Dimension, typename T>
const Point operator/ ( const Point< Dimension, T > &  p,
T  s 
)
friend

Definition at line 370 of file vector.h.

template<int Dimension, typename T>
bool operator== ( const Point< Dimension, T > &  p0,
const Point< Dimension, T > &  p1 
)
friend

Exact equality and inequality comparisons.

Definition at line 375 of file vector.h.


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