Massive Refactor

This commit is contained in:
2024-03-15 15:31:14 -04:00
parent e8ed68f3c7
commit 9f60f296c6
21 changed files with 379 additions and 127 deletions

View File

@@ -1,31 +1,36 @@
#pragma once
#include <J3ML/Geometry.h>
#include <J3ML/Geometry/Common.h>
#include <J3ML/Geometry/AABB.h>
#include <J3ML/Geometry/LineSegment.h>
#include <J3ML/Geometry/Polyhedron.h>
namespace J3ML::Geometry {
class OBB
class OBB : public Shape
{
public:
// The center position of this OBB
Vector3 pos;
// Stores half-sizes to x, y, and z directions in the local space of this OBB.
Vector3 r;
// Specifies normalized direc tion vectors for the local axes
// Specifies normalized direction vectors for the local axes
Vector3 axis[3];
OBB() {}
OBB(const Vector3& pos, const Vector3& radii, const Vector3& axis0, const Vector3& axis1, const Vector3& axis2);
OBB(const Geometry::AABB& aabb);
OBB(const AABB& aabb);
inline static int NumFaces() { return 6; }
inline static int NumEdges() { return 12; }
inline static int NumVertices() { return 8; }
Polyhedron ToPolyhedron() const;
Geometry::AABB MinimalEnclosingAABB() const;
AABB MinimalEnclosingAABB() const
{
AABB aabb;
aabb.SetFrom(*this);
return aabb;
}
Sphere MinimalEnclosingSphere() const;
Sphere MaximalContainedSphere() const;