45 const void*
ptr(
void)
const
126 return DtVector2<T>(x-rhs.x, y-rhs.y);
166 T OneByfScalar = T(1.0)/fScalar;
188 return x*rhs.x + y*rhs.y;
197 T fInvLength = 1.0f / fLength;
206 T vecLength = length();
207 if (vecLength<std::numeric_limits<T>::epsilon())
210 T one_by_length = T(1.0)/vecLength;
218 const T* ptrT =
static_cast<const T*
>(ptr());
251 return x == rhs.x&&y == rhs.y;
258 return !(lhs == rhs);
262 inline std::ostream& operator <<(std::ostream& o, const DtVector2<T>& v)
264 o <<
"Vector2(" << v.
x <<
", " << v.y <<
")";
std::list< Vector2_32 > Vector2_32_List
Definition: DtVector2.h:270
bool isEqual(const DtVector2 &rhs, T tolerance) const
is rhs == to this vector within a specified tolerance/epsilon
Definition: DtVector2.h:177
DtVector2(T _x, T _y)
CTOR.
Definition: DtVector2.h:31
DtVector2 operator*(T fScalar) const
multiply a scalar to each component
Definition: DtVector2.h:158
static size_t sizeInBytes(void)
Definition: DtVector2.h:243
T squaredLength(void) const
get the length of the vector squared
Definition: DtVector2.h:237
DtVector2 operator+(const DtVector2 &rhs) const
component wise add two vectors together
T getDotProduct(const DtVector2 &rhs) const
get the dot product of this vector with rhs
Definition: DtVector2.h:186
std::list< Vector2_64 > Vector2_64_List
Definition: DtVector2.h:278
DtVector2 getNormalizedCopy(void) const
get a normalized copy of this vector
Definition: DtVector2.h:204
DtVector2 operator-(const DtVector2 &rhs) const
component wise subtract two vectors
static const DtVector2 theZeroVector
Definition: DtVector2.h:108
static const DtVector2 theUnitScale
Definition: DtVector2.h:109
DtVector2< int32 > Vector2_int
Definition: DtVector2.h:273
static T Sqrt(T val)
Standard math routines.
Definition: DtMath.h:58
T y
Definition: DtVector2.h:105
T length(void) const
get the length of the vector
Definition: DtVector2.h:231
DtVector2(const T1 &v)
CTOR construct from type with constructable components.
Definition: DtVector2.h:36
DtVector2 & operator+=(const DtVector2 &rhs)
component wise add rhs
Definition: DtVector2.h:130
DtVector2 operator/(T fScalar) const
divide each component by a scalar
Definition: DtVector2.h:164
~DtVector2()
DTOR.
Definition: DtVector2.h:39
std::vector< Vector2_64 > Vector2_64_Vector
Definition: DtVector2.h:279
static bool isEqual(int32 lhs, int32 rhs, int32 tolerance=std::numeric_limits< int32 >::epsilon())
Test equality with tolerance.
DtVector2< uint32 > Vector2_uint32
Definition: DtVector2.h:274
bool operator==(const DtVector2 &rhs) const
equality
Definition: DtVector2.h:249
void normalize(void)
normalize this vector in place
Definition: DtVector2.h:192
DtVector2()
CTOR.
Definition: DtVector2.h:29
bool operator!=(const DtVector2 &rhs) const
inequality
Definition: DtVector2.h:255
T x
Definition: DtVector2.h:105
T operator[](size_t index) const
access a component of the vector
Definition: DtVector2.h:215
DtVector2< float32 > Vector2_32
Definition: DtVector2.h:269
#define ASSERT_PREDICATE(p)
Definition: DtAssert.h:28
DtVector2 & operator-=(const DtVector2 &rhs)
component wise subtract rhs
Definition: DtVector2.h:138
DtVector2< float64 > Vector2_64
Definition: DtVector2.h:277
std::vector< Vector2_32 > Vector2_32_Vector
Definition: DtVector2.h:271
const void * ptr(void) const
get a pointer to the data
Definition: DtVector2.h:45
2 dimensional vector
Definition: DtMath.h:20