Files Class List
Point4< TYPE > Class Template Reference

Detailed Description

template<typename TYPE>
class cy::Point4< TYPE >

4D point (vector) class

#include <cyPoint.h>

Public Member Functions

Constructors
 Point4 ()
 
 Point4 (TYPE _x, TYPE _y, TYPE _z, TYPE _w)
 
 Point4 (const Point4 &p)
 
 Point4 (TYPE v)
 
 Point4 (const Point3< TYPE > &p, TYPE _w=1)
 
 Point4 (const Point2< TYPE > &p, TYPE _z=0, TYPE _w=1)
 
template<typename T >
 Point4 (const Point4< T > &p)
 
template<typename T >
 Point4 (const Point3< T > &p, TYPE _w=1)
 
template<typename T >
 Point4 (const Point2< T > &p, TYPE _z=0, TYPE _w=1)
 
template<int M>
 Point4 (const Point< TYPE, M > &p)
 
template<typename T , int M>
 Point4 (const Point< T, M > &p)
 
template<typename P >
 Point4 (const P &p)
 
Set & Get value methods
void Zero ()
 
void Get (TYPE *p) const
 
void Set (const TYPE *p)
 
void Set (TYPE v)
 
void Set (TYPE _x, TYPE _y, TYPE _z, TYPE _w=1)
 
General methods
TYPE LengthSquared () const
 
TYPE Length () const
 
void Normalize ()
 
Point4 GetNormalized () const
 
TYPE Sum () const
 
bool IsZero () const
 
TYPE Min () const
 
TYPE Max () const
 
int MinID () const
 
int MaxID () const
 
Limit methods
void Clamp (TYPE minValue, TYPE maxValue)
 
void ClampMin (TYPE v)
 
void ClampMax (TYPE v)
 
void Abs ()
 
Unary operators
Point4 operator- () const
 
Binary operators
Point4 operator+ (const Point4 &p) const
 
Point4 operator- (const Point4 &p) const
 
Point4 operator* (const Point4 &p) const
 
Point4 operator/ (const Point4 &p) const
 
Point4 operator+ (const TYPE v) const
 
Point4 operator- (const TYPE v) const
 
Point4 operator* (const TYPE v) const
 
Point4 operator/ (const TYPE v) const
 
Assignment operators
const Point4operator= (const Point4 &p)
 
const Point4operator+= (const Point4 &p)
 
const Point4operator-= (const Point4 &p)
 
const Point4operator*= (const Point4 &p)
 
const Point4operator/= (const Point4 &p)
 
const Point4operator+= (const TYPE v)
 
const Point4operator-= (const TYPE v)
 
const Point4operator*= (const TYPE v)
 
const Point4operator/= (const TYPE v)
 
Test operators
bool operator== (const Point4 &p) const
 
bool operator!= (const Point4 &p) const
 
Access operators
TYPE & operator[] (int i)
 
const TYPE & operator[] (int i) const
 
TYPE & Element (int i)
 
const TYPE & Element (int i) const
 
TYPE * Data ()
 
const TYPE * Data () const
 
Dot product
TYPE Dot (const Point4 &p) const
 
TYPE operator% (const Point4 &p) const
 
Conversion Methods
Point2< TYPE > XY () const
 
Point3< TYPE > XYZ () const
 
Point3< TYPE > GetNonHomogeneous () const
 

Public Attributes

Components of the point/vector
TYPE x
 
TYPE y
 
TYPE z
 
TYPE w
 

Friends

Point4 operator+ (const TYPE v, const Point4 &p)
 
Point4 operator- (const TYPE v, const Point4 &p)
 
Point4 operator* (const TYPE v, const Point4 &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/3]

void Set ( const TYPE *  p)

Sets the coordinates using the values in the given array.

§ Set() [2/3]

void Set ( TYPE  v)

Sets all coordinates using the given value.

§ Set() [3/3]

void Set ( TYPE  _x,
TYPE  _y,
TYPE  _z,
TYPE  _w = 1 
)

Sets the coordinates using the given values.

§ 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()

Point4 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 ( TYPE  minValue,
TYPE  maxValue 
)

Converts all negative components to positive values.

§ ClampMin()

void ClampMin ( TYPE  v)

Converts all negative components to positive values.

§ ClampMax()

void ClampMax ( TYPE  v)

Converts all negative components to positive values.

§ Abs()

void Abs ( )

Converts all negative components to positive values.

§ Dot()

TYPE Dot ( const Point4< TYPE > &  p) const

Dot product.

§ operator%()

TYPE operator% ( const Point4< TYPE > &  p) const

Dot product.

Friends And Related Function Documentation

§ operator+

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

Addition with a constant.

§ operator-

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

Subtraction from a constant.

§ operator*

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

Multiplication with a constant.