47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <J3ML/Geometry/AABB.h>
|
|
#include <J3ML/Geometry/LineSegment.h>
|
|
#include <J3ML/Geometry/Polyhedron.h>
|
|
|
|
namespace Geometry {
|
|
class OBB
|
|
{
|
|
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
|
|
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);
|
|
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;
|
|
|
|
Sphere MinimalEnclosingSphere() const;
|
|
Sphere MaximalContainedSphere() const;
|
|
Vector3 Size() const;
|
|
Vector3 HalfSize() const;
|
|
Vector3 Diagonal() const;
|
|
Vector3 HalfDiagonal() const;
|
|
bool IsFinite() const;
|
|
bool IsDegenerate() const;
|
|
Vector3 CenterPoint() const;
|
|
Vector3 Centroid() const;
|
|
|
|
Vector3 AnyPointFast() const;
|
|
|
|
float Volume();
|
|
float SurfaceArea();
|
|
Geometry::LineSegment Edge(int edgeIndex) const;
|
|
Vector3 CornerPoint(int cornerIndex) const;
|
|
};
|
|
} |