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;}
137 return DtVector4<T>(x+fScalar, y+fScalar, z+fScalar, w+fScalar);
142 return DtVector4<T>(x-fScalar, y-fScalar, z-fScalar, w-fScalar);
148 return DtVector4<T>(x*fScalar, y*fScalar, z*fScalar, w*fScalar);
154 T OneByfScalar = T(1.0)/fScalar;
155 return DtVector4<T>(x*OneByfScalar, y*OneByfScalar, z*OneByfScalar, w*OneByfScalar);
173 const T* ptrT =
static_cast<const T*
>(ptr());
218 return this->operator*=(T(1.0)/fScalar);
224 return x == rhs.x&&y == rhs.y && z == rhs.z && w==rhs.w;
231 return !(lhs == rhs);
235 inline std::ostream& operator <<( std::ostream& o, const DtVector4<T>& v )
237 o <<
"Vector4(" << v.
x <<
", " << v.y <<
", " << v.z <<
", " << v.w <<
")";
256 return x * x + y * y + z * z + w*w;
262 return DtVector4<T>(x + rhs.x,y + rhs.y,z + rhs.z,w + rhs.w);
268 return DtVector4<T>(x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w);
274 return DtVector4<T>(x * rhs.x, y * rhs.y, z * rhs.z, w * rhs.w);
280 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:248
const void * ptr(void) const
access the pointer to the data
Definition: DtVector4.h:50
DtVector4< uint32 > Vector4_uint32
Definition: DtVector4.h:304
DtVector4 & operator-=(T fScalar)
subtract a scalar from this vector
Definition: DtVector4.h:196
~DtVector4()
DTOR.
Definition: DtVector4.h:44
T x
Definition: DtVector4.h:118
static const DtVector4 theUnitScale
Definition: DtVector4.h:121
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:278
bool operator==(const DtVector4 &rhs) const
equality
Definition: DtVector4.h:222
std::list< Vector4_32 > Vector4_32_List
Definition: DtVector4.h:125
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:228
DtVector4 & operator*=(T fScalar)
multiply a scalar to this vector
Definition: DtVector4.h:206
DtVector4< int32 > Vector4_int
Definition: DtVector4.h:303
DtVector4 operator+(T fScalar) const
add a scalar to this vector
Definition: DtVector4.h:135
DtVector4 componentMultiply(const DtVector4 &rhs) const
Definition: DtVector4.h:272
DtVector4 operator/(T fScalar) const
divide this vector by a scalar
Definition: DtVector4.h:152
4 dimensional vector
Definition: DtMath.h:22
std::vector< Vector4_32 > Vector4_32_Vector
Definition: DtVector4.h:126
T operator[](size_t index) const
access a component of this vector
Definition: DtVector4.h:170
static const DtVector4 theZeroVector
Definition: DtVector4.h:120
DtVector4(const T1 &v)
CTOR construct from type with constructable components.
Definition: DtVector4.h:41
T z
Definition: DtVector4.h:118
std::list< Vector4_64 > Vector4_64_List
Definition: DtVector4.h:309
DtVector4 & operator+=(T fScalar)
add a scalar to this vector
Definition: DtVector4.h:186
bool isEqual(const DtVector4 &rhs, T tolerance) const
is this vector == to rhs within the tolerance/epsilon
Definition: DtVector4.h:160
static size_t sizeInBytes(void)
Definition: DtVector4.h:242
T w
Definition: DtVector4.h:118
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:310
void set(T x, T y, T z, T w)
set values
Definition: DtVector4.h:294
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:124
DtVector4()
CTOR.
Definition: DtVector4.h:31
DtVector4 operator*(T fScalar) const
multiply a scalar to this vector
Definition: DtVector4.h:146
#define ASSERT_PREDICATE(p)
Definition: DtAssert.h:28
T squaredLength(void) const
get the length squared of this vector
Definition: DtVector4.h:254
DtVector4< float64 > Vector4_64
Definition: DtVector4.h:308
T y
Definition: DtVector4.h:118
DtVector4 & operator/=(T fScalar)
divide this vector by a scalar
Definition: DtVector4.h:216