22 template <
class T>
class DtVector3;
36 :
x(rhs.
x),
y(rhs.
y),
z(rhs.
z),
w(_w) {}
50 const void*
ptr(
void)
const{
return &
x;}
123 return DtVector4<T>(x+fScalar, y+fScalar, z+fScalar, w+fScalar);
128 return DtVector4<T>(x-fScalar, y-fScalar, z-fScalar, w-fScalar);
134 return DtVector4<T>(x*fScalar, y*fScalar, z*fScalar, w*fScalar);
140 T OneByfScalar = T(1.0)/fScalar;
141 return DtVector4<T>(x*OneByfScalar, y*OneByfScalar, z*OneByfScalar, w*OneByfScalar);
159 const T* ptrT =
static_cast<const T*
>(ptr());
204 return this->operator*=(T(1.0)/fScalar);
210 return x == rhs.x&&y == rhs.y && z == rhs.z && w==rhs.w;
217 return !(lhs == rhs);
221 inline std::ostream& operator <<( std::ostream& o, const DtVector4<T>& v )
223 o <<
"Vector4(" << v.
x <<
", " << v.y <<
", " << v.z <<
", " << v.w <<
")";
242 return x * x + y * y + z * z + w*w;
248 return DtVector4<T>(x + rhs.x,y + rhs.y,z + rhs.z,w + rhs.w);
254 return DtVector4<T>(x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w);
260 return DtVector4<T>(x * rhs.x, y * rhs.y, z * rhs.z, w * rhs.w);
266 return x * rhs.x + y * rhs.y + z * rhs.z + w * rhs.w;
T length(void) const
get the length of this vector
Definition: DtVector4.h:234
const void * ptr(void) const
access the pointer to the data
Definition: DtVector4.h:50
DtVector4< uint32 > Vector4_uint32
Definition: DtVector4.h:271
DtVector4 & operator-=(T fScalar)
subtract a scalar from this vector
Definition: DtVector4.h:182
~DtVector4()
DTOR.
Definition: DtVector4.h:44
T x
Definition: DtVector4.h:113
const T * typePtr(void) const
access the pointer to the data, with the type of the data
Definition: DtVector4.h:53
T dotProduct(const DtVector4 &rhs) const
get the dot product of this vector and rhs
Definition: DtVector4.h:264
bool operator==(const DtVector4 &rhs) const
equality
Definition: DtVector4.h:208
std::list< Vector4_32 > Vector4_32_List
Definition: DtVector4.h:117
DtVector4(const DtVector3< T > &rhs, T _w)
CTOR.
Definition: DtVector4.h:35
static T Sqrt(T val)
Standard math routines.
Definition: DtMath.h:58
bool operator!=(const DtVector4 &rhs) const
inequality
Definition: DtVector4.h:214
DtVector4 & operator*=(T fScalar)
multiply a scalar to this vector
Definition: DtVector4.h:192
DtVector4< int32 > Vector4_int
Definition: DtVector4.h:270
DtVector4 operator+(T fScalar) const
add a scalar to this vector
Definition: DtVector4.h:121
DtVector4 componentMultiply(const DtVector4 &rhs) const
Definition: DtVector4.h:258
DtVector4 operator/(T fScalar) const
divide this vector by a scalar
Definition: DtVector4.h:138
4 dimensional vector
Definition: DtMath.h:22
std::vector< Vector4_32 > Vector4_32_Vector
Definition: DtVector4.h:118
T operator[](size_t index) const
access a component of this vector
Definition: DtVector4.h:156
DtVector4(const T1 &v)
CTOR construct from type with constructable components.
Definition: DtVector4.h:41
T z
Definition: DtVector4.h:113
std::list< Vector4_64 > Vector4_64_List
Definition: DtVector4.h:276
DtVector4 & operator+=(T fScalar)
add a scalar to this vector
Definition: DtVector4.h:172
bool isEqual(const DtVector4 &rhs, T tolerance) const
is this vector == to rhs within the tolerance/epsilon
Definition: DtVector4.h:146
static size_t sizeInBytes(void)
Definition: DtVector4.h:228
T w
Definition: DtVector4.h:113
DtVector4 operator-(void) const
get the negated version of this vector
Definition: DtVector4.h:56
static bool isEqual(int32 lhs, int32 rhs, int32 tolerance=std::numeric_limits< int32 >::epsilon())
Test equality with tolerance.
std::vector< Vector4_64 > Vector4_64_Vector
Definition: DtVector4.h:277
DtVector4(T _x, T _y, T _z, T _w)
CTOR.
Definition: DtVector4.h:33
2 dimensional vector
Definition: DtMath.h:21
DtVector4< float32 > Vector4_32
Definition: DtVector4.h:116
DtVector4()
CTOR.
Definition: DtVector4.h:31
DtVector4 operator*(T fScalar) const
multiply a scalar to this vector
Definition: DtVector4.h:132
#define ASSERT_PREDICATE(p)
Definition: DtAssert.h:28
T squaredLength(void) const
get the length squared of this vector
Definition: DtVector4.h:240
DtVector4< float64 > Vector4_64
Definition: DtVector4.h:275
T y
Definition: DtVector4.h:113
DtVector4 & operator/=(T fScalar)
divide this vector by a scalar
Definition: DtVector4.h:202