Implement Missing things (More To Come) (Broken build)

This commit is contained in:
2024-03-21 15:24:50 -04:00
parent d1529f05b0
commit 802c321115
9 changed files with 150 additions and 2 deletions

View File

@@ -5,6 +5,7 @@
#include <J3ML/Geometry/Shape.h>
#include "J3ML/Algorithm/RNG.h"
namespace J3ML::Geometry
{
using namespace J3ML::LinearAlgebra;
@@ -92,11 +93,12 @@ namespace J3ML::Geometry
float GetSurfaceArea() const;
Vector3 GetClosestPoint(const Vector3& point) const;
void Translate(const Vector3& offset);
AABB Translated(const Vector3& offset) const;
AABB TransformAABB(const Matrix3x3& transform);
AABB TransformAABB(const Matrix4x4& transform);
AABB TransformAABB(const Quaternion& transform);
OBB Transform(const Matrix3x3& transform);
OBB Transform(const Matrix3x3& transform) const;
OBB Transform(const Matrix4x4& transform);
OBB Transform(const Quaternion& transform);
bool Contains(const Vector3& point) const;
@@ -146,4 +148,6 @@ namespace J3ML::Geometry
bool TestAxis(const Vector3& axis, const Vector3& v0, const Vector3& v1, const Vector3& v2) const;
};
}

View File

@@ -86,5 +86,12 @@ namespace J3ML::Geometry {
Vector3 ExtremePoint(const Vector3 &direction, float &projectionDistance) const;
Vector3 ExtremePoint(const Vector3 &direction) const;
void SetFrom(const AABB &aabb, const Matrix3x3 &transform);
void SetFrom(const AABB &aabb, const Matrix4x4 &transform);
void SetFrom(const AABB &aabb, const Quaternion &transform);
};
}

View File

@@ -1,6 +1,6 @@
#pragma once
#include <J3ML/LinearAlgebra/Common.h>
#include <J3ML/LinearAlgebra/Vector2.h>
#include <J3ML/LinearAlgebra/Vector3.h>
#include <J3ML/LinearAlgebra/Quaternion.h>
@@ -125,8 +125,19 @@ namespace J3ML::LinearAlgebra {
Vector3 operator[](int row) const;
Vector2 operator * (const Vector2& rhs) const;
Vector3 operator * (const Vector3& rhs) const;
Vector4 operator * (const Vector4& rhs) const;
Matrix3x3 operator * (const Matrix3x3& rhs) const;
Matrix4x4 operator * (const Matrix4x4& rhs) const;
Matrix3x3 Mul(const Matrix3x3& rhs) const;
Matrix4x4 Mul(const Matrix4x4& rhs) const;
Vector2 Mul(const Vector2& rhs) const;
Vector3 Mul(const Vector3& rhs) const;
Vector4 Mul(const Vector4& rhs) const;
Quaternion Mul(const Quaternion& rhs) const;
void IsColOrthogonal();
protected:
float elems[3][3];

View File

@@ -248,6 +248,8 @@ namespace J3ML::LinearAlgebra {
Matrix4x4 &operator = (const Quaternion& rhs);
Matrix4x4 &operator = (const Matrix4x4& rhs) = default;
void IsColOrthogonal();
protected:
float elems[4][4];

View File

@@ -20,6 +20,10 @@ namespace J3ML::LinearAlgebra {
{
return &x;
}
Vector3 XYZ() const
{
return {x, y, z};
}
float GetX() const;
float GetY() const;