18#ifndef INCLUDED_VECTOR2D
19#define INCLUDED_VECTOR2D
43 operator const float*()
const
100 float invf = 1.0f / f;
108 return X * a.
X +
Y * a.
Y;
139 float c = cosf(angle);
140 float s = sinf(angle);
152 float c = cosf(angle);
153 float s = sinf(angle);
154 float newX = c*
X - s*
Y;
155 float newY = s*
X + c*
Y;
172 sizeof(
CVector2D) ==
sizeof(
float) * 2u &&
175 "Vector2D should be properly layouted to use AsFloatArray");
Definition: Vector2D.h:32
CVector2D(float x, float y)
Definition: Vector2D.h:35
float Length() const
Definition: Vector2D.h:116
CVector2D()
Definition: Vector2D.h:34
CVector2D Normalized() const
Definition: Vector2D.h:128
void Normalize()
Definition: Vector2D.h:121
CVector2D & operator/=(float f)
Definition: Vector2D.h:98
CVector2D operator+(const CVector2D &t) const
Definition: Vector2D.h:56
float Y
Definition: Vector2D.h:180
PS::span< const float > AsFloatArray() const
Definition: Vector2D.h:167
CVector2D operator-() const
Definition: Vector2D.h:51
float X
Definition: Vector2D.h:180
CVector2D Rotated(float angle) const
Returns a version of this vector rotated counterclockwise by angle radians.
Definition: Vector2D.h:137
CVector2D operator/(float f) const
Definition: Vector2D.h:71
bool operator==(const CVector2D &v) const
Definition: Vector2D.cpp:28
void Rotate(float angle)
Rotates this vector counterclockwise by angle radians.
Definition: Vector2D.h:150
float LengthSquared() const
Definition: Vector2D.h:111
CVector2D & operator*=(float f)
Definition: Vector2D.h:91
bool operator!=(const CVector2D &v) const
Definition: Vector2D.cpp:33
CVector2D & operator+=(const CVector2D &t)
Definition: Vector2D.h:77
CVector2D operator-(const CVector2D &t) const
Definition: Vector2D.h:61
CVector2D & operator-=(const CVector2D &t)
Definition: Vector2D.h:84
float Dot(const CVector2D &a) const
Definition: Vector2D.h:106
CVector2D operator*(float f) const
Definition: Vector2D.h:66
Simplifed version of std::span (C++20) as we don't support the original one yet.
Definition: Span.h:37