diff --git a/include/J3ML/Algorithm/Bezier.hpp b/include/J3ML/Algorithm/Bezier.hpp index d4a0708..2666137 100644 --- a/include/J3ML/Algorithm/Bezier.hpp +++ b/include/J3ML/Algorithm/Bezier.hpp @@ -17,7 +17,7 @@ // Transcribed from here: explicit form and derivative // https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B%C3%A9zier_curves -#include "J3ML/LinearAlgebra/Vector2.h" +#include "J3ML/LinearAlgebra/Vector2.hpp" namespace J3ML::Algorithm { diff --git a/include/J3ML/Algorithm/GJK.hpp b/include/J3ML/Algorithm/GJK.hpp index 597d5c3..df3c2a8 100644 --- a/include/J3ML/Algorithm/GJK.hpp +++ b/include/J3ML/Algorithm/GJK.hpp @@ -3,8 +3,8 @@ #pragma once -#include -#include +#include +#include namespace J3ML::Algorithms { diff --git a/include/J3ML/Algorithm/RNG.hpp b/include/J3ML/Algorithm/RNG.hpp index b84b398..f72c95b 100644 --- a/include/J3ML/Algorithm/RNG.hpp +++ b/include/J3ML/Algorithm/RNG.hpp @@ -1,6 +1,6 @@ #pragma once -#include "J3ML/J3ML.h" +#include "J3ML/J3ML.hpp" namespace J3ML::Algorithm { diff --git a/include/J3ML/Geometry.h b/include/J3ML/Geometry.h deleted file mode 100644 index 94fc5fa..0000000 --- a/include/J3ML/Geometry.h +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace J3ML::Geometry; \ No newline at end of file diff --git a/include/J3ML/Geometry.hpp b/include/J3ML/Geometry.hpp new file mode 100644 index 0000000..13ce4e7 --- /dev/null +++ b/include/J3ML/Geometry.hpp @@ -0,0 +1,26 @@ +#include + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace J3ML::Geometry; \ No newline at end of file diff --git a/include/J3ML/Geometry/AABB.hpp b/include/J3ML/Geometry/AABB.hpp index 95dfcfc..9862ea6 100644 --- a/include/J3ML/Geometry/AABB.hpp +++ b/include/J3ML/Geometry/AABB.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include +#include +#include +#include -#include "Polygon.h" -#include "Sphere.h" +#include "Polygon.hpp" +#include "Sphere.hpp" #include diff --git a/include/J3ML/Geometry/AABB2D.hpp b/include/J3ML/Geometry/AABB2D.hpp index 8026534..6bb01db 100644 --- a/include/J3ML/Geometry/AABB2D.hpp +++ b/include/J3ML/Geometry/AABB2D.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include "Shape.h" +#include +#include "Shape.hpp" namespace J3ML::Geometry { @@ -45,7 +45,6 @@ namespace J3ML::Geometry Vector2 ToNormalizedLocalSpace(const Vector2 &pt) const; - AABB2D operator+(const Vector2& pt) const; AABB2D operator-(const Vector2& pt) const; diff --git a/include/J3ML/Geometry/Capsule.h b/include/J3ML/Geometry/Capsule.hpp similarity index 87% rename from include/J3ML/Geometry/Capsule.h rename to include/J3ML/Geometry/Capsule.hpp index 1f7e286..b1b6f9e 100644 --- a/include/J3ML/Geometry/Capsule.h +++ b/include/J3ML/Geometry/Capsule.hpp @@ -1,21 +1,21 @@ #pragma once -#include -#include -#include +#include +#include +#include +#include "Circle.hpp" namespace J3ML::Geometry { - /// A 3D cylinder with spherical ends. class Capsule : public Shape { public: - // Specifies the two inner points of this capsule + /// Specifies the two inner points of this capsule LineSegment l; - // Specifies the radius of this capsule + /// Specifies the radius of this capsule float r; public: /// The default constructor does not initialize any members of this class. @@ -34,8 +34,17 @@ namespace J3ML::Geometry @see l, r. */ Capsule(const Vector3& bottomPt, const Vector3& topPt, float radius); + /// Constructs a new capsule from a sphere. + /** This conversion results in a capsule which has its both endpoints at the exact same coordinates, and hence the + length of the inner line segment is set to 0. */ + void SetFrom(const Sphere& s); + + /// Sets this Capsule to a degenerate negative-volume state. + void SetDegenerate(); + + /// Quickly returns an arbitrary point inside this Capsule. Used in GJK intersection test. - inline Vector3 AnyPointFast() const { return l.A; } + [[nodiscard]] inline Vector3 AnyPointFast() const; /// Generates a point that perhaps lies inside this capsule. /** @param height A normalized value between [0,1]. This specifies the point position along the height line of this capsule. @@ -46,10 +55,10 @@ namespace J3ML::Geometry Vector3 UniformPointPerhapsInside(float height, float x, float y) const; /// Returns the Sphere defining the 'bottom' section of this Capsule (corresponding to the endpoint l.a) - Sphere SphereA() const; + [[nodiscard]] Sphere SphereA() const; /// Returns the Sphere defining the 'top' section of this Capsule (corresponding to the endpoint l.b) - Sphere SphereB() const; + [[nodiscard]] Sphere SphereB() const; /// Computes the extreme point of this Capsule in the given direction. /** An extreme point is a farthest point of this Capsule in the given direction. Given a direction, @@ -57,22 +66,22 @@ namespace J3ML::Geometry @param direction The direction vector of the direction to find the extreme point. This vector may be unnormalized, but may not be null. @return The extreme point of this Capsule in the given direction. */ - Vector3 ExtremePoint(const Vector3 &direction) const; + [[nodiscard]] Vector3 ExtremePoint(const Vector3 &direction) const; Vector3 ExtremePoint(const Vector3 &direction, float &projectionDistance) const; /// Tests if this Capsule is degenerate. /** @return True if this Capsule does not span a strictly positive volume. */ - bool IsDegenerate() const; + [[nodiscard]] bool IsDegenerate() const; /// Computes the total height of this capsule, i.e. LineLength() + Diameter(). /** @see LineLength(). */ - float Height() const; + [[nodiscard]] float Height() const; /// Computes the distance of the two inner points of this capsule. @see Height. - float LineLength() const { return l.Length(); } + [[nodiscard]] float LineLength() const; /// Computes the diameter of this capsule. - float Diameter() const { return 2.f * r;} + [[nodiscard]] float Diameter() const; /// Returns the bottom-most point of this Capsule. /** @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 @@ -80,42 +89,42 @@ 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 { return l.A - UpDirection() * r;} + [[nodiscard]] Vector3 Bottom() const; /// Returns the center point of this Capsule. /** @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 { return l.CenterPoint();} - Vector3 Centroid() const; ///< [similarOverload: Center] + [[nodiscard]] Vector3 Center() const; + [[nodiscard]] Vector3 Centroid() const; ///< [similarOverload: Center] /// Returns the direction from the bottommost point towards the topmost point of this Capsule. /** @return The normalized direction vector from l.a to l.b. @see l. */ - Vector3 UpDirection() const; + [[nodiscard]] Vector3 UpDirection() const; /// Computes the volume of this Capsule. /** @return pi * r^2 * |b-a| + 4 * pi * r^2 / 3. @see SurfaceArea(). */ - float Volume() const; + [[nodiscard]] float Volume() const; /// Computes the surface area of this Capsule. /** @return 2 * pi * r * |b-a| + 4 * pi * r^2. @see Volume(). */ - float SurfaceArea() const; + [[nodiscard]] float SurfaceArea() const; /// Returns the cross-section circle at the given height of this Capsule. /** @param l A normalized parameter between [0,1]. l == 0 returns a degenerate circle of radius 0 at the bottom of this Capsule, and l == 1 will return a degenerate circle of radius 0 at the top of this Capsule. */ - //Circle CrossSection(float l) const; + Circle CrossSection(float l) const; Vector3 ExtremePoint(const Vector3& direction); /// Returns the smallest AABB that encloses this capsule. /** @see MinimalEnclosingOBB(). */ - AABB MinimalEnclosingAABB() const; + [[nodiscard]] AABB MinimalEnclosingAABB() const; /// Returns the smallest OBB that encloses this capsule. /** @see MinimalEnclosingAABB(). */ @@ -137,7 +146,7 @@ namespace J3ML::Geometry @note The topmost point of the capsule is different than the point l.b. 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 Bottom(), l. */ - Vector3 Top() const; + [[nodiscard]] Vector3 Top() const; /// Applies a transformation to this capsule. /** @param transform The transformation to apply to this capsule. This transformation must be diff --git a/include/J3ML/Geometry/Circle.hpp b/include/J3ML/Geometry/Circle.hpp new file mode 100644 index 0000000..d5ade9d --- /dev/null +++ b/include/J3ML/Geometry/Circle.hpp @@ -0,0 +1,162 @@ +/// Josh's 3D Math Library +/// A C++20 Library for 3D Math, Computer Graphics, and Scientific Computing. +/// Developed and Maintained by Josh O'Leary @ Redacted Software. +/// Special Thanks to William Tomasine II and Maxine Hayes. +/// (c) 2024 Redacted Software +/// This work is dedicated to the public domain. + +/// @file Circle.hpp +/// @desc The Circle geometry object. +/// @edit 2024-07-06 + +#pragma once + +#include + +namespace J3ML +{ + + /// A two-dimensional circle in 3D space. + /// This class represents both a hollow circle (only edge) and a solid circle (disc). + class Circle + { + public: + /// The center position of this circle. + Vector3 Position; + /// The normal direction of this circle. + /** A circle is a two-dimensional object in 3D space. This normal vector (together with the Position) + specifies the plane in which this circle lies in. + This vector is always normalized. If you assign to this member directly, be sure to only assign normalized vectors. */ + Vector3 Normal; + /// The radius of the circle. + /** This parameter must be strictly positive to specify a non-degenerate circle. If zero is specified, this circle + is considered to be degenerate. */ + float Radius; + /// The default constructor does not initialize any members of this class. + /** This means that the values of members Position, Normal, and Radius are all undefined after creating + a new circle using this default constructor. Remember to assign them before use. + @see Position, Normal, Radius. */ + Circle() {} + /// Constructs a new circle by explicitly specifying the member variables. + /** @param center The center point of the circle. + @param normal The direction vector that specifies the orientation of this circle. + This vector must be normalized, the constructor will not normalize the vector for you (for performance reasons). + @param radius The radius of the circle. + @see Position, Normal, Radius. */ + Circle(const Vector3& center, const Vector3& normal, float radius); + + /// Returns a normalized direction vector to the 'U direction' of the circle. + /** This vector lies on the plane of this circle. + The U direction specifies the first basis vector of a local space of this circle. */ + Vector3 BasisU() const; + /// Returns a normalized direction vector to the 'V direction' of the circle. + /** This vector lies on the plane of this circle. + The V direction specifies the second basis vector of a local space of this circle. */ + Vector3 BasisV() const; + /// Returns a point at the edge of this circle. + /** @param angleRadians The direction of the point to get. A full circle is generated by the range [0, 2*pi], + but it is ok to pass in values outside this range. + @note This function is equivalent to calling GetPoint(float angleRadians, float d) with a value of d == 1. + @return A point in world space at the edge of this circle. */ + Vector3 GetPoint(float angleRadians) const; + /// Returns a point inside this circle. + /** @param angleRadians The direction of the point to get. A full circle is generated by the range [0, 2*pi], + but it is ok to pass in values outside this range. + @param d A value in the range [0, 1] that specifies the normalized distance of the point from the center of the circle. + A value of 0 returns the center point of this circle. A value of 1 returns a point at the edge of this circle. + The range of d is not restricted, so it is ok to pass in values larger than 1 to generate a point lying completely + outside the circle. */ + Vector3 GetPoint(float angleRadians, float d) const; + + /// Returns the center point of this circle. + /** This point is also the center of mass for this circle. The functions CenterPoint() and Centroid() are equivalent. + @see Position. */ + Vector3 CenterPoint() const { return Position; } + Vector3 Centroid() const { return Position;} + + /// Computes an extreme point of this Circle/Disc in the given direction. + /** An extreme point is a farthest point of this Circle/Disc in the given direction. Given a direction, + this point is not necessarily unique. + @param direction The direction vector of the direction to find the extreme point. This vector may + be unnormalized, but may not be null. + @return An extreme point of this Circle/Disc in the given direction. The returned point is always at + the edge of this Circle. */ + Vector3 ExtremePoint(const Vector3& direction) const; + + /// Computes the plane this circle is contained in. + /** All of the points of this circle lie inside this plane. + @see class Plane. */ + Plane ContainingPlane() const; + + /// Translates this Circle in world space. + /** @param offset The amount of displacement to apply to this circle, in world space coordinates. + @see Transform(). */ + void Translate(const Vector3& offset); + + /// Applies a transformation to this Circle. + /** @param transform The transformation to apply to this Circle. This transformation must be + affine, and must contain an orthogonal set of column vectors (may not contain shear or projection). + The transformation can only contain uniform scale, and may not contain mirroring. + @see Translate(), Scale(), classes Matrix3x3, Matrix4x4, Quaternion. */ + void Transform(const Matrix3x3& transform); + void Transform(const Matrix4x4& transform); + void Transform(const Quaternion& transform); + + /// Tests if the given point is contained at the edge of this circle. + /** @param point The target point to test. + @param maxDistance The epsilon threshold to test the distance against. This effectively turns the circle into a torus + for this test. + @see DistanceToEdge(), DistanceToDisc(), ClosestPointToEdge(), ClosestPointToDisc(). + @todo Implement DiscContains(Vector3/LineSegment/Triangle). */ + bool EdgeContains(const Vector3& point, float maxDistance = 1e-6f) const; + + /// Computes the distance of the given object to the edge of this circle. + /** @todo Implement DistanceToEdge(Ray/LineSegment/Line). + @return The distance of the given point to the edge of this circle. If the point is contained on this circle, + the value 0 is returned. + @see DistanceToEdge(), DistanceToDisc(), ClosestPointToDisc().*/ + float DistanceToEdge(const Vector3& point) const; + + /// Computes the distance of the given object to this disc (filled circle). + /** If the point is contained inside this disc, the value 0 is returned. + @see DistanceToEdge(), ClosestPointToEdge(), ClosestPointToDisc(). + @todo Implement DistanceToDisc(Ray/LineSegment/Line). */ + float DistanceToDisc(const Vector3& point) const; + + /// Computes the closest point on the edge of this circle to the given object. + /** @todo Implement ClosestPointToEdge(Ray/LineSegment/Line). + @see DistanceToEdge(), DistanceToDisc(), ClosestPointToDisc(). */ + Vector3 ClosestPointToEdge(const Vector3& point) const; + + /// Computes the closest point on the disc of this circle to the given object. + /** @todo Implement ClosestPointToDisc(Ray/LineSegment/Line). + @see DistanceToEdge(), DistanceToDisc(), ClosestPointToEdge(). */ + Vector3 ClosestPointToDisc(const Vector3& point) const; + + /// Tests this circle for an intersection against the given plane. + /** @note For Circle-Plane intersection, there is no need to differentiate between a hollow or filled circle(disc). + @return The number of intersection points found for this circle and the given plane. + @see IntersectsDisc(). */ + int Intersects(const Plane& plane, Vector3* pt1, Vector3* pt2) const; + int Intersects(const Plane& plane) const; + + /// Tests this disc for an intersection against the given object. + /** @see Intersects(). */ + bool IntersectsDisc(const Line& line) const; + bool IntersectsDisc(const LineSegment& lineSegment) const; + bool IntersectsDisc(const Ray& ray) const; + + /// Tests if this circle intersects the faces of the given OBB. + /** @param obb The bounding box to test against. This box is treated as "hollow", i.e. only the faces of the OBB are considered to be + a part of the OBB. + @return A vector that contains all the detected points of intersection for this circle and the given OBB. If the circle is fully + contained inside the OBB, or is fully outside the OBB, no intersection occurs, and the returned vector has zero elements. + @see Intersects(), IntersectsDisc(). */ + std::vector IntersectsFaces(const OBB& obb) const; + std::vector IntersectsFaces(const AABB& aabb) const; + }; + Circle operator *(const Matrix3x3& transform, const Circle& circle); + Circle operator *(const Matrix4x4& transform, const Circle& circle); + Circle operator *(const Quaternion& transform, const Circle& circle); + std::ostream& operator << (std::ostream& o, const Circle& circle); +} diff --git a/include/J3ML/Geometry/Common.h b/include/J3ML/Geometry/Common.hpp similarity index 100% rename from include/J3ML/Geometry/Common.h rename to include/J3ML/Geometry/Common.hpp diff --git a/include/J3ML/Geometry/Frustum.h b/include/J3ML/Geometry/Frustum.hpp similarity index 99% rename from include/J3ML/Geometry/Frustum.h rename to include/J3ML/Geometry/Frustum.hpp index da40f81..67b4d72 100644 --- a/include/J3ML/Geometry/Frustum.h +++ b/include/J3ML/Geometry/Frustum.hpp @@ -3,10 +3,10 @@ // #pragma once -#include -#include "Plane.h" -#include "Shape.h" -#include +#include +#include "Plane.hpp" +#include "Shape.hpp" +#include namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/KDTree.h b/include/J3ML/Geometry/KDTree.hpp similarity index 100% rename from include/J3ML/Geometry/KDTree.h rename to include/J3ML/Geometry/KDTree.hpp diff --git a/include/J3ML/Geometry/Line.h b/include/J3ML/Geometry/Line.hpp similarity index 95% rename from include/J3ML/Geometry/Line.h rename to include/J3ML/Geometry/Line.hpp index c6ffdf2..3ed915c 100644 --- a/include/J3ML/Geometry/Line.h +++ b/include/J3ML/Geometry/Line.hpp @@ -1,7 +1,7 @@ #pragma once -#include "LineSegment.h" +#include "LineSegment.hpp" namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/LineSegment.h b/include/J3ML/Geometry/LineSegment.hpp similarity index 99% rename from include/J3ML/Geometry/LineSegment.h rename to include/J3ML/Geometry/LineSegment.hpp index 76a2df3..cfbb8d2 100644 --- a/include/J3ML/Geometry/LineSegment.h +++ b/include/J3ML/Geometry/LineSegment.hpp @@ -1,8 +1,8 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/OBB.h b/include/J3ML/Geometry/OBB.hpp similarity index 98% rename from include/J3ML/Geometry/OBB.h rename to include/J3ML/Geometry/OBB.hpp index 27847ac..bf381e6 100644 --- a/include/J3ML/Geometry/OBB.h +++ b/include/J3ML/Geometry/OBB.hpp @@ -1,8 +1,8 @@ #pragma once -#include +#include #include -#include +#include namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/PBVolume.hpp b/include/J3ML/Geometry/PBVolume.hpp index da43c1b..683d264 100644 --- a/include/J3ML/Geometry/PBVolume.hpp +++ b/include/J3ML/Geometry/PBVolume.hpp @@ -13,11 +13,11 @@ #include -#include -#include +#include +#include -#include "Sphere.h" -#include "Sphere.h" +#include "Sphere.hpp" +#include "Sphere.hpp" namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/Plane.h b/include/J3ML/Geometry/Plane.hpp similarity index 98% rename from include/J3ML/Geometry/Plane.h rename to include/J3ML/Geometry/Plane.hpp index 36fa527..1e6e990 100644 --- a/include/J3ML/Geometry/Plane.h +++ b/include/J3ML/Geometry/Plane.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include "Shape.h" -#include "Ray.h" +#include +#include "Shape.hpp" +#include "Ray.hpp" namespace J3ML::Geometry diff --git a/include/J3ML/Geometry/Polygon.h b/include/J3ML/Geometry/Polygon.hpp similarity index 97% rename from include/J3ML/Geometry/Polygon.h rename to include/J3ML/Geometry/Polygon.hpp index ff4ffed..5af9956 100644 --- a/include/J3ML/Geometry/Polygon.h +++ b/include/J3ML/Geometry/Polygon.hpp @@ -1,9 +1,9 @@ #pragma once -#include +#include #include -#include "Shape.h" -#include +#include "Shape.hpp" +#include namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/Polyhedron.h b/include/J3ML/Geometry/Polyhedron.hpp similarity index 98% rename from include/J3ML/Geometry/Polyhedron.h rename to include/J3ML/Geometry/Polyhedron.hpp index eecafb0..57b1fd2 100644 --- a/include/J3ML/Geometry/Polyhedron.h +++ b/include/J3ML/Geometry/Polyhedron.hpp @@ -1,9 +1,9 @@ #pragma once -#include -#include +#include +#include #include -#include +#include namespace J3ML::Geometry diff --git a/include/J3ML/Geometry/QuadTree.h b/include/J3ML/Geometry/QuadTree.hpp similarity index 99% rename from include/J3ML/Geometry/QuadTree.h rename to include/J3ML/Geometry/QuadTree.hpp index 94a6c95..bece55b 100644 --- a/include/J3ML/Geometry/QuadTree.h +++ b/include/J3ML/Geometry/QuadTree.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/Ray.h b/include/J3ML/Geometry/Ray.hpp similarity index 98% rename from include/J3ML/Geometry/Ray.h rename to include/J3ML/Geometry/Ray.hpp index 46a02df..90e3fd4 100644 --- a/include/J3ML/Geometry/Ray.h +++ b/include/J3ML/Geometry/Ray.hpp @@ -10,11 +10,11 @@ /// @edit 2024-07-06 #pragma once -#include +#include #include -#include "TriangleMesh.h" -#include "Frustum.h" -#include "OBB.h" +#include "TriangleMesh.hpp" +#include "Frustum.hpp" +#include "OBB.hpp" namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/Shape.h b/include/J3ML/Geometry/Shape.hpp similarity index 99% rename from include/J3ML/Geometry/Shape.h rename to include/J3ML/Geometry/Shape.hpp index 8dfb55c..cf45e7c 100644 --- a/include/J3ML/Geometry/Shape.h +++ b/include/J3ML/Geometry/Shape.hpp @@ -1,6 +1,5 @@ #pragma once - namespace J3ML::Geometry { class GeometricPrimitive diff --git a/include/J3ML/Geometry/Sphere.h b/include/J3ML/Geometry/Sphere.hpp similarity index 96% rename from include/J3ML/Geometry/Sphere.h rename to include/J3ML/Geometry/Sphere.hpp index d2e28cf..6362a61 100644 --- a/include/J3ML/Geometry/Sphere.h +++ b/include/J3ML/Geometry/Sphere.hpp @@ -12,12 +12,12 @@ #pragma once -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace J3ML::Geometry { diff --git a/include/J3ML/Geometry/Triangle.h b/include/J3ML/Geometry/Triangle.hpp similarity index 98% rename from include/J3ML/Geometry/Triangle.h rename to include/J3ML/Geometry/Triangle.hpp index 86b2d1d..0fd9a99 100644 --- a/include/J3ML/Geometry/Triangle.h +++ b/include/J3ML/Geometry/Triangle.hpp @@ -1,8 +1,8 @@ #pragma once -#include "J3ML/LinearAlgebra/Vector3.h" -#include -#include +#include "J3ML/LinearAlgebra/Vector3.hpp" +#include +#include #include namespace J3ML::Geometry diff --git a/include/J3ML/Geometry/Triangle2D.h b/include/J3ML/Geometry/Triangle2D.hpp similarity index 100% rename from include/J3ML/Geometry/Triangle2D.h rename to include/J3ML/Geometry/Triangle2D.hpp diff --git a/include/J3ML/Geometry/TriangleMesh.h b/include/J3ML/Geometry/TriangleMesh.hpp similarity index 86% rename from include/J3ML/Geometry/TriangleMesh.h rename to include/J3ML/Geometry/TriangleMesh.hpp index 5188b60..a856a2c 100644 --- a/include/J3ML/Geometry/TriangleMesh.h +++ b/include/J3ML/Geometry/TriangleMesh.hpp @@ -1,9 +1,9 @@ #pragma once #include -#include -#include -#include +#include +#include +#include "J3ML/J3ML.hpp" using namespace J3ML::LinearAlgebra; diff --git a/include/J3ML/J3ML.h b/include/J3ML/J3ML.hpp similarity index 100% rename from include/J3ML/J3ML.h rename to include/J3ML/J3ML.hpp diff --git a/include/J3ML/LinearAlgebra.h b/include/J3ML/LinearAlgebra.hpp similarity index 51% rename from include/J3ML/LinearAlgebra.h rename to include/J3ML/LinearAlgebra.hpp index 25a643c..b37f65d 100644 --- a/include/J3ML/LinearAlgebra.h +++ b/include/J3ML/LinearAlgebra.hpp @@ -15,16 +15,16 @@ // Library Code // -#include "J3ML/LinearAlgebra/Vector2.h" -#include "J3ML/LinearAlgebra/Vector3.h" -#include "J3ML/LinearAlgebra/Vector4.h" -#include "J3ML/LinearAlgebra/Quaternion.h" -#include "J3ML/LinearAlgebra/AxisAngle.h" -#include "J3ML/LinearAlgebra/EulerAngle.h" -#include "J3ML/LinearAlgebra/Matrix2x2.h" -#include "J3ML/LinearAlgebra/Matrix3x3.h" -#include "J3ML/LinearAlgebra/Matrix4x4.h" -#include "J3ML/LinearAlgebra/Transform2D.h" -#include "J3ML/LinearAlgebra/CoordinateFrame.h" +#include "J3ML/LinearAlgebra/Vector2.hpp" +#include "J3ML/LinearAlgebra/Vector3.hpp" +#include "J3ML/LinearAlgebra/Vector4.hpp" +#include "J3ML/LinearAlgebra/Quaternion.hpp" +#include "J3ML/LinearAlgebra/AxisAngle.hpp" +#include "J3ML/LinearAlgebra/EulerAngle.hpp" +#include "J3ML/LinearAlgebra/Matrix2x2.hpp" +#include "J3ML/LinearAlgebra/Matrix3x3.hpp" +#include "J3ML/LinearAlgebra/Matrix4x4.hpp" +#include "J3ML/LinearAlgebra/Transform2D.hpp" +#include "J3ML/LinearAlgebra/CoordinateFrame.hpp" using namespace J3ML::LinearAlgebra; diff --git a/include/J3ML/LinearAlgebra/Angle2D.h b/include/J3ML/LinearAlgebra/Angle2D.hpp similarity index 93% rename from include/J3ML/LinearAlgebra/Angle2D.h rename to include/J3ML/LinearAlgebra/Angle2D.hpp index 8f7ea94..0d15323 100644 --- a/include/J3ML/LinearAlgebra/Angle2D.h +++ b/include/J3ML/LinearAlgebra/Angle2D.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include "J3ML/J3ML.hpp" namespace J3ML::LinearAlgebra { diff --git a/include/J3ML/LinearAlgebra/AxisAngle.h b/include/J3ML/LinearAlgebra/AxisAngle.hpp similarity index 77% rename from include/J3ML/LinearAlgebra/AxisAngle.h rename to include/J3ML/LinearAlgebra/AxisAngle.hpp index 000b18b..b66bb55 100644 --- a/include/J3ML/LinearAlgebra/AxisAngle.h +++ b/include/J3ML/LinearAlgebra/AxisAngle.hpp @@ -1,9 +1,9 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace J3ML::LinearAlgebra { diff --git a/include/J3ML/LinearAlgebra/Common.h b/include/J3ML/LinearAlgebra/Common.hpp similarity index 100% rename from include/J3ML/LinearAlgebra/Common.h rename to include/J3ML/LinearAlgebra/Common.hpp diff --git a/include/J3ML/LinearAlgebra/CoordinateFrame.h b/include/J3ML/LinearAlgebra/CoordinateFrame.hpp similarity index 86% rename from include/J3ML/LinearAlgebra/CoordinateFrame.h rename to include/J3ML/LinearAlgebra/CoordinateFrame.hpp index 666b9d5..6b4ca38 100644 --- a/include/J3ML/LinearAlgebra/CoordinateFrame.h +++ b/include/J3ML/LinearAlgebra/CoordinateFrame.hpp @@ -1,7 +1,7 @@ #pragma once -#include +#include namespace J3ML::LinearAlgebra { diff --git a/include/J3ML/LinearAlgebra/EulerAngle.h b/include/J3ML/LinearAlgebra/EulerAngle.hpp similarity index 91% rename from include/J3ML/LinearAlgebra/EulerAngle.h rename to include/J3ML/LinearAlgebra/EulerAngle.hpp index 9f3e758..0e985a9 100644 --- a/include/J3ML/LinearAlgebra/EulerAngle.h +++ b/include/J3ML/LinearAlgebra/EulerAngle.hpp @@ -1,8 +1,8 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace J3ML::LinearAlgebra { diff --git a/include/J3ML/LinearAlgebra/Matrices.inl b/include/J3ML/LinearAlgebra/Matrices.inl index aee8b80..77fafb7 100644 --- a/include/J3ML/LinearAlgebra/Matrices.inl +++ b/include/J3ML/LinearAlgebra/Matrices.inl @@ -2,8 +2,8 @@ /// Template Parameterized (Generic) Matrix Functions. -#include -#include +#include +#include "J3ML/J3ML.hpp" namespace J3ML::LinearAlgebra { @@ -148,8 +148,8 @@ namespace J3ML::LinearAlgebra { template void Set3x3PartRotateX(Matrix &m, float angle) { float sinz, cosz; - sinz = std::sin(angle); - cosz = std::cos(angle); + sinz = Math::Sin(angle); + cosz = Math::Cos(angle); m[0][0] = 1.f; m[0][1] = 0.f; @@ -170,8 +170,8 @@ namespace J3ML::LinearAlgebra { template void Set3x3PartRotateY(Matrix &m, float angle) { float sinz, cosz; - sinz = std::sin(angle); - cosz = std::cos(angle); + sinz = Math::Sin(angle); + cosz = Math::Cos(angle); m[0][0] = cosz; m[0][1] = 0.f; diff --git a/include/J3ML/LinearAlgebra/Matrix.h b/include/J3ML/LinearAlgebra/Matrix.hpp similarity index 98% rename from include/J3ML/LinearAlgebra/Matrix.h rename to include/J3ML/LinearAlgebra/Matrix.hpp index 47bfcc6..6f42746 100644 --- a/include/J3ML/LinearAlgebra/Matrix.h +++ b/include/J3ML/LinearAlgebra/Matrix.hpp @@ -3,7 +3,7 @@ #include #include #include -#include "Vector.h" +#include "Vector.hpp" namespace J3ML::LinearAlgebra { diff --git a/include/J3ML/LinearAlgebra/Matrix2x2.h b/include/J3ML/LinearAlgebra/Matrix2x2.hpp similarity index 96% rename from include/J3ML/LinearAlgebra/Matrix2x2.h rename to include/J3ML/LinearAlgebra/Matrix2x2.hpp index 4d23adb..c13e787 100644 --- a/include/J3ML/LinearAlgebra/Matrix2x2.h +++ b/include/J3ML/LinearAlgebra/Matrix2x2.hpp @@ -2,7 +2,7 @@ -#include +#include namespace J3ML::LinearAlgebra { diff --git a/include/J3ML/LinearAlgebra/Matrix3x3.h b/include/J3ML/LinearAlgebra/Matrix3x3.hpp similarity index 99% rename from include/J3ML/LinearAlgebra/Matrix3x3.h rename to include/J3ML/LinearAlgebra/Matrix3x3.hpp index 33392da..82c3ec5 100644 --- a/include/J3ML/LinearAlgebra/Matrix3x3.h +++ b/include/J3ML/LinearAlgebra/Matrix3x3.hpp @@ -2,10 +2,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include using namespace J3ML::Algorithm; diff --git a/include/J3ML/LinearAlgebra/Matrix4x4.h b/include/J3ML/LinearAlgebra/Matrix4x4.hpp similarity index 99% rename from include/J3ML/LinearAlgebra/Matrix4x4.h rename to include/J3ML/LinearAlgebra/Matrix4x4.hpp index dcf0741..dcf8113 100644 --- a/include/J3ML/LinearAlgebra/Matrix4x4.h +++ b/include/J3ML/LinearAlgebra/Matrix4x4.hpp @@ -1,7 +1,7 @@ #pragma once -#include +#include #include #include diff --git a/include/J3ML/LinearAlgebra/Quaternion.h b/include/J3ML/LinearAlgebra/Quaternion.hpp similarity index 99% rename from include/J3ML/LinearAlgebra/Quaternion.h rename to include/J3ML/LinearAlgebra/Quaternion.hpp index 300cbe5..ed27c97 100644 --- a/include/J3ML/LinearAlgebra/Quaternion.h +++ b/include/J3ML/LinearAlgebra/Quaternion.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include diff --git a/include/J3ML/LinearAlgebra/Transform2D.h b/include/J3ML/LinearAlgebra/Transform2D.hpp similarity index 97% rename from include/J3ML/LinearAlgebra/Transform2D.h rename to include/J3ML/LinearAlgebra/Transform2D.hpp index ad8a6ce..c506785 100644 --- a/include/J3ML/LinearAlgebra/Transform2D.h +++ b/include/J3ML/LinearAlgebra/Transform2D.hpp @@ -1,7 +1,7 @@ #pragma once -#include +#include namespace J3ML::LinearAlgebra { class Transform2D { diff --git a/include/J3ML/LinearAlgebra/Vector.h b/include/J3ML/LinearAlgebra/Vector.hpp similarity index 100% rename from include/J3ML/LinearAlgebra/Vector.h rename to include/J3ML/LinearAlgebra/Vector.hpp diff --git a/include/J3ML/LinearAlgebra/Vector2.h b/include/J3ML/LinearAlgebra/Vector2.hpp similarity index 100% rename from include/J3ML/LinearAlgebra/Vector2.h rename to include/J3ML/LinearAlgebra/Vector2.hpp diff --git a/include/J3ML/LinearAlgebra/Vector3.h b/include/J3ML/LinearAlgebra/Vector3.hpp similarity index 99% rename from include/J3ML/LinearAlgebra/Vector3.h rename to include/J3ML/LinearAlgebra/Vector3.hpp index 7e0376d..fad66b0 100644 --- a/include/J3ML/LinearAlgebra/Vector3.h +++ b/include/J3ML/LinearAlgebra/Vector3.hpp @@ -1,10 +1,10 @@ #pragma once -#include -#include +#include +#include #include #include -#include +#include #include diff --git a/include/J3ML/LinearAlgebra/Vector4.h b/include/J3ML/LinearAlgebra/Vector4.hpp similarity index 99% rename from include/J3ML/LinearAlgebra/Vector4.h rename to include/J3ML/LinearAlgebra/Vector4.hpp index c2ee426..e24d54f 100644 --- a/include/J3ML/LinearAlgebra/Vector4.h +++ b/include/J3ML/LinearAlgebra/Vector4.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace J3ML::LinearAlgebra { diff --git a/include/J3ML/Units.h b/include/J3ML/Units.hpp similarity index 100% rename from include/J3ML/Units.h rename to include/J3ML/Units.hpp diff --git a/main.cpp b/main.cpp index d53a59b..2e91bdc 100644 --- a/main.cpp +++ b/main.cpp @@ -11,8 +11,8 @@ #include -#include -#include +#include +#include "J3ML/J3ML.hpp" int main(int argc, char** argv) { diff --git a/src/J3ML/Algorithm/GJK.cpp b/src/J3ML/Algorithm/GJK.cpp index 0728a23..f393c1b 100644 --- a/src/J3ML/Algorithm/GJK.cpp +++ b/src/J3ML/Algorithm/GJK.cpp @@ -1,6 +1,6 @@ #include -#include +#include namespace J3ML::Algorithms { diff --git a/src/J3ML/Geometry/AABB.cpp b/src/J3ML/Geometry/AABB.cpp index 50e8e1d..139a10c 100644 --- a/src/J3ML/Geometry/AABB.cpp +++ b/src/J3ML/Geometry/AABB.cpp @@ -1,16 +1,16 @@ #include #include -#include -#include +#include +#include //#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/Capsule.cpp b/src/J3ML/Geometry/Capsule.cpp index 3d9ab79..c31519f 100644 --- a/src/J3ML/Geometry/Capsule.cpp +++ b/src/J3ML/Geometry/Capsule.cpp @@ -1,8 +1,8 @@ #include -#include +#include #include -#include -#include +#include +#include namespace J3ML::Geometry { @@ -138,4 +138,57 @@ namespace J3ML::Geometry { return Capsule(l.A + offset, l.B + offset, r); } + + Vector3 Capsule::Bottom() const { return l.A - UpDirection() * r;} + + Vector3 Capsule::Center() const { return l.CenterPoint();} + + Vector3 Capsule::Centroid() const { return Center(); } + + float Capsule::Diameter() const { return 2.f * r;} + + float Capsule::LineLength() const { return l.Length(); } + + void Capsule::SetFrom(const Sphere &s) { + l = LineSegment(s.Position, s.Position); + r = s.Radius; + } + + + void Capsule::SetDegenerate() { + r = -1.f; + } + + Vector3 Capsule::AnyPointFast() const { return l.A; } + + + Vector3 Capsule::UniformPointPerhapsInside(float height, float x, float y) const { + return MinimalEnclosingOBB().PointInside(height, x, y); + } + + + Vector3 Capsule::UpDirection() const + { + Vector3 d = l.B - l.A; + d.Normalize(); // Will always result in a normalized vector, even if l.a == l.b. + return d; + } + + Vector3 Capsule::Top() const + { + return l.B + UpDirection() * r; + } + + float Capsule::Volume() const + { + return Math::Pi * r * r * LineLength() + 4.f * Math::Pi * r * r * r / 3.f; + } + + float Capsule::SurfaceArea() const + { + return 2.f * Math::Pi * r * LineLength() + 4.f * Math::Pi * r * r; + } + + + } \ No newline at end of file diff --git a/src/J3ML/Geometry/Circle.cpp b/src/J3ML/Geometry/Circle.cpp new file mode 100644 index 0000000..7c86812 --- /dev/null +++ b/src/J3ML/Geometry/Circle.cpp @@ -0,0 +1 @@ +#include \ No newline at end of file diff --git a/src/J3ML/Geometry/Common.cpp b/src/J3ML/Geometry/Common.cpp index 1a37fc3..4dd20d9 100644 --- a/src/J3ML/Geometry/Common.cpp +++ b/src/J3ML/Geometry/Common.cpp @@ -1,4 +1,4 @@ -#include +#include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/Frustum.cpp b/src/J3ML/Geometry/Frustum.cpp index fb26df9..4a13c36 100644 --- a/src/J3ML/Geometry/Frustum.cpp +++ b/src/J3ML/Geometry/Frustum.cpp @@ -1,10 +1,10 @@ -#include -#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #include diff --git a/src/J3ML/Geometry/Line.cpp b/src/J3ML/Geometry/Line.cpp index 203f1e4..4bb0759 100644 --- a/src/J3ML/Geometry/Line.cpp +++ b/src/J3ML/Geometry/Line.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/LineSegment.cpp b/src/J3ML/Geometry/LineSegment.cpp index 346ce63..76c2205 100644 --- a/src/J3ML/Geometry/LineSegment.cpp +++ b/src/J3ML/Geometry/LineSegment.cpp @@ -1,9 +1,9 @@ -#include -#include "J3ML/Geometry/Capsule.h" -#include -#include -#include -#include +#include +#include "J3ML/Geometry/Capsule.hpp" +#include +#include +#include +#include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/OBB.cpp b/src/J3ML/Geometry/OBB.cpp index 836aa40..100565f 100644 --- a/src/J3ML/Geometry/OBB.cpp +++ b/src/J3ML/Geometry/OBB.cpp @@ -1,9 +1,9 @@ -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/Plane.cpp b/src/J3ML/Geometry/Plane.cpp index 808bbd3..dd1450a 100644 --- a/src/J3ML/Geometry/Plane.cpp +++ b/src/J3ML/Geometry/Plane.cpp @@ -1,9 +1,9 @@ -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/Polygon.cpp b/src/J3ML/Geometry/Polygon.cpp index 62017c0..c485642 100644 --- a/src/J3ML/Geometry/Polygon.cpp +++ b/src/J3ML/Geometry/Polygon.cpp @@ -1,8 +1,8 @@ -#include +#include #include -#include -#include "J3ML/Geometry/Plane.h" -#include "J3ML/Geometry/Line.h" +#include +#include "J3ML/Geometry/Plane.hpp" +#include "J3ML/Geometry/Line.hpp" #include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/Polyhedron.cpp b/src/J3ML/Geometry/Polyhedron.cpp index 8ecc89e..600965e 100644 --- a/src/J3ML/Geometry/Polyhedron.cpp +++ b/src/J3ML/Geometry/Polyhedron.cpp @@ -1,11 +1,11 @@ -#include +#include #include -#include -#include -#include "J3ML/Geometry/Ray.h" -#include "J3ML/Geometry/Line.h" -#include -#include +#include +#include +#include "J3ML/Geometry/Ray.hpp" +#include "J3ML/Geometry/Line.hpp" +#include +#include #include #include diff --git a/src/J3ML/Geometry/QuadTree.cpp b/src/J3ML/Geometry/QuadTree.cpp index cee3430..8c28780 100644 --- a/src/J3ML/Geometry/QuadTree.cpp +++ b/src/J3ML/Geometry/QuadTree.cpp @@ -1,4 +1,4 @@ -#include +#include namespace Geometry { diff --git a/src/J3ML/Geometry/Ray.cpp b/src/J3ML/Geometry/Ray.cpp index 5386e14..d1c6b6d 100644 --- a/src/J3ML/Geometry/Ray.cpp +++ b/src/J3ML/Geometry/Ray.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include namespace J3ML::Geometry diff --git a/src/J3ML/Geometry/Sphere.cpp b/src/J3ML/Geometry/Sphere.cpp index aa1b07d..fce35c5 100644 --- a/src/J3ML/Geometry/Sphere.cpp +++ b/src/J3ML/Geometry/Sphere.cpp @@ -1,4 +1,4 @@ -#include +#include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/Triangle.cpp b/src/J3ML/Geometry/Triangle.cpp index e551aea..4ce097f 100644 --- a/src/J3ML/Geometry/Triangle.cpp +++ b/src/J3ML/Geometry/Triangle.cpp @@ -1,9 +1,9 @@ -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include namespace J3ML::Geometry { diff --git a/src/J3ML/Geometry/TriangleMesh.cpp b/src/J3ML/Geometry/TriangleMesh.cpp index bd7c907..25d8f29 100644 --- a/src/J3ML/Geometry/TriangleMesh.cpp +++ b/src/J3ML/Geometry/TriangleMesh.cpp @@ -1,6 +1,6 @@ -#include +#include -#include +#include TriangleMesh::TriangleMesh(int expectedPolygonCount) { //Vertices.reserve(expectedPolygonCount); diff --git a/src/J3ML/J3ML.cpp b/src/J3ML/J3ML.cpp index 080018f..8ce1965 100644 --- a/src/J3ML/J3ML.cpp +++ b/src/J3ML/J3ML.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include "J3ML/J3ML.hpp" float PowUInt(float base, u32 exponent) @@ -246,19 +246,19 @@ namespace J3ML outCos = Cos(x); } - float Asin(float x) { return std::asinf(x); } + float Asin(float x) { return std::asin(x); } - float Acos(float x) { return std::acosf(x); } + float Acos(float x) { return std::acos(x); } - float Atan(float x) { return std::atanf(x); } + float Atan(float x) { return std::atan(x); } - float Atan2(float y, float x) { return std::atan2f(y, x); } + float Atan2(float y, float x) { return std::atan2(y, x); } - float Sinh(float x) { return std::sinhf(x); } + float Sinh(float x) { return std::sinh(x); } - float Cosh(float x) { return std::coshf(x); } + float Cosh(float x) { return std::cosh(x); } - float Tanh(float x) { return std::tanhf(x); } + float Tanh(float x) { return std::tanh(x); } bool IsPow2(u32 number) { return (number & (number - 1)) == 0; @@ -276,7 +276,7 @@ namespace J3ML else return PowUInt(base, (u32) exponent); } - float Pow(float base, float exponent) { return std::powf(base, exponent); } + float Pow(float base, float exponent) { return std::pow(base, exponent); } float Exp(float exp) { return std::exp(exp); } @@ -296,12 +296,12 @@ namespace J3ML return Log(10, value); } - float Ceil(float f) { return std::ceilf(f); } - int CeilInt(float f) { return (int)std::ceilf(f);} + float Ceil(float f) { return std::ceil(f); } + int CeilInt(float f) { return (int)std::ceil(f);} - float Floor(float x) { return floorf(x); } + float Floor(float x) { return std::floor(x); } - int FloorInt(float x) { return (int)floorf(x); } + int FloorInt(float x) { return (int)std::floor(x); } float Round(float x) { return Floor(x+0.5f); } diff --git a/src/J3ML/LinearAlgebra.cpp b/src/J3ML/LinearAlgebra.cpp index 113e577..33a8040 100644 --- a/src/J3ML/LinearAlgebra.cpp +++ b/src/J3ML/LinearAlgebra.cpp @@ -1,4 +1,4 @@ -#include "J3ML/LinearAlgebra.h" +#include "J3ML/LinearAlgebra.hpp" #include namespace LinearAlgebra { diff --git a/src/J3ML/LinearAlgebra/AxisAngle.cpp b/src/J3ML/LinearAlgebra/AxisAngle.cpp index ee7162e..98ea258 100644 --- a/src/J3ML/LinearAlgebra/AxisAngle.cpp +++ b/src/J3ML/LinearAlgebra/AxisAngle.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include namespace J3ML::LinearAlgebra { AxisAngle::AxisAngle() : axis(Vector3::Zero) {} diff --git a/src/J3ML/LinearAlgebra/CoordinateFrame.cpp b/src/J3ML/LinearAlgebra/CoordinateFrame.cpp index 9fe1765..684755a 100644 --- a/src/J3ML/LinearAlgebra/CoordinateFrame.cpp +++ b/src/J3ML/LinearAlgebra/CoordinateFrame.cpp @@ -1 +1 @@ -#include \ No newline at end of file +#include \ No newline at end of file diff --git a/src/J3ML/LinearAlgebra/EulerAngle.cpp b/src/J3ML/LinearAlgebra/EulerAngle.cpp index bc7966a..f77833e 100644 --- a/src/J3ML/LinearAlgebra/EulerAngle.cpp +++ b/src/J3ML/LinearAlgebra/EulerAngle.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/src/J3ML/LinearAlgebra/Matrix2x2.cpp b/src/J3ML/LinearAlgebra/Matrix2x2.cpp index 6fcbaa6..1fbee2c 100644 --- a/src/J3ML/LinearAlgebra/Matrix2x2.cpp +++ b/src/J3ML/LinearAlgebra/Matrix2x2.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include namespace J3ML::LinearAlgebra { diff --git a/src/J3ML/LinearAlgebra/Matrix3x3.cpp b/src/J3ML/LinearAlgebra/Matrix3x3.cpp index fa73edb..462e85c 100644 --- a/src/J3ML/LinearAlgebra/Matrix3x3.cpp +++ b/src/J3ML/LinearAlgebra/Matrix3x3.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include #include -#include -#include +#include +#include #include namespace J3ML::LinearAlgebra { diff --git a/src/J3ML/LinearAlgebra/Matrix4x4.cpp b/src/J3ML/LinearAlgebra/Matrix4x4.cpp index 6d164e6..836f4f8 100644 --- a/src/J3ML/LinearAlgebra/Matrix4x4.cpp +++ b/src/J3ML/LinearAlgebra/Matrix4x4.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/src/J3ML/LinearAlgebra/Quaternion.cpp b/src/J3ML/LinearAlgebra/Quaternion.cpp index cf22b79..b12d309 100644 --- a/src/J3ML/LinearAlgebra/Quaternion.cpp +++ b/src/J3ML/LinearAlgebra/Quaternion.cpp @@ -1,9 +1,9 @@ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace J3ML::LinearAlgebra { diff --git a/src/J3ML/LinearAlgebra/Transform2D.cpp b/src/J3ML/LinearAlgebra/Transform2D.cpp index b56ee9b..75b549b 100644 --- a/src/J3ML/LinearAlgebra/Transform2D.cpp +++ b/src/J3ML/LinearAlgebra/Transform2D.cpp @@ -1,4 +1,4 @@ -#include +#include namespace J3ML::LinearAlgebra { diff --git a/src/J3ML/LinearAlgebra/Vector2.cpp b/src/J3ML/LinearAlgebra/Vector2.cpp index abfe1b9..906aea2 100644 --- a/src/J3ML/LinearAlgebra/Vector2.cpp +++ b/src/J3ML/LinearAlgebra/Vector2.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/src/J3ML/LinearAlgebra/Vector3.cpp b/src/J3ML/LinearAlgebra/Vector3.cpp index 53f068f..08b0853 100644 --- a/src/J3ML/LinearAlgebra/Vector3.cpp +++ b/src/J3ML/LinearAlgebra/Vector3.cpp @@ -1,8 +1,8 @@ -#include +#include #include #include #include -#include +#include namespace J3ML::LinearAlgebra { diff --git a/src/J3ML/LinearAlgebra/Vector4.cpp b/src/J3ML/LinearAlgebra/Vector4.cpp index b51cff0..404b533 100644 --- a/src/J3ML/LinearAlgebra/Vector4.cpp +++ b/src/J3ML/LinearAlgebra/Vector4.cpp @@ -2,8 +2,8 @@ #pragma region vector4 -#include -#include +#include +#include #include #include diff --git a/tests/Geometry/FrustumTests.hpp b/tests/Geometry/FrustumTests.hpp index 8097001..0e68067 100644 --- a/tests/Geometry/FrustumTests.hpp +++ b/tests/Geometry/FrustumTests.hpp @@ -13,7 +13,7 @@ #include -#include +#include #include diff --git a/tests/Geometry/Geometry.hpp b/tests/Geometry/Geometry.hpp index f945f8c..4f2e5c7 100644 --- a/tests/Geometry/Geometry.hpp +++ b/tests/Geometry/Geometry.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include using J3ML::Geometry::Interval; diff --git a/tests/Geometry/OBBTests.hpp b/tests/Geometry/OBBTests.hpp new file mode 100644 index 0000000..80a15fb --- /dev/null +++ b/tests/Geometry/OBBTests.hpp @@ -0,0 +1,10 @@ +/// Josh's 3D Math Library +/// A C++20 Library for 3D Math, Computer Graphics, and Scientific Computing. +/// Developed and Maintained by Josh O'Leary @ Redacted Software. +/// Special Thanks to William Tomasine II and Maxine Hayes. +/// (c) 2024 Redacted Software +/// This work is dedicated to the public domain. + +/// @file OBBTests.hpp +/// @desc Unit tests for the Oriented Bounding Box class. +/// @edit 2024-07-23 \ No newline at end of file diff --git a/tests/Geometry/TriangleTests.hpp b/tests/Geometry/TriangleTests.hpp index 4b9d811..838efca 100644 --- a/tests/Geometry/TriangleTests.hpp +++ b/tests/Geometry/TriangleTests.hpp @@ -1,5 +1,5 @@ #include -#include +#include using J3ML::Geometry::Interval; using J3ML::Geometry::Triangle; diff --git a/tests/LinearAlgebra/Matrix2x2Tests.hpp b/tests/LinearAlgebra/Matrix2x2Tests.hpp index 62d4487..0bbf504 100644 --- a/tests/LinearAlgebra/Matrix2x2Tests.hpp +++ b/tests/LinearAlgebra/Matrix2x2Tests.hpp @@ -1,5 +1,5 @@ -#include +#include using namespace J3ML::LinearAlgebra; diff --git a/tests/LinearAlgebra/Matrix3x3Tests.hpp b/tests/LinearAlgebra/Matrix3x3Tests.hpp index 9576829..4ec5e97 100644 --- a/tests/LinearAlgebra/Matrix3x3Tests.hpp +++ b/tests/LinearAlgebra/Matrix3x3Tests.hpp @@ -1,4 +1,4 @@ -#include +#include #include using namespace J3ML::LinearAlgebra; diff --git a/tests/LinearAlgebra/Matrix4x4Tests.hpp b/tests/LinearAlgebra/Matrix4x4Tests.hpp index 64723a2..64008a1 100644 --- a/tests/LinearAlgebra/Matrix4x4Tests.hpp +++ b/tests/LinearAlgebra/Matrix4x4Tests.hpp @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include using namespace J3ML::LinearAlgebra; diff --git a/tests/LinearAlgebra/QuaternionTests.hpp b/tests/LinearAlgebra/QuaternionTests.hpp index ea49aa3..5dffd1a 100644 --- a/tests/LinearAlgebra/QuaternionTests.hpp +++ b/tests/LinearAlgebra/QuaternionTests.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include using namespace J3ML::LinearAlgebra; diff --git a/tests/LinearAlgebra/Vector2Tests.hpp b/tests/LinearAlgebra/Vector2Tests.hpp index c443bfa..efe6540 100644 --- a/tests/LinearAlgebra/Vector2Tests.hpp +++ b/tests/LinearAlgebra/Vector2Tests.hpp @@ -1,5 +1,5 @@ -#include +#include using J3ML::LinearAlgebra::Vector2; diff --git a/tests/LinearAlgebra/Vector3Tests.hpp b/tests/LinearAlgebra/Vector3Tests.hpp index eba3d2b..cbe8bdd 100644 --- a/tests/LinearAlgebra/Vector3Tests.hpp +++ b/tests/LinearAlgebra/Vector3Tests.hpp @@ -1,5 +1,5 @@ -#include +#include using J3ML::LinearAlgebra::Vector3; diff --git a/tests/LinearAlgebra/Vector4Tests.hpp b/tests/LinearAlgebra/Vector4Tests.hpp index 2375081..56bc6ed 100644 --- a/tests/LinearAlgebra/Vector4Tests.hpp +++ b/tests/LinearAlgebra/Vector4Tests.hpp @@ -1,5 +1,5 @@ -#include +#include using Vector4 = J3ML::LinearAlgebra::Vector4; diff --git a/tests/MathFuncTests.hpp b/tests/MathFuncTests.hpp index eb503a2..2260b79 100644 --- a/tests/MathFuncTests.hpp +++ b/tests/MathFuncTests.hpp @@ -13,7 +13,7 @@ #pragma once #include -#include +#include "J3ML/J3ML.hpp" inline void MathFuncTests() {