NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
eggVector.h
1#pragma once
2
3#include <lib/egg/math/eggMath.h>
4#include <lib/nw4r/math/vec.hpp>
5#include <types.h>
6
7namespace EGG {
8 /// @brief A two-dimensional floating point vector.
9 class Vector2f : public nw4r::math::VEC2 {
10 public:
11 /// @brief Constructs an empty vector.
13
14 ~Vector2f() {}
15
16 /// @brief Constructs a vector from two floating point values.
17 Vector2f(f32 fx, f32 fy) { set(fx, fy); }
18
19 void set(float x, float y) {
20 this->x = x;
21 this->y = y;
22 }
23
24 float normalise();
25
26 /// @brief Gets the squared length of the vector.
27 float squaredLength() const { return x * x + y * y; }
28
29 /// @brief Gets the length of the vector.
30 float length() const { return EGG::Mathf::sqrt(squaredLength()); }
31 };
32
33 /// @brief A three-dimensional floating point vector.
34 class Vector3f : public nw4r::math::VEC3 {
35 public:
36 /// @brief Constructs an empty vector.
38
39 ~Vector3f() {}
40
41 /// @brief Constructs a vector from two floating point values.
42 Vector3f(f32 fx, f32 fy, f32 fz) { set(fx, fy, fz); }
43
44 void set(float x, float y, float z) {
45 this->x = x;
46 this->y = y;
47 this->z = z;
48 }
49 };
50
51}
A two-dimensional floating point vector.
Definition eggVector.h:9
Vector2f()
Constructs an empty vector.
Definition eggVector.h:12
float length() const
Gets the length of the vector.
Definition eggVector.h:30
float squaredLength() const
Gets the squared length of the vector.
Definition eggVector.h:27
Vector2f(f32 fx, f32 fy)
Constructs a vector from two floating point values.
Definition eggVector.h:17
A three-dimensional floating point vector.
Definition eggVector.h:34
Vector3f()
Constructs an empty vector.
Definition eggVector.h:37
Vector3f(f32 fx, f32 fy, f32 fz)
Constructs a vector from two floating point values.
Definition eggVector.h:42
A three-dimensional floating point vector.
Definition vec.hpp:22