5#if !defined(AFX_3DVECTOR_H__CA6BC2A2_FAC2_11D1_A0DE_000000000000__INCLUDED_)
6#define AFX_3DVECTOR_H__CA6BC2A2_FAC2_11D1_A0DE_000000000000__INCLUDED_
15BEGIN_MOOTOOLS_NAMESPACE
37 TYPE& operator[](
int i);
38 const TYPE& operator[](
int i)
const;
40 const TYPE* ValPtr()
const;
44 unsigned int SizeOf()
const;
46 void Init(
float x = 0.0f,
float y = 0.0f,
float z = 0.0f);
47 void Init(
double x = 0.0,
double y = 0.0,
double z = 0.0);
99 double Length()
const;
100 double Length2()
const;
118 virtual bool IsKindOf(
unsigned int classid)
const;
119 virtual unsigned int ClassID()
const;
123END_MOOTOOLS_NAMESPACE
126#include "3DVector.inl"
128BEGIN_MOOTOOLS_NAMESPACE
158 return static_cast<unsigned int>(
sizeof(
TYPE) * 3);
184 x = (
TYPE)(point2.x - point1.x);
185 y = (
TYPE)(point2.y - point1.y);
186 z = (
TYPE)(point2.z - point1.z);
198 CPt::operator=(
vect);
210 return MAKE_CUSTOM_ID(
'V',
'E',
'C',
'I');
215 return MAKE_CUSTOM_ID(
'V',
'E',
'C',
'F');
220 return MAKE_CUSTOM_ID(
'V',
'E',
'C',
'D');
228 return CPt::IsKindOf(classid);
236 return CPt::IsKindOf(classid);
276 XASSERT(
pt.size == 3);
296 SWAP_VALUES(x, y,
tmp);
299 SWAP_VALUES(x, z,
tmp);
302 SWAP_VALUES(y, z,
tmp);
309 switch (
swapMode & SWAP_INVERT_FLAGS)
393 return HashMixValue(hash.x + HashMixValue(hash.y)) + hash.z;
397#include "StringTools.h"
400 XTRACE(
_T(
"Vector : %.5f %.5f %.5f\n"), x, y, z);
406 XTRACE(
_T(
"Vector : %d %d %d\n"), x, y, z);
412 if (C3DTVector::ClassID() == classid)
415 return CPt::IsKindOf(classid);
420 return MAKE_CUSTOM_ID(
'V',
'E',
'C',
'T');
424END_MOOTOOLS_NAMESPACE
C3DTPoint template class definition for handling x, y, z 3D point coordinate.
CPt class is the base class for different class of points (C3DPoint, CUVWPoint...)
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
bool IsInfinite() const
Check if one of the coordinate has inf value.
Definition 3DVector.inl:338
C3DTVector Negate() const
/ operator - : return negate of each component (-x, -y, -z)
Definition 3DVector.inl:104
bool Normalize()
Return false if vector length is null.
Definition 3DVector.inl:421
void GetDouble(double *values3d) const
Get vector and fill 3 doubles.
Definition 3DVector.h:342
bool IsNull(double precision=PRECISION_LIMIT) const
Compare vector to (0.0, 0.0, 0.0). Return true if equal, false otherwise.
Definition 3DVector.inl:439
C3DTVector Mult(const C3DTVector &vector) const
Multiply each component (x, y, z) with vect(x, y, z). This is not the scalar product !
Definition 3DVector.inl:256
bool IsNan(bool resetToZero=false)
Check if one of the coordinate has nan value. resetToZero nan = true, reset coordinates to zero if an...
Definition 3DVector.inl:346
C3DTVector Div(const C3DTVector &vector, bool checkZero=true) const
Divide each component (x, y, z) with vect(x, y, z). This is not the scalar product !
Definition 3DVector.inl:261
C3DTVector & SelfDiv(const C3DTVector &vector, bool checkZero=true)
Self divide each component (x, y, z) with vect(x, y, z). This is not the scalar product !
Definition 3DVector.inl:293
void Offset(TYPE value)
Add value to x, y, z.
Definition 3DVector.inl:322
C3DTVector Invert() const
/ operator / : return invert each component (1/x, 1/y, 1/z)
Definition 3DVector.inl:118
void SetValues(const TYPE2 *values3t)
Set vector from 3 TYPE.
Definition 3DVector.inl:76
void SelfInvert()
/ operator / : invert each component (1/x, 1/y, 1/z)
Definition 3DVector.inl:97
void SetFloat(const float *values3f)
Set vector from 3 floats.
Definition 3DVector.h:328
void SelfNegate()
/ operator - : negate each component (-x, -y, -z)
Definition 3DVector.inl:90
void SetDouble(const double *values3d)
Set vector from 3 doubles.
Definition 3DVector.h:349
C3DTVector NegateCheckZeroSign() const
/ operator - : return negate of each component (-x, -y, -z). If a component is 0, it return a +0,...
Definition 3DVector.inl:109
bool IsNormalized(double precision=FLOAT_EPSILON) const
Check if vector normalized. Return true if normalized, false otherwise.
Definition 3DVector.inl:447
bool IsAnormal() const
either infinite or nan. Zero and denormalized value are allowed.
Definition 3DVector.inl:329
C3DTVector & SelfMult(const C3DTVector &vector)
Self multiply each component (x, y, z) with vect(x, y, z). This is not the scalar product !...
Definition 3DVector.inl:284
bool IsUnit(double precision=PRECISION_LIMIT) const
Compare vector to (1.0, 1.0, 1.0). Return true if equal, false otherwise.
Definition 3DVector.inl:455
C3DTVector InvertCheckZeroSign() const
/ operator / : return invert each component (1/x, 1/y, 1/z). If a component is -0,...
Definition 3DVector.inl:123
void SubstractTo(const C3DTVector &vect)
return this = vect-this, instead this = this-vect. This can be used for fast computation (using the s...
Definition 3DVector.inl:179
void GetFloat(float *values3f) const
Get vector and fill 3 floats.
Definition 3DVector.h:335
CPt base only contains some flags that are used by the derived class.
Definition Point.h:60
The class defines a quaternion transformation.
Definition Quaternion.h:20