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,30 +1,14 @@
#pragma once
#include <J3ML/LinearAlgebra/Vector3.h>
#include "J3ML/LinearAlgebra.h"
#include <J3ML/Geometry.h>
#include <J3ML/Geometry/Plane.h>
#include <J3ML/Geometry/Sphere.h>
#include <J3ML/Geometry/OBB.h>
#include <J3ML/Geometry/LineSegment.h>
#include <J3ML/Geometry/Triangle.h>
#include <J3ML/Geometry/Polygon.h>
#include <J3ML/Geometry/Frustum.h>
#include <J3ML/Geometry/Capsule.h>
#include <J3ML/Geometry/Ray.h>
#include <J3ML/Geometry/TriangleMesh.h>
#include <J3ML/Geometry/Polyhedron.h>
#include <J3ML/LinearAlgebra.h>
#include <J3ML/Geometry/Common.h>
#include <J3ML/Geometry/Shape.h>
// TODO: Fix circular include between AABB and OBB
namespace J3ML::Geometry
{
using namespace LinearAlgebra;
using namespace J3ML::LinearAlgebra;
// A 3D axis-aligned bounding box
// This data structure can be used to represent coarse bounds of objects, in situations where detailed triangle-level
// computations can be avoided. In physics systems, bounding boxes are used as an efficient early-out test for geometry
@@ -34,11 +18,15 @@ namespace J3ML::Geometry
// be arbitrarily oriented in the space with respect to each other.
// If you need to represent a box in 3D space with arbitrary orientation, see the class OBB. */
class AABB {
class AABB : public Shape {
public:
Vector3 minPoint;
Vector3 maxPoint;
AABB();
AABB(const Vector3& min, const Vector3& max);
static int NumFaces() { return 6; }
static int NumEdges() { return 12; }
@@ -102,6 +90,7 @@ namespace J3ML::Geometry
static AABB MinimalEnclosingAABB(const Vector3 *pointArray, int numPoints);
float GetVolume() const;
float GetSurfaceArea() const;
Vector3 GetClosestPoint(const Vector3& point) const;
Vector3 GetRandomPointInside();
Vector3 GetRandomPointOnSurface();
Vector3 GetRandomPointOnEdge();