prime/include/Kyoto/Math/CVector2f.hpp
Luke Street 7ca3a1c0bb Replace int types in Retro code
Retro seemingly avoided using the Dolphin
typedefs in most places, opting to use int/uint
instead. This likely means they didn't use
u8/s8/u16/s16/etc either.


Former-commit-id: 133326ae406a0ebc76f56f8bcb489fda280be2be
2022-10-09 01:37:23 -04:00

41 lines
1.1 KiB
C++

#ifndef _CVECTOR2F
#define _CVECTOR2F
#include "types.h"
class CVector2f {
static const CVector2f skZeroVector;
public:
CVector2f(float x, float y);
float GetX() const { return mX; }
float GetY() const { return mY; }
CVector2f& operator+=(const CVector2f& rhs);
CVector2f& operator-=(const CVector2f& rhs);
CVector2f& operator*=(float rhs);
CVector2f& operator/=(float rhs);
CVector2f& Normalize();
float Magnitude() const;
float MagSquared() const;
CVector2f AsNormalized() const;
static float GetAngleDiff(const CVector2f& a, const CVector2f& b);
static float Dot(const CVector2f& a, const CVector2f& b);
private:
float mX;
float mY;
};
CVector2f operator+(const CVector2f& lhs, const CVector2f& rhs);
CVector2f operator-(const CVector2f& lhs, const CVector2f& rhs);
bool operator==(const CVector2f& lhs, const CVector2f& rhs);
CVector2f operator*(const CVector2f& lhs, const float& rhs);
CVector2f operator*(const float& lhs, const CVector2f& rhs);
CVector2f operator/(const CVector2f& lhs, const float& rhs);
#endif // _CVECTOR2F