18 #ifndef INCLUDED_FIXED_VECTOR2D
19 #define INCLUDED_FIXED_VECTOR2D
35 return (
X == v.
X &&
Y == v.
Y);
41 return (
X != v.
X ||
Y != v.
Y);
203 CheckCastOverflow(sum,
i32, L
"Overflow in CFixedVector2D::Dot() part 2", L
"Underflow in CFixedVector2D::Dot() part 2")
225 #endif // INCLUDED_FIXED_VECTOR2D
int CompareLength(fixed cmp) const
Returns -1, 0, +1 depending on whether length is less/equal/greater than the argument.
A simple fixed-point number class.
#define FIXED_MUL_I64_I32_I32(a, b)
CFixedVector2D operator*(int n) const
Scalar multiplication by an integer.
CFixedVector2D & operator+=(const CFixedVector2D &v)
Vector addition.
void Normalize()
Normalize the vector so that length is close to 1.
void Normalize(fixed n)
Normalize the vector so that length is close to n.
CFixedVector2D operator-() const
Negation.
T GetInternalValue() const
CFixedVector2D(fixed X, fixed Y)
fixed Dot(const CFixedVector2D &v)
Compute the dot product of this vector with another.
CFixedVector2D Rotate(fixed angle)
Rotate the vector by the given angle (anticlockwise).
CFixedVector2D operator-(const CFixedVector2D &v) const
Vector subtraction.
void SetInternalValue(T n)
bool operator!=(const CFixedVector2D &v) const
Vector inequality.
CFixedVector2D Perpendicular()
CFixedVector2D operator+(const CFixedVector2D &v) const
Vector addition.
CFixed Multiply(CFixed n) const
Multiply by a CFixed.
u32 isqrt64(u64 n)
64-bit integer square root.
#define CheckSignedAdditionOverflow(type, left, right, overflowWarning, underflowWarning)
CFixed MulDiv(CFixed m, CFixed d) const
Compute this*m/d.
#define CheckU32CastOverflow(var, targetType, overflowWarning)
CFixedVector2D Multiply(fixed n) const
Multiply by a CFixed.
fixed Length() const
Returns the length of the vector.
bool operator==(const CFixedVector2D &v) const
Vector equality.
bool IsZero() const
Returns true if the number is precisely 0.
CFixedVector2D & operator-=(const CFixedVector2D &v)
Vector subtraction.
#define CheckUnsignedAdditionOverflow(result, operand, overflowWarning)
void sincos_approx(CFixed_15_16 a, CFixed_15_16 &sin_out, CFixed_15_16 &cos_out)
Compute sin(a) and cos(a).
int CompareLength(const CFixedVector2D &other) const
Returns -1, 0, +1 depending on whether length is less/equal/greater than the argument's length...
#define CheckCastOverflow(var, targetType, overflowWarning, underflowWarning)