47 const void*
ptr(
void)
const
65 bool isEqual(
const DtVector3& rhs, T tolerance = std::numeric_limits<T>::min())
const;
160 , std::numeric_limits<T>::max()
161 , std::numeric_limits<T>::max());
169 T fInvLength = 1.0f / fLength;
185 return x * x + y * y + z * z;
192 return (*
this - rhs).length();
203 return DtVector3<T>(x - rhs.x, y - rhs.y, z - rhs.z);
209 return DtVector3<T>(x + fScalar, y + fScalar, z + fScalar);
214 return DtVector3<T>(x - fScalar, y - fScalar, z - fScalar);
226 T OneByfScalar = T(1.0) / fScalar;
227 return DtVector3<T>(x*OneByfScalar, y*OneByfScalar, z*OneByfScalar);
233 return x > rhs.x && y > rhs.y && z > rhs.z;
239 return x < rhs.x && y < rhs.y && z < rhs.z;
259 , z*rhs.x - x * rhs.z
260 , x*rhs.y - y * rhs.x
267 return x * rhs.x + y * rhs.y + z * rhs.z;
280 , (y + rhs.y)*static_cast<T>(0.5)
281 , (z + rhs.z)*static_cast<T>(0.5)
290 const T* ptrT =
static_cast<const T*
>(ptr());
305 if (rhs.x > x) x = rhs.x;
306 if (rhs.y > y) y = rhs.y;
307 if (rhs.z > z) z = rhs.z;
312 if (rhs.x < x) x = rhs.x;
313 if (rhs.y < y) y = rhs.y;
314 if (rhs.z < z) z = rhs.z;
365 return this->operator*=(T(1.0) / fScalar);
371 return x == rhs.x&&y == rhs.y&&z == rhs.z;
378 return !(lhs == rhs);
382 inline std::ostream& operator <<(std::ostream& o, const DtVector3<T>& v)
384 o <<
"Vector3(" << v.
x <<
", " << v.y <<
", " << v.z <<
")";
391 return 3 *
sizeof(T);
DtVector3 & operator-=(const DtVector3 &rhs)
component wise subtract rhs
bool operator<(const DtVector3 &rhs) const
Return true if each component lessser than the corresponding component of rhs.
Definition: DtVector3.h:237
void makeCeil(const DtVector3 &rhs)
Each component = max(component, rhs.component)
Definition: DtVector3.h:303
DtVector3(T _x, T _y, T _z)
CTOR.
Definition: DtVector3.h:32
DtVector3()
CTOR.
Definition: DtVector3.h:30
DtVector3 & operator+=(const DtVector3 &rhs)
component wise add rhs
DtVector3 & operator*=(T fScalar)
multiply a scalar to each component
Definition: DtVector3.h:354
DtVector3 crossProduct(const DtVector3 &rhs) const
get the cross product of this vector and rhs
Definition: DtVector3.h:252
bool operator!=(const DtVector3 &rhs) const
inequality
Definition: DtVector3.h:375
DtVector3< float64 > Vector3_64
Definition: DtVector3.h:401
static const DtVector3 theUnitScale
Definition: DtVector3.h:135
T dotProduct(const DtVector3 &rhs) const
get the dot product of this vector and rhs
Definition: DtVector3.h:265
static const DtVector3 Z_AXIS
Definition: DtVector3.h:138
static T Sqrt(T val)
Standard math routines.
Definition: DtMath.h:58
DtVector3 operator*(T fScalar) const
multiply a scalar to each component
Definition: DtVector3.h:218
DtVector3 operator/(T fScalar) const
divide each component by a scalar
Definition: DtVector3.h:224
std::list< Vector3_32 > Vector3_32_List
Definition: DtVector3.h:144
T z
Definition: DtVector3.h:132
const T * typePtr(void) const
access the pointer to the data, with the type of the data
Definition: DtVector3.h:53
DtVector3 midPoint(const DtVector3 &rhs) const
get the midpoint between this vector and rhs
Definition: DtVector3.h:277
static const DtVector3 X_AXIS
Definition: DtVector3.h:136
T x
Definition: DtVector3.h:132
DtVector3 operator+(const DtVector3 &rhs) const
component wise add two vectors together
std::list< Vector3_64 > Vector3_64_List
Definition: DtVector3.h:402
bool operator==(const DtVector3 &rhs) const
equality
Definition: DtVector3.h:369
DtVector3< float32 > Vector3_32
Definition: DtVector3.h:143
void makeFloor(const DtVector3 &rhs)
Each component = min(component, rhs.component)
Definition: DtVector3.h:310
T operator[](size_t index) const
access a component of this vector
Definition: DtVector3.h:287
static const DtVector3 Y_AXIS
Definition: DtVector3.h:137
DtVector3< int32 > Vector3_int
Definition: DtVector3.h:394
T y
Definition: DtVector3.h:132
static size_t sizeInBytes(void)
Definition: DtVector3.h:389
static bool isEqual(int32 lhs, int32 rhs, int32 tolerance=std::numeric_limits< int32 >::epsilon())
Test equality with tolerance.
~DtVector3()
DTOR.
Definition: DtVector3.h:40
void normalize(void)
normalize this vector in place
Definition: DtVector3.h:164
DtVector3< uint32 > Vector3_uint32
Definition: DtVector3.h:396
#define ASSERT_PREDICATE_RETURN_DEFAULT_CONSTRUCTOR(V, p)
Definition: DtAssert.h:45
DtVector3 & operator/=(T fScalar)
divide each component by a scalar
Definition: DtVector3.h:363
2 dimensional vector
Definition: DtMath.h:21
std::vector< Vector3_64 > Vector3_64_Vector
Definition: DtVector3.h:403
T squaredLength(void) const
get the length squared of this vector
Definition: DtVector3.h:183
static const DtVector3 theZeroVector
Definition: DtVector3.h:134
T absDotProduct(const DtVector3 &rhs) const
get the abs dot product of this vector and rhs
Definition: DtVector3.h:271
#define ASSERT_PREDICATE(p)
Definition: DtAssert.h:28
std::vector< Vector3_32 > Vector3_32_Vector
Definition: DtVector3.h:145
bool operator>(const DtVector3 &rhs) const
Return true if each component greater than the corresponding component of rhs.
Definition: DtVector3.h:231
T length(void) const
get the length of this vector
Definition: DtVector3.h:177
T getDistance(const DtVector3 &rhs) const
get the distance between this vector and rhs
Definition: DtVector3.h:190
DtVector3(const T1 &v)
CTOR construct from type with constructable components.
Definition: DtVector3.h:37
DtVector3 operator-(void) const
Negate the vector.
Definition: DtVector3.h:56
bool isEqual(const DtVector3 &rhs, T tolerance=std::numeric_limits< T >::min()) const
is rhs == to this vector within a specified tolerance/epsilon
Definition: DtVector3.h:243
static T Abs(T val)
Definition: DtMath.h:59
static DtVector3 POSITIVE_INFINITY
Definition: DtVector3.h:140
const void * ptr(void) const
Definition: DtVector3.h:47