A 3D Dynamic Geometry Software

Calques 3D C++



CVector4 Class Reference

Inheritance diagram for CVector4:

Inheritance graph
Collaboration diagram for CVector4:

Collaboration graph

List of all members.


Detailed Description

CVector4.

Equality functions/operators

bool operator== (const CVector4 &other) const
 Return TRUE if the coordinates of the two vectors are equal.
bool operator!= (const CVector4 &other) const
 Return TRUE if one of the coordinates of the two vectors is different.
bool NullVector () const
 Return TRUE if the vector is null.

Cast operators

 operator CPoint () const
 Convert the vector into a point (by rounding and returning x and y).
 operator FCoord () const
 Convert the vector into its squared length.

Functions/binary-operators that return Vector

CVector4 operator+ (const CVector4 &size) const
 Add the two vectors.
CVector4 operator- (const CVector4 &size) const
 Subtract the two vectors.
CVector4 operator * (const FCoord &lambda) const
 Multiply the vector by a given scalar.
CVector4 operator% (const CVector4 &vec) const
 Calculate the vector product of the two vectors.
CVector4 operator- () const
 Inverse the vector.
CVector4 Normalized ()
 Normalize the vector (and assign its squared length to N).

Functions/binary-operators that return FCoord

FCoord operator * (const CVector4 &vec) const
 Calculate the dot product of the two vectors.
FCoord Norme ()
 Affect the squared length of the vector to N and return it.

Serialization

CArchive & operator<< (CArchive &ar, const CVector4 &pt)
 Write the vector into the archive.
CArchive & operator>> (CArchive &ar, CVector4 &pt)
 Read the vector from the archive.

Public Member Functions

 CVector4 ()
 Create an uninitialized vector.
 CVector4 (FCoord _x, FCoord _y, FCoord _z, FCoord _w=1)
 Create a vector from 3 (or 4) coordinates.
 CVector4 (const CVector4 far &point)
 Create a vector from another vector.
void operator= (const CVector4 &other)
 Assign the source vector to this one.

Public Attributes

FCoord x
 X-coordinate of the vector.
FCoord y
 Y-coordinate of the vector.
FCoord z
 Z-coordinate of the vector.
FCoord w
 W-coordinate of the vector.
FCoord N
 Squared length of the vector.

Protected Member Functions

int round (FCoord x) const
 Return the nearest integer of the scalar.

Constructor & Destructor Documentation

CVector4 (  )  [inline]

Create an uninitialized vector.

CVector4 ( FCoord  _x,
FCoord  _y,
FCoord  _z,
FCoord  _w = 1 
) [inline]

Create a vector from 3 (or 4) coordinates.

CVector4 ( const CVector4 far &  point  )  [inline]

Create a vector from another vector.


Member Function Documentation

void operator= ( const CVector4 other  )  [inline]

Assign the source vector to this one.

bool operator== ( const CVector4 other  )  const [inline]

Return TRUE if the coordinates of the two vectors are equal.

bool operator!= ( const CVector4 other  )  const [inline]

Return TRUE if one of the coordinates of the two vectors is different.

bool NullVector (  )  const [inline]

Return TRUE if the vector is null.

operator CPoint (  )  const [inline]

Convert the vector into a point (by rounding and returning x and y).

operator FCoord (  )  const [inline]

Convert the vector into its squared length.

CVector4 operator+ ( const CVector4 size  )  const [inline]

Add the two vectors.

CVector4 operator- ( const CVector4 size  )  const [inline]

Subtract the two vectors.

CVector4 operator * ( const FCoord lambda  )  const [inline]

Multiply the vector by a given scalar.

CVector4 operator% ( const CVector4 vec  )  const [inline]

Calculate the vector product of the two vectors.

CVector4 operator- (  )  const [inline]

Inverse the vector.

CVector4 Normalized (  )  [inline]

Normalize the vector (and assign its squared length to N).

FCoord operator * ( const CVector4 vec  )  const [inline]

Calculate the dot product of the two vectors.

FCoord Norme (  )  [inline]

Affect the squared length of the vector to N and return it.

int round ( FCoord  x  )  const [inline, protected]

Return the nearest integer of the scalar.


Friends And Related Function Documentation

CArchive& operator<< ( CArchive &  ar,
const CVector4 pt 
) [friend]

Write the vector into the archive.

CArchive& operator>> ( CArchive &  ar,
CVector4 pt 
) [friend]

Read the vector from the archive.


Member Data Documentation

X-coordinate of the vector.

Y-coordinate of the vector.

Z-coordinate of the vector.

W-coordinate of the vector.

Squared length of the vector.