3#include <game/mLib/m_angle.hpp>
4#include <lib/egg/math/eggVector.h>
25 mVec2_c(
const f32 *p) { x = p[0]; y = p[1]; }
33 void set(
float x,
float y) {
40 void incX(
float x) { this->x += x; }
44 void incY(
float y) { this->y += y; }
47 mVec2_c &operator=(
const mVec2_c &v) { x = v.x; y = v.y;
return *
this; }
50 operator f32*() {
return &x; }
53 operator const f32*()
const {
return &x; }
56 operator Vec2*() {
return (Vec2*)&x; }
59 operator const Vec2*()
const {
return (
const Vec2*)&x; }
62 operator nw4r::math::VEC2*() {
return (nw4r::math::VEC2*)&x; }
65 operator const nw4r::math::VEC2*()
const {
return (
const nw4r::math::VEC2*)&x; }
116 mVec3_c(
const f32 *p) { x = p[0]; y = p[1]; z = p[2]; }
119 mVec3_c(f32 fx, f32 fy, f32 fz) { x = fx; y = fy; z = fz; }
122 mVec3_c(
const Vec &v) { x = v.x; y = v.y; z = v.z; }
128 mVec3_c(
const nw4r::math::VEC3 &v) { set(v.x, v.y, v.z); }
136 mVec3_c &
operator=(
const nw4r::math::VEC3 &v) { x = v.x; y = v.y; z = v.z;
return *
this; }
139 operator f32*() {
return &x; }
142 operator const f32*()
const {
return &x; }
145 operator Vec*() {
return (Vec*)&x; }
148 operator const Vec*()
const {
return (
const Vec*)&x; }
151 operator nw4r::math::VEC3*() {
return (nw4r::math::VEC3*)&x; }
154 operator const nw4r::math::VEC3*()
const {
return (
const nw4r::math::VEC3*)&x; }
192 float xzLen()
const {
193 return EGG::Mathf::sqrt(x * x + z * z);
196 short xzAng()
const {
200 float distTo(
const mVec3_c &other)
const {
201 return EGG::Mathf::sqrt(PSVECSquareDistance((
const Vec*)
this, (
const Vec*) &other));
212 void rotX(mAng angle);
213 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.