keeping 1 AABB type

This commit is contained in:
2026-03-28 14:22:36 +03:00
parent 33cd3f64e4
commit d8188de736
4 changed files with 16 additions and 38 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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)
{