3#include <game/mLib/m_angle.hpp>
4#include <lib/egg/math/eggVector.h>
10 void set(
float fx,
float fy) {
17 void setX(
float fx) { x = fx; }
18 void setY(
float fy) { y = fy; }
35 mVec2_c(
const f32 *p) { x = p[0]; y = p[1]; }
42 mVec2_c(
const nw4r::math::VEC2 &v) { set(v.x, v.y); }
44 void set(
float x,
float y) {
51 void incX(
float x) { this->x += x; }
55 void incY(
float y) { this->y += y; }
58 mVec2_c &operator=(
const mVec2_c &v) { x = v.x; y = v.y;
return *
this; }
61 operator f32*() {
return &x; }
64 operator const f32*()
const {
return &x; }
67 operator Vec2*() {
return (Vec2*)&x; }
70 operator const Vec2*()
const {
return (
const Vec2*)&x; }
73 operator nw4r::math::VEC2*() {
return (nw4r::math::VEC2*)&x; }
76 operator const nw4r::math::VEC2*()
const {
return (
const nw4r::math::VEC2*)&x; }
116 return mVec2_c(f * v.x, f * v.y);
131 mVec3_c(
const f32 *p) { x = p[0]; y = p[1]; z = p[2]; }
134 mVec3_c(f32 fx, f32 fy, f32 fz) { x = fx; y = fy; z = fz; }
137 mVec3_c(
const Vec &v) { x = v.x; y = v.y; z = v.z; }
143 mVec3_c(
const nw4r::math::VEC3 &v) { set(v.x, v.y, v.z); }
151 mVec3_c &
operator=(
const nw4r::math::VEC3 &v) { x = v.x; y = v.y; z = v.z;
return *
this; }
154 operator f32*() {
return &x; }
157 operator const f32*()
const {
return &x; }
160 operator Vec*() {
return (Vec*)&x; }
163 operator const Vec*()
const {
return (
const Vec*)&x; }
166 operator nw4r::math::VEC3*() {
return (nw4r::math::VEC3*)&x; }
169 operator const nw4r::math::VEC3*()
const {
return (
const nw4r::math::VEC3*)&x; }
207 float xzLen()
const {
208 return EGG::Mathf::sqrt(x * x + z * z);
211 short xzAng()
const {
215 float distTo(
const mVec3_c &other)
const {
216 return EGG::Mathf::sqrt(PSVECSquareDistance((
const Vec*)
this, (
const Vec*) &other));
220 return mVec3_c(v.x * f, v.y * f, v.z * f);
223 bool isSmallerThan1()
const {
224 return PSVECMag(*
this) <= 1.0f;
235 void rotX(mAng angle);
236 void rotY(mAng angle);
A two-dimensional floating point vector.
mVec2_c(const mVec2_c &v)
Copy constructor.
mVec2_c operator+() const
Positive operator.
bool operator!=(const mVec2_c &v) const
Inequality operator.
mVec2_c & operator+=(const mVec2_c &v)
Augmented addition operator.
mVec2_c operator+(const mVec2_c &v) const
Addition operator.
mVec2_c()
Constructs an empty vector.
mVec2_c & operator/=(f32 f)
Augmented scalar division operator.
mVec2_c operator/(f32 f) const
Scalar division operator.
bool operator==(const mVec2_c &v) const
Equality operator.
mVec2_c(const f32 *p)
Constructs a vector from a float array.
void incY(float y)
Increments the Y coordinate.
mVec2_c(f32 fx, f32 fy)
Constructs a vector from two floating point values.
mVec2_c & operator*=(f32 f)
Augmented scalar product operator.
mVec2_c operator*(f32 f) const
Scalar product operator.
mVec2_c & operator-=(const mVec2_c &v)
Augmented subtraction operator.
mVec2_c operator-(const mVec2_c &v) const
Subtraction operator.
mVec2_c operator-() const
Negative operator.
void incX(float x)
Increments the X coordinate.
A three-dimensional floating point vector.
mVec3_c operator/(f32 f) const
Scalar division operator.
static mVec3_c Ex
The unit vector for the X axis.
static mVec3_c Ey
The unit vector for the Y axis.
mVec3_c(const nw4r::math::VEC3 &v)
Constructs a new vector from an existing vector from the NW4R library.
mVec3_c & operator-=(const mVec3_c &v)
Augmented subtraction operator.
mVec3_c operator*(f32 f) const
Scalar product operator.
mVec3_c & operator+=(const mVec3_c &v)
Augmented addition operator.
bool normalizeRS()
Normalizes the vector.
mVec3_c operator-() const
Negative operator.
mVec3_c operator-(const mVec3_c &v) const
Subtraction operator.
mVec3_c(const mVec3_c &v, float fz)
Copy constructor with a different Z value.
mVec3_c(f32 fx, f32 fy, f32 fz)
Constructs a vector from three floating point values.
mVec3_c(const f32 *p)
Constructs a vector from a float array.
float normalize()
Normalizes the vector.
bool operator==(const mVec3_c &v) const
Equality operator.
mVec3_c & operator*=(f32 f)
Augmented scalar product operator.
mVec3_c operator+() const
Positive operator.
void rotX(mAng angle)
Rotates the vector on the X axis by the given angle.
void rotY(mAng angle)
Rotates the vector on the Y axis by the given angle.
static mVec3_c Zero
The null vector.
mVec3_c & operator/=(f32 f)
Augmented scalar division operator.
mVec3_c(const mVec3_c &v)
Copy constructor.
bool operator!=(const mVec3_c &v) const
Inequality operator.
mVec3_c & operator=(const mVec3_c &v)
Assignment operator.
mVec3_c(const Vec &v)
Constructs a new vector from an existing vector from the MTX library.
mVec3_c operator+(const mVec3_c &v) const
Addition operator.
mVec3_c()
Constructs an empty vector.
static mVec3_c Ez
The unit vector for the Z axis.
s16 atan2s(float sin, float cos)
Converts a sine and a cosine to an angle in units.