Files Class List
Point< TYPE, N > Class Template Reference

Detailed Description

template<typename TYPE, int N>
class cy::Point< TYPE, N >

A general class for N-dimensional points (vectors).

#include <cyPoint.h>

Public Member Functions

Constructors
 Point ()
 
 Point (const Point &p)
 
 Point (const TYPE *p)
 
 Point (const TYPE &v)
 
template<typename T >
 Point (const Point< T, N > &p)
 
template<int M>
 Point (const Point< TYPE, M > &p)
 
template<typename T , int M>
 Point (const Point< T, M > &p)
 
 Point (const Point2< TYPE > &p)
 
 Point (const Point3< TYPE > &p)
 
 Point (const Point4< TYPE > &p)
 
template<typename T >
 Point (const Point2< T > &p)
 
template<typename T >
 Point (const Point3< T > &p)
 
template<typename T >
 Point (const Point4< T > &p)
 
template<typename P >
 Point (const P &p)
 
Set & Get value methods
void Zero ()
 
void Get (TYPE *p) const
 
void Set (const TYPE *p)
 
void Set (const TYPE &v)
 
template<int M>
void CopyData (TYPE *p)
 
template<typename T , int M>
void ConvertData (T *p)
 
General methods
TYPE LengthSquared () const
 
TYPE Length () const
 
void Normalize ()
 
Point GetNormalized () const
 
TYPE Sum () const
 
bool IsZero () const
 
TYPE Min () const
 
TYPE Max () const
 
int MinID () const
 
int MaxID () const
 
Limit methods
void Clamp (const TYPE &minValue, const TYPE &maxValue)
 
void ClampMin (const TYPE &v)
 
void ClampMax (const TYPE &v)
 
void Abs ()
 
Unary operators
Point operator- () const
 
Binary operators
Point operator+ (const Point &p) const
 
Point operator- (const Point &p) const
 
Point operator* (const Point &p) const
 
Point operator/ (const Point &p) const
 
Point operator+ (const TYPE &v) const
 
Point operator- (const TYPE &v) const
 
Point operator* (const TYPE &v) const
 
Point operator/ (const TYPE &v) const
 
Assignment operators
const Pointoperator= (const Point &p)
 
const Pointoperator+= (const Point &p)
 
const Pointoperator-= (const Point &p)
 
const Pointoperator*= (const Point &p)
 
const Pointoperator/= (const Point &p)
 
const Pointoperator+= (const TYPE &v)
 
const Pointoperator-= (const TYPE &v)
 
const Pointoperator*= (const TYPE &v)
 
const Pointoperator/= (const TYPE &v)
 
Test operators
bool operator== (const Point &p) const
 
bool operator!= (const Point &p) const
 
Access operators
TYPE & operator[] (int i)
 
TYPE operator[] (int i) const
 
Dot product
TYPE Dot (const Point &p) const
 
TYPE operator% (const Point &p) const
 

Public Attributes

Components of the point/vector
TYPE data [N]
 

Friends

Point operator+ (const TYPE v, const Point &p)
 
Point operator- (const TYPE v, const Point &p)
 
Point operator* (const TYPE v, const Point &p)
 

Member Function Documentation

§ Zero()

void Zero ( )

Sets the coordinates as zero.

§ Get()

void Get ( TYPE *  p) const

Puts the coordinate values into the array.

§ Set() [1/2]

void Set ( const TYPE *  p)

Sets the coordinates using the values in the given array.

§ Set() [2/2]

void Set ( const TYPE &  v)

Sets all coordinates using the given value.

§ CopyData()

void CopyData ( TYPE *  p)

Sets the coordinates as zero.

§ ConvertData()

void ConvertData ( T *  p)

Sets the coordinates as zero.

§ LengthSquared()

TYPE LengthSquared ( ) const

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

§ Length()

TYPE Length ( ) const

Returns the length of the vector.

§ Normalize()

void Normalize ( )

Normalizes the vector, such that its length becomes 1.

§ GetNormalized()

Point GetNormalized ( ) const

Returns a normalized copy of the vector.

§ Sum()

TYPE Sum ( ) const

Returns the sum of its components.

§ IsZero()

bool IsZero ( ) const

Returns true if all components are exactly zero.

§ Min()

TYPE Min ( ) const

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

§ Max()

TYPE Max ( ) const

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

§ MinID()

int MinID ( ) const

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

§ MaxID()

int MaxID ( ) const

Returns the square of the length. Effectively, this is the dot product of the vector with itself.

§ Clamp()

void Clamp ( const TYPE &  minValue,
const TYPE &  maxValue 
)

Converts all negative components to positive values.

§ ClampMin()

void ClampMin ( const TYPE &  v)

Converts all negative components to positive values.

§ ClampMax()

void ClampMax ( const TYPE &  v)

Converts all negative components to positive values.

§ Abs()

void Abs ( )

Converts all negative components to positive values.

§ Dot()

TYPE Dot ( const Point< TYPE, N > &  p) const

Dot product.

§ operator%()

TYPE operator% ( const Point< TYPE, N > &  p) const

Dot product operator.

Friends And Related Function Documentation

§ operator+

Point operator+ ( const TYPE  v,
const Point< TYPE, N > &  p 
)
friend

Addition with a constant.

§ operator-

Point operator- ( const TYPE  v,
const Point< TYPE, N > &  p 
)
friend

Subtraction from a constant.

§ operator*

Point operator* ( const TYPE  v,
const Point< TYPE, N > &  p 
)
friend

Multiplication with a constant.