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