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);
217 CheckCastOverflow(sum,
i32, L
"Overflow in CFixedVector2D::Dot() part 2", L
"Underflow in CFixedVector2D::Dot() part 2")
230 return x > -y ? 1 : x < -y ? -1 : 0;
249 #endif // INCLUDED_FIXED_VECTOR2D A simple fixed-point number class.
Definition: Fixed.h:119
int64_t i64
Definition: types.h:35
Definition: FixedVector2D.h:24
CFixedVector2D & operator+=(const CFixedVector2D &v)
Vector addition.
Definition: FixedVector2D.h:63
void Normalize()
Normalize the vector so that length is close to 1.
Definition: FixedVector2D.h:181
CFixedVector2D Rotate(fixed angle) const
Rotate the vector by the given angle (anticlockwise).
Definition: FixedVector2D.h:241
void Normalize(fixed n)
Normalize the vector so that length is close to n.
Definition: FixedVector2D.h:195
bool operator!=(const CFixedVector2D &v) const
Vector inequality.
Definition: FixedVector2D.h:39
T GetInternalValue() const
Definition: Fixed.h:135
CFixedVector2D operator-(const CFixedVector2D &v) const
Vector subtraction.
Definition: FixedVector2D.h:51
CFixedVector2D(fixed X, fixed Y)
Definition: FixedVector2D.h:30
int CompareLength(fixed cmp) const
Returns -1, 0, +1 depending on whether length is less/equal/greater than the argument.
Definition: FixedVector2D.h:122
CFixedVector2D Multiply(fixed n) const
Multiply by a CFixed.
Definition: FixedVector2D.h:92
CFixedVector2D operator-() const
Negation.
Definition: FixedVector2D.h:57
uint64_t u64
Definition: types.h:40
int CompareLengthSquared(u64 cmpSquared) const
Same as above, but avoids squaring the compared value.
Definition: FixedVector2D.h:140
void SetInternalValue(T n)
Definition: Fixed.h:136
fixed Y
Definition: FixedVector2D.h:27
uint32_t u32
Definition: types.h:39
u32 isqrt64(u64 n)
64-bit integer square root.
Definition: Sqrt.cpp:23
fixed Length() const
Returns the length of the vector.
Definition: FixedVector2D.h:101
bool operator==(const CFixedVector2D &v) const
Vector equality.
Definition: FixedVector2D.h:33
constexpr bool IsZero() const
Returns true if the number is precisely 0.
Definition: Fixed.h:209
#define CheckSignedAdditionOverflow(type, left, right, overflowWarning, underflowWarning)
Definition: Fixed.h:64
#define CheckU32CastOverflow(var, targetType, overflowWarning)
Definition: Fixed.h:76
int32_t i32
Definition: types.h:34
CFixedVector2D()
Definition: FixedVector2D.h:29
int CompareLength(const CFixedVector2D &other) const
Returns -1, 0, +1 depending on whether length is less/equal/greater than the argument's length...
Definition: FixedVector2D.h:158
int RelativeOrientation(const CFixedVector2D &v) const
Definition: FixedVector2D.h:226
CFixed Multiply(CFixed n) const
Multiply by a CFixed.
Definition: Fixed.h:321
CFixedVector2D Perpendicular() const
Definition: FixedVector2D.h:233
fixed Dot(const CFixedVector2D &v) const
Compute the dot product of this vector with another.
Definition: FixedVector2D.h:209
CFixedVector2D & operator-=(const CFixedVector2D &v)
Vector subtraction.
Definition: FixedVector2D.h:70
CFixedVector2D operator*(int n) const
Scalar multiplication by an integer.
Definition: FixedVector2D.h:77
#define CheckUnsignedAdditionOverflow(result, operand, overflowWarning)
Definition: Fixed.h:80
fixed X
Definition: FixedVector2D.h:27
void sincos_approx(CFixed_15_16 a, CFixed_15_16 &sin_out, CFixed_15_16 &cos_out)
Compute sin(a) and cos(a).
Definition: Fixed.cpp:187
bool IsZero() const
Definition: FixedVector2D.h:172
CFixedVector2D operator+(const CFixedVector2D &v) const
Vector addition.
Definition: FixedVector2D.h:45
#define SQUARE_U64_FIXED(a)
Definition: Fixed.h:39
#define MUL_I64_I32_I32(a, b)
Definition: Fixed.h:37
CFixed MulDiv(CFixed m, CFixed d) const
Compute this*m/d.
Definition: Fixed.h:341
#define CheckCastOverflow(var, targetType, overflowWarning, underflowWarning)
Definition: Fixed.h:70
CFixedVector2D operator/(int n) const
Scalar division by an integer. Must not have n == 0.
Definition: FixedVector2D.h:83