mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-18 15:23:26 +00:00
keeping 1 AABB type
This commit is contained in:
@@ -12,5 +12,17 @@ namespace omath::primitives
|
||||
{
|
||||
Vector3<Type> min;
|
||||
Vector3<Type> max;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Vector3<Type> center() const noexcept
|
||||
{
|
||||
return (min + max) / static_cast<Type>(2);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Vector3<Type> extents() const noexcept
|
||||
{
|
||||
return (max - min) / static_cast<Type>(2);
|
||||
}
|
||||
};
|
||||
} // namespace omath::primitives
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "omath/linear_algebra/aabb.hpp"
|
||||
#include "omath/3d_primitives/aabb.hpp"
|
||||
#include "omath/linear_algebra/triangle.hpp"
|
||||
#include "omath/linear_algebra/vector3.hpp"
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace omath::collision
|
||||
class LineTracer final
|
||||
{
|
||||
using TriangleType = Triangle<typename RayType::VectorType>;
|
||||
using AABBType = AABB<typename RayType::VectorType>;
|
||||
using AABBType = primitives::Aabb<typename RayType::VectorType::ContainedType>;
|
||||
|
||||
public:
|
||||
LineTracer() = delete;
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// Created by Vlad on 3/25/2025.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "omath/linear_algebra/vector3.hpp"
|
||||
|
||||
namespace omath
|
||||
{
|
||||
template<class Vector = Vector3<float>>
|
||||
class AABB final
|
||||
{
|
||||
public:
|
||||
using VectorType = Vector;
|
||||
|
||||
VectorType min;
|
||||
VectorType max;
|
||||
|
||||
constexpr AABB(const VectorType& min, const VectorType& max) noexcept : min(min), max(max) {}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr VectorType center() const noexcept
|
||||
{
|
||||
return (min + max) / static_cast<typename VectorType::ContainedType>(2);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr VectorType extents() const noexcept
|
||||
{
|
||||
return (max - min) / static_cast<typename VectorType::ContainedType>(2);
|
||||
}
|
||||
};
|
||||
} // namespace omath
|
||||
@@ -2,14 +2,13 @@
|
||||
// Created by Vlad on 3/25/2025.
|
||||
//
|
||||
#include "omath/collision/line_tracer.hpp"
|
||||
#include "omath/linear_algebra/aabb.hpp"
|
||||
#include "omath/linear_algebra/vector3.hpp"
|
||||
#include "omath/3d_primitives/aabb.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using Vec3 = omath::Vector3<float>;
|
||||
using Ray = omath::collision::Ray<>;
|
||||
using LineTracer = omath::collision::LineTracer<>;
|
||||
using AABB = omath::AABB<Vec3>;
|
||||
using AABB = omath::primitives::Aabb<float>;
|
||||
|
||||
static Ray make_ray(Vec3 start, Vec3 end, bool infinite = false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user