Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Toggle main menu visibility
Loading...
Searching...
No Matches
Sphere.hh
1
#pragma once
2
3
#include "egg/math/Vector.hh"
4
5
namespace
Kinoko::EGG
{
6
8
struct
Sphere3f {
9
constexpr
Sphere3f(
const
Vector3f
&v, f32 r) : pos(v), radius(r) {}
10
14
[[nodiscard]]
constexpr
bool
isInsideOtherSphere
(
const
Sphere3f &rhs)
const
{
15
f32 radiusDiff = rhs.radius - radius;
16
if
(radiusDiff < 0.0f) {
17
return
false
;
18
}
19
20
return
rhs.pos.
ps_sqDistance
(this->pos) < radiusDiff * radiusDiff;
21
}
22
23
Vector3f
pos;
24
f32 radius;
25
};
26
27
}
// namespace Kinoko::EGG
Kinoko::EGG
EGG core library.
Definition
Allocator.hh:5
Kinoko::EGG::Sphere3f::isInsideOtherSphere
constexpr bool isInsideOtherSphere(const Sphere3f &rhs) const
Not actually part of EGG. Included here for compartmentalization.
Definition
Sphere.hh:14
Kinoko::EGG::Vector3f
A 3D float vector.
Definition
Vector.hh:107
Kinoko::EGG::Vector3f::ps_sqDistance
constexpr f32 ps_sqDistance(const Vector3f &rhs) const
Paired-singles impl. of sqDistance.
Definition
Vector.hh:339
egg
geom
Sphere.hh
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.17.0