Skip to content

Commit d8188de

Browse files
committed
keeping 1 AABB type
1 parent 33cd3f6 commit d8188de

4 files changed

Lines changed: 16 additions & 38 deletions

File tree

include/omath/3d_primitives/aabb.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,17 @@ namespace omath::primitives
1212
{
1313
Vector3<Type> min;
1414
Vector3<Type> max;
15+
16+
[[nodiscard]]
17+
constexpr Vector3<Type> center() const noexcept
18+
{
19+
return (min + max) / static_cast<Type>(2);
20+
}
21+
22+
[[nodiscard]]
23+
constexpr Vector3<Type> extents() const noexcept
24+
{
25+
return (max - min) / static_cast<Type>(2);
26+
}
1527
};
1628
} // namespace omath::primitives

include/omath/collision/line_tracer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44
#pragma once
55

6-
#include "omath/linear_algebra/aabb.hpp"
6+
#include "omath/3d_primitives/aabb.hpp"
77
#include "omath/linear_algebra/triangle.hpp"
88
#include "omath/linear_algebra/vector3.hpp"
99

@@ -35,7 +35,7 @@ namespace omath::collision
3535
class LineTracer final
3636
{
3737
using TriangleType = Triangle<typename RayType::VectorType>;
38-
using AABBType = AABB<typename RayType::VectorType>;
38+
using AABBType = primitives::Aabb<typename RayType::VectorType::ContainedType>;
3939

4040
public:
4141
LineTracer() = delete;

include/omath/linear_algebra/aabb.hpp

Lines changed: 0 additions & 33 deletions
This file was deleted.

tests/general/unit_test_line_tracer_aabb.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
// Created by Vlad on 3/25/2025.
33
//
44
#include "omath/collision/line_tracer.hpp"
5-
#include "omath/linear_algebra/aabb.hpp"
6-
#include "omath/linear_algebra/vector3.hpp"
5+
#include "omath/3d_primitives/aabb.hpp"
76
#include <gtest/gtest.h>
87

98
using Vec3 = omath::Vector3<float>;
109
using Ray = omath::collision::Ray<>;
1110
using LineTracer = omath::collision::LineTracer<>;
12-
using AABB = omath::AABB<Vec3>;
11+
using AABB = omath::primitives::Aabb<float>;
1312

1413
static Ray make_ray(Vec3 start, Vec3 end, bool infinite = false)
1514
{

0 commit comments

Comments
 (0)