Files Class List
Point3< TYPE > Class Template Reference

Detailed Description

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

3D point (vector) class

#include <cyPoint.h>

Public Member Functions

Constructors
 Point3 ()
 
 Point3 (const TYPE &_x, const TYPE &_y, const TYPE &_z)
 
 Point3 (const Point3 &p)
 
 Point3 (const TYPE &v)
 
 Point3 (const Point2< TYPE > &p, TYPE _z=0)
 
 Point3 (const Point4< TYPE > &p)
 
template<typename T >
 Point3 (const Point3< T > &p)
 
template<typename T >
 Point3 (const Point2< T > &p, TYPE _z=0)
 
template<typename T >
 Point3 (const Point4< T > &p)
 
template<int M>
 Point3 (const Point< TYPE, M > &p)
 
template<typename T , int M>
 Point3 (const Point< T, M > &p)
 
template<typename P >
 Point3 (const P &p)
 
Set & Get value methods
void Zero ()
 
void Get (TYPE *p) const
 
void Set (const TYPE *p)
 
void Set (const TYPE &v)
 
void Set (const TYPE &_x, const TYPE &_y, const TYPE &_z)
 
General methods
TYPE LengthSquared () const
 
TYPE Length () const
 
void Normalize ()
 
Point3 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
Point3 operator- () const
 
Binary operators
Point3 operator+ (const Point3 &p) const
 
Point3 operator- (const Point3 &p) const
 
Point3 operator* (const Point3 &p) const
 
Point3 operator/ (const Point3 &p) const
 
Point3 operator+ (const TYPE &v) const
 
Point3 operator- (const TYPE &v) const
 
Point3 operator* (const TYPE &v) const
 
Point3 operator/ (const TYPE &v) const
 
Assignment operators
const Point3operator= (const Point3 &p)
 
const Point3operator+= (const Point3 &p)
 
const Point3operator-= (const Point3 &p)
 
const Point3operator*= (const Point3 &p)
 
const Point3operator/= (const Point3 &p)
 
const Point3operator+= (const TYPE &v)
 
const Point3operator-= (const TYPE &v)
 
const Point3operator*= (const TYPE &v)
 
const Point3operator/= (const TYPE &v)
 
Test operators
bool operator== (const Point3 &p) const
 
bool operator!= (const Point3 &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
 
Cross product and dot product
Point3 Cross (const Point3 &p) const
 
Point3 operator^ (const Point3 &p) const
 
TYPE Dot (const Point3 &p) const
 
TYPE operator% (const Point3 &p) const
 
Conversion Methods
Point2< TYPE > XY () const
 

Public Attributes

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

Friends

Point3 operator+ (const TYPE v, const Point3 &p)
 
Point3 operator- (const TYPE v, const Point3 &p)
 
Point3 operator* (const TYPE v, const Point3 &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 ( const TYPE &  v)

Sets all coordinates using the given value.

§ Set() [3/3]

void Set ( const TYPE &  _x,
const TYPE &  _y,
const TYPE &  _z 
)

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

Point3 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.

§ Cross()

Point3 Cross ( const Point3< TYPE > &  p) const

Cross product.

§ operator^()

Point3 operator^ ( const Point3< TYPE > &  p) const

Cross product.

§ Dot()

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

Dot product.

§ operator%()

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

Dot product.

Friends And Related Function Documentation

§ operator+

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

Addition with a constant.

§ operator-

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

Subtraction from a constant.

§ operator*

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

Multiplication with a constant.