Fixed several recursive header issues, refactored Math lib, began implementing core mathematical functions as wrappers around stdmath, will implement SSE and lookup tables later.
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 1m13s
Build Docs With Doxygen / Explore-Gitea-Actions (push) Successful in 19s

This commit is contained in:
2024-07-05 16:13:13 -04:00
parent bc7adae8af
commit 9253cfc8c7
27 changed files with 1217 additions and 335 deletions

View File

@@ -1,9 +1,9 @@
#pragma once
#include "LineSegment.h"
#include "Shape.h"
#include <J3ML/LinearAlgebra.h>
#include <J3ML/LinearAlgebra/Common.h>
#include <J3ML/Geometry/Common.h>
#include <J3ML/Geometry/Shape.h>
namespace J3ML::Geometry
{
@@ -63,12 +63,16 @@ namespace J3ML::Geometry
/// Tests if this Capsule is degenerate.
/** @return True if this Capsule does not span a strictly positive volume. */
bool IsDegenerate() const;
/// Computes the total height of this capsule, i.e. LineLength() + Diameter().
/** <img src="CapsuleFunctions.png" />
@see LineLength(). */
float Height() const;
/// Computes the distance of the two inner points of this capsule. @see Height.
float LineLength() const { return l.Length(); }
/// Computes the diameter of this capsule.
float Diameter() const;
float Diameter() const { return 2.f * r;}
/// Returns the bottom-most point of this Capsule.
/** <img src="CapsuleFunctions.png" />
@note The bottom-most point is only a naming convention, and does not correspond to the bottom-most point along any world axis. The returned
@@ -76,12 +80,13 @@ namespace J3ML::Geometry
@note The bottom-most point of the capsule is different than the point l.a. The returned point is the point at the very far
edge of this capsule, and does not lie on the internal line. See the attached diagram.
@see Top(), l. */
Vector3 Bottom() const;
Vector3 Bottom() const { return l.A - UpDirection() * r;}
/// Returns the center point of this Capsule.
/** <img src="doc/static/docs/CapsuleFunctions.png" />
@return The point (l.a + l.b) / 2. This point is the center of mass for this capsule.
@see l, Bottom(), Top(). */
Vector3 Center() const;
Vector3 Center() const { return l.CenterPoint();}
Vector3 Centroid() const; ///< [similarOverload: Center]
/// Returns the direction from the bottommost point towards the topmost point of this Capsule.