K3dVector3Work Class Reference

#include <K3dVector3Work.h>

Inheritance diagram for K3dVector3Work:

K3dVector3Build K3dObjectBuild K3dMngGeometry K3dMngSystem K3dScene List of all members.

Public Member Functions

 K3dVector3Work (K3dGameData *_pGameData)
 ~K3dVector3Work (void)
void CheckVector3Array (TVector3Array &_rvVector)
 Check vertex array.
K3dVector3ObjSqr (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Calculate square of two vectors.
K3dVector3ObjCross (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Calculate cross product between two vectors.
K3dVector3ObjUnitCross (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Calculate normalized cross product between two vectors.
K3dVector3ObjNormal (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1, const K3dVector3Obj &_rkV2)
 Calculate normal vector from three vectors.
void AddScalar (K3dVector3Obj &_rkV, const float fScalar, const int i)
 Add value to vector scalar by index.
void SubtractScalar (K3dVector3Obj &_rkV, const float _fScalar, const int _iId)
 Subtract value from scalar by index.
K3dVector3ObjNormalize (const K3dVector3Obj &_rkV)
 Normalize vector.
K3dVector3ObjReflection (const K3dVector3Obj &_rkDirection, const K3dVector3Obj &_rkNormal)
 Calculate reflection vector between two vectors.
float Length (const K3dVector3Obj &_rkV)
 Calculate vector length.
K3dVector3ObjVectorBetween (const K3dVector3Obj &_rkV1, const K3dVector3Obj &_rkV2)
 Calculate vector between two vectors (vec_1 - vec_2).
void Angle (K3dVector3Obj &_rkAngle)
 Change vector to angle for rotation by vector.
float SquaredLength (const K3dVector3Obj &_rkV)
 Calculate vector squared length.
const float SquaredLength (const K3dVector3Obj &_rkV) const
 Calculate vector squared length.
float UnitLength (const K3dVector3Obj &_rkV)
 Calculate vector unit length.
K3dVector3ObjAddVector (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Add two vectors.
void DivideVector (K3dVector3Obj &_rkV0, const float _fDivider)
 Divide vector by divider.
void Translate (K3dVector3 &_rkV, const K3dVector3 &_rkDir, const float _fDist)
 Translate vector by direction vector.
void Invert (K3dVector3 &_rkV)
 Invert vector.
float Dot (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Calculate dot product between two vectors.
float AngleBetweenNormals (const K3dVector3Obj &_rkNormal0, const K3dVector3Obj &_rkNormal1)
 Calculate angle in degree between normal vectors.
float AngleBetweenVectors (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Calculate angle between vectors.
float AngleBetweenVectors (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1, const K3dVector3Obj &_rkCentre)
 Calculate angle between vectors toward to vectors centre.
float DotAngleBetweenVectors (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Calculate angle between vectors.
K3dVector3ObjProjection (const K3dVector3Obj &_rkP, const K3dVector3Obj &_rkQ)
 Projection vector P to vector Q.
K3dVector3ObjPerpendicular (const K3dVector3Obj &_rkP, const K3dVector3Obj &_rkQ)
 Perpendicular component of vector P respect to vector Q.
K3dVector3ObjMultiply (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Multiply two vectors.
bool CompareIntScalars (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1)
 Compare integer scalars.
bool EqualRange (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1, const float _fRange)
 Return true if vectors equal +- range.
K3dVector3ObjCalcCentre (const K3dVector3Obj &_rkV0, const K3dVector3Obj &_rkV1, const K3dVector3Obj &_rkV2)
 Calculate centre from three vectors. (triangle centre).
void SwapXY (K3dVector3Obj &_rkV)
 Swap XY axis.
void SwapXZ (K3dVector3Obj &_rkV)
 Swap XZ axis.
void SwapYZ (K3dVector3Obj &_rkV)
 Swap YZ axis.
void CalcVectorArrayCentre (K3dVector3Obj &_rkVCentre, const TVector3Array &_rvVector)
 Calculate centre of vector array.

Private Attributes

K3dGameDatam_pGameData
 Global game data, data centered game system.
K3dVector3Obj m_kVector
 Slave vector.

Detailed Description

Definition at line 42 of file K3dVector3Work.h.


Constructor & Destructor Documentation

K3dVector3Work::K3dVector3Work ( K3dGameData _pGameData  ) 

Definition at line 35 of file K3dVector3Work.cpp.

References m_pGameData, and K3dSceneData::SetVector3Work().

K3dVector3Work::~K3dVector3Work ( void   ) 

Definition at line 42 of file K3dVector3Work.cpp.


Member Function Documentation

void K3dVector3Work::CheckVector3Array ( TVector3Array _rvVertex  ) 

Check vertex array.

Parameters:
_rvVertex Input vertex array

Definition at line 47 of file K3dVector3Work.cpp.

Referenced by K3dCutPoly::CalcNewEdges().

K3dVector3Obj & K3dVector3Work::Sqr ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Calculate square of two vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
K3dVector3Obj Result square of two vectors _rkV0 * _rkV1

Definition at line 64 of file K3dVector3Work.cpp.

References m_kVector.

K3dVector3Obj & K3dVector3Work::Cross ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Calculate cross product between two vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
K3dVector3Obj Result cross product between two vectors _rkV0 X _rkV1

Definition at line 74 of file K3dVector3Work.cpp.

References m_kVector.

Referenced by AngleBetweenVectors(), K3dPlaneWork::CalcVertexArray(), K3dMatrixWork::RotationArbitraryVector(), K3dMatrixWork::RotationArbitraryVectorGL(), K3dMatrixWork::RotationForwardVector(), K3dMatrixWork::RotationForwardVectorGL(), K3dMatrixWork::RotationRightVector(), K3dMatrixWork::RotationRightVectorGL(), K3dMatrixWork::RotationUpVector(), K3dMatrixWork::RotationUpVectorGL(), and UnitCross().

K3dVector3Obj & K3dVector3Work::UnitCross ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Calculate normalized cross product between two vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
K3dVector3Obj Result normalized cross product betwwen two vectors _rkV0 X _rkV1

Definition at line 86 of file K3dVector3Work.cpp.

References Cross(), m_kVector, and Normalize().

Referenced by K3dCutPoly::CalcNewEdges(), K3dPlaneWork::CalcVertexArray(), K3dConvex::CreateOnPlaneEdges(), and Normal().

K3dVector3Obj & K3dVector3Work::Normal ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1,
const K3dVector3Obj _rkV2 
)

Calculate normal vector from three vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
_rkV2 Third input vector
Return values:
K3dVector3Obj Result normal vector from three vectors

Definition at line 98 of file K3dVector3Work.cpp.

References UnitCross().

Referenced by K3dTriangleWork::CalcNormal(), K3dFaceWork::CalcNormal(), K3dPlaneWork::CalcPlane(), and K3dTriangulation::CreateNewTriangle().

void K3dVector3Work::AddScalar ( K3dVector3Obj _rkV,
const float  _fScalar,
const int  _iId 
)

Add value to vector scalar by index.

Parameters:
_rkV Input output vector
_fScalar Scalar value which adds to current scalar value
_iId Scalar index. Index range must be 0 - 2

Definition at line 112 of file K3dVector3Work.cpp.

Referenced by K3dCamera::GoBackward(), K3dCamera::GoForward(), K3dCamera::GoUp(), K3dCamera::LurchRight(), K3dCamera::MouseRotate(), K3dCamera::Move(), K3dCamera::TurnRight(), and K3dCamera::TurnUp().

void K3dVector3Work::SubtractScalar ( K3dVector3Obj _rkV,
const float  _fScalar,
const int  _iId 
)

Subtract value from scalar by index.

Parameters:
_rkV Input output vector
_fScalar Scalar value which subtracts from current scalar value
_iId Scalar index. Index range must be 0 - 2

Definition at line 128 of file K3dVector3Work.cpp.

Referenced by K3dCamera::GoBackward(), K3dCamera::GoDown(), K3dCamera::GoForward(), K3dCamera::LurchLeft(), K3dCamera::Move(), K3dCamera::TurnDown(), and K3dCamera::TurnLeft().

K3dVector3Obj & K3dVector3Work::Normalize ( const K3dVector3Obj _rkV  ) 

Normalize vector.

Parameters:
_rkV Input output vector for normalization
Return values:
K3dVector3Obj Result normalized vector

Definition at line 141 of file K3dVector3Work.cpp.

References K3dVector3::GetX(), K3dVector3::GetY(), K3dVector3::GetZ(), Length(), and m_kVector.

Referenced by AngleBetweenVectors(), K3dCutPoly::CalcNewEdges(), K3dPlaneWork::CalcPlane(), K3dTriangleWork::CalcScale(), K3dConvex::CreateOnPlaneEdges(), DotAngleBetweenVectors(), K3dIntersection::LineTriangle(), K3dSphereWork::MoveByMouse(), K3dIntersection::RayTriangle(), Reflection(), K3dMatrixWork::RotationArbitraryVector(), K3dMatrixWork::RotationArbitraryVectorGL(), K3dMatrixWork::RotationForwardVector(), K3dMatrixWork::RotationForwardVectorGL(), K3dMatrixWork::RotationRightVector(), K3dMatrixWork::RotationRightVectorGL(), K3dMatrixWork::RotationUpVector(), K3dMatrixWork::RotationUpVectorGL(), and UnitCross().

K3dVector3Obj & K3dVector3Work::Reflection ( const K3dVector3Obj _rkDirection,
const K3dVector3Obj _rkNormal 
)

Calculate reflection vector between two vectors.

Parameters:
_rkDirection Input direction vector
_rkNormal Input normal vector
Return values:
K3dVector3Obj Result reflection vector

Definition at line 176 of file K3dVector3Work.cpp.

References Dot(), m_kVector, and Normalize().

float K3dVector3Work::Length ( const K3dVector3Obj _rkV  ) 

Calculate vector length.

Parameters:
_rkV Input vector
Return values:
float Result vector lenght

Definition at line 212 of file K3dVector3Work.cpp.

References K3dVector3::GetX(), K3dVector3::GetY(), and K3dVector3::GetZ().

Referenced by Angle(), K3dPlaneWork::CalcVertexArray(), Normalize(), and K3dDistance::Points().

K3dVector3Obj & K3dVector3Work::VectorBetween ( const K3dVector3Obj _rkV1,
const K3dVector3Obj _rkV2 
)

Calculate vector between two vectors (vec_1 - vec_2).

Parameters:
_rkV1 First input vector
_rkV2 Second input vector
Return values:
K3dVector3Obj Vector between two vectors

Definition at line 221 of file K3dVector3Work.cpp.

References m_kVector.

Referenced by K3dDistance::Points().

void K3dVector3Work::Angle ( K3dVector3Obj _rkAngle  ) 

Change vector to angle for rotation by vector.

Parameters:
_rkAngle Input output angle

Definition at line 231 of file K3dVector3Work.cpp.

References K3dMath::ACos(), K3dVector3::GetX(), K3dVector3::GetY(), Length(), and m_kVector.

float K3dVector3Work::SquaredLength ( const K3dVector3Obj _rkV  ) 

Calculate vector squared length.

Parameters:
_rkV Input vector
Return values:
float Vector squared length

Definition at line 255 of file K3dVector3Work.cpp.

References K3dVector3::GetVector().

Referenced by K3dDistance::SqrPointRay().

const float K3dVector3Work::SquaredLength ( const K3dVector3Obj _rkV  )  const

Calculate vector squared length.

Parameters:
_rkV Input vector
Return values:
float Vector squared length

Definition at line 266 of file K3dVector3Work.cpp.

References K3dVector3::GetVector().

float K3dVector3Work::UnitLength ( const K3dVector3Obj _rkV  ) 

Calculate vector unit length.

Parameters:
_rkV Input vector
Return values:
float Vector unit length

Definition at line 277 of file K3dVector3Work.cpp.

References K3dVector3::GetX(), K3dVector3::GetY(), and K3dVector3::GetZ().

Referenced by AngleBetweenVectors().

K3dVector3Obj & K3dVector3Work::AddVector ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Add two vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
K3dVector3Obj Result added vector

Definition at line 286 of file K3dVector3Work.cpp.

References m_kVector.

void K3dVector3Work::DivideVector ( K3dVector3Obj _rkV,
const float  _fDivider 
)

Divide vector by divider.

Parameters:
_rkV Input output vector for divide by divider
_fDivider Divider value

Definition at line 299 of file K3dVector3Work.cpp.

void K3dVector3Work::Translate ( K3dVector3 _rkV,
const K3dVector3 _rkDir,
const float  _fDist 
)

Translate vector by direction vector.

Parameters:
_rkV Input output translation vector
_rkDir Direction vector
_fDist Vector distance

Definition at line 318 of file K3dVector3Work.cpp.

References m_kVector.

Referenced by K3dTriangleWork::CalcScale().

void K3dVector3Work::Invert ( K3dVector3 _rkV  ) 

Invert vector.

Parameters:
_rkV Input output invert vector

Definition at line 328 of file K3dVector3Work.cpp.

float K3dVector3Work::Dot ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Calculate dot product between two vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
float Result dot product between two vectors _rkV0 . _rkV1

Definition at line 340 of file K3dVector3Work.cpp.

Referenced by AngleBetweenNormals(), K3dPlaneWork::CalcDistance(), K3dPlaneWork::CalcVertexArray(), DotAngleBetweenVectors(), K3dIntrLinePlane::LinePlane(), K3dIntersection::LineTriangle(), Projection(), K3dIntersection::RayPlane(), K3dIntersection::RayTriangle(), Reflection(), K3dMatrixWork::RotationArbitraryVector(), K3dMatrixWork::RotationArbitraryVectorGL(), K3dMatrixWork::RotationForwardVector(), K3dMatrixWork::RotationForwardVectorGL(), K3dMatrixWork::RotationRightVector(), K3dMatrixWork::RotationRightVectorGL(), K3dMatrixWork::RotationUpVector(), K3dMatrixWork::RotationUpVectorGL(), and K3dDistance::SqrPointRay().

float K3dVector3Work::AngleBetweenNormals ( const K3dVector3Obj _rkNormal0,
const K3dVector3Obj _rkNormal1 
)

Calculate angle in degree between normal vectors.

Parameters:
_rkNormal0 First input vector
_rkNormal1 Second input vector
Return values:
float Result angle between two normals

Definition at line 354 of file K3dVector3Work.cpp.

References K3dMath::ACos(), and Dot().

Referenced by AngleBetweenVectors().

float K3dVector3Work::AngleBetweenVectors ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Calculate angle between vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
float Result angle between two vectors

Definition at line 376 of file K3dVector3Work.cpp.

References AngleBetweenNormals(), and Normalize().

Referenced by AngleBetweenVectors(), and K3dTriangulation::SortVector3ArrayByAngle().

float K3dVector3Work::AngleBetweenVectors ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1,
const K3dVector3Obj _rkCentre 
)

Calculate angle between vectors toward to vectors centre.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
_rkCentre Vectors centre
Return values:
float Result angle between two vectors

Definition at line 401 of file K3dVector3Work.cpp.

References AngleBetweenVectors(), Cross(), K3dMath::K_RAD_TO_DEG, and UnitLength().

float K3dVector3Work::DotAngleBetweenVectors ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Calculate angle between vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
float Dot angle betwwen two vectors

Definition at line 161 of file K3dVector3Work.cpp.

References Dot(), and Normalize().

K3dVector3Obj & K3dVector3Work::Projection ( const K3dVector3Obj _rkP,
const K3dVector3Obj _rkQ 
)

Projection vector P to vector Q.

Parameters:
_rkP P input vector
_rkQ Q input vector
Return values:
float Result projection vector

Definition at line 427 of file K3dVector3Work.cpp.

References Dot(), m_kVector, and K3dVector3::Set().

Referenced by Perpendicular().

K3dVector3Obj & K3dVector3Work::Perpendicular ( const K3dVector3Obj _rkP,
const K3dVector3Obj _rkQ 
)

Perpendicular component of vector P respect to vector Q.

Parameters:
_rkP P input vector
_rkQ Q input vector
Return values:
float Result perpendicular vector

Definition at line 454 of file K3dVector3Work.cpp.

References m_kVector, and Projection().

K3dVector3Obj & K3dVector3Work::Multiply ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Multiply two vectors.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
K3dVector3Obj Result multiplication of two vectors

Definition at line 473 of file K3dVector3Work.cpp.

References m_kVector.

bool K3dVector3Work::CompareIntScalars ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1 
)

Compare integer scalars.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
Return values:
bool True if vector scalars are equal

Definition at line 486 of file K3dVector3Work.cpp.

bool K3dVector3Work::EqualRange ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1,
const float  _fRange 
)

Return true if vectors equal +- range.

Parameters:
_rkV0 First input vector
_rkV1 Second input vector
_fRange Input equal range
Return values:
bool True if vector scalars are equal +- range

Definition at line 505 of file K3dVector3Work.cpp.

References K3dMath::Positive().

K3dVector3Obj & K3dVector3Work::CalcCentre ( const K3dVector3Obj _rkV0,
const K3dVector3Obj _rkV1,
const K3dVector3Obj _rkV2 
)

Calculate centre from three vectors. (triangle centre).

Parameters:
_rkV0 First triangle vector
_rkV1 Second triangle vector
_rkV2 Third triangle vector
Return values:
K3dVector3Work Result triangle centre

Definition at line 527 of file K3dVector3Work.cpp.

References m_kVector.

Referenced by K3dTriangleWork::CalcTriangleCentre().

void K3dVector3Work::SwapXY ( K3dVector3Obj _rkV  ) 

Swap XY axis.

Parameters:
_rkV Input output vector

Definition at line 564 of file K3dVector3Work.cpp.

void K3dVector3Work::SwapXZ ( K3dVector3Obj _rkV  ) 

Swap XZ axis.

Parameters:
_rkV Input output vector

Definition at line 573 of file K3dVector3Work.cpp.

void K3dVector3Work::SwapYZ ( K3dVector3Obj _rkV  ) 

Swap YZ axis.

Parameters:
_rkV Input output vector

Definition at line 582 of file K3dVector3Work.cpp.

void K3dVector3Work::CalcVectorArrayCentre ( K3dVector3Obj _rkVCentre,
const TVector3Array _rvVector 
)

Calculate centre of vector array.

Parameters:
_rkVCentre Input output centre of vector array
_rvVector Vector array

Definition at line 592 of file K3dVector3Work.cpp.

References K3dVector3::Reset().

Referenced by K3dTriangulation::SortVector3ArrayByAngle().


Member Data Documentation

K3dGameData* K3dVector3Work::m_pGameData [private]

Global game data, data centered game system.

Reimplemented in K3dObjectBuild, K3dVector3Build, K3dScene, K3dMngGeometry, and K3dMngSystem.

Definition at line 44 of file K3dVector3Work.h.

Referenced by K3dVector3Work().

K3dVector3Obj K3dVector3Work::m_kVector [private]

Slave vector.

Definition at line 45 of file K3dVector3Work.h.

Referenced by AddVector(), Angle(), CalcCentre(), Cross(), Multiply(), Normalize(), Perpendicular(), Projection(), Reflection(), Sqr(), Translate(), UnitCross(), and VectorBetween().


The documentation for this class was generated from the following files:
Generated on Thu Aug 16 23:53:34 2007 for K3dEngine by  doxygen 1.5.0