A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
BoundBox.hh
1#pragma once
2
3#include "egg/math/Vector.hh"
4
5namespace Kinoko::EGG {
6
8struct BoundBox2f {
10 constexpr BoundBox2f() = default;
11 constexpr ~BoundBox2f() = default;
12
14 constexpr void resetBound() {
15 min.set(std::numeric_limits<f32>::max());
16 max.set(-std::numeric_limits<f32>::max());
17 }
18
19 constexpr void setDirect(const Vector2f &vMin, const Vector2f &vMax) {
20 max = vMax;
21 min = vMin;
22 }
23
24 constexpr void setMin(const Vector2f &v) {
25 min = v;
26 }
27
28 constexpr void setMax(const Vector2f &v) {
29 max = v;
30 }
31
32 Vector2f min;
33 Vector2f max;
34};
35
37struct BoundBox3f {
38 constexpr BoundBox3f() = default;
39 constexpr ~BoundBox3f() = default;
40
41 constexpr void resetBound() {
42 min.set(std::numeric_limits<f32>::max());
43 max.set(-std::numeric_limits<f32>::max());
44 }
45
46 constexpr void setZero() {
47 min.setZero();
48 max.setZero();
49 }
50
51 constexpr void setDirect(const Vector3f &vMin, const Vector3f &vMax) {
52 max = vMax;
53 min = vMin;
54 }
55
56 constexpr void setMin(const Vector3f &v) {
57 min = v;
58 }
59
60 constexpr void setMax(const Vector3f &v) {
61 max = v;
62 }
63
64 Vector3f min;
65 Vector3f max;
66};
67
68} // namespace Kinoko::EGG
EGG core library.
Definition Archive.cc:6
A representation of a bounding rectangle.
Definition BoundBox.hh:8
A representation of a bounding cuboid.
Definition BoundBox.hh:37
A 2D float vector.
Definition Vector.hh:12
A 3D float vector.
Definition Vector.hh:107