Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AABB.hpp
Go to the documentation of this file.
1/*
2Copyright (C) 2017-2019,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef AEONGAMES_AABB_H
18#define AEONGAMES_AABB_H
24
25#include <array>
27#include "aeongames/Vector3.hpp"
29
30namespace AeonGames
31{
33 class AABB
34 {
35 public:
37 DLL AABB();
42 DLL AABB ( const Vector3& aCenter, const Vector3& aRadii );
46 DLL const Vector3& GetCenter() const;
50 DLL const Vector3& GetRadii() const;
54 DLL void SetCenter ( const Vector3& aCenter );
58 DLL void SetRadii ( const Vector3& aRadii );
63 DLL std::array<Vector3, 8> GetPoints ( const Vector3& aOffset = { 0.0f, 0.0f, 0.0f, } ) const;
65 DLL Transform GetTransform() const;
70 DLL float GetDistanceToPlane ( const Plane& aPlane ) const;
73
77 DLL AABB& operator+= ( const AABB& lhs );
79 private:
80 Vector3 mCenter{};
81 Vector3 mRadii{};
82 };
83}
84#endif
Platform-specific macros, includes, and DLL export/import definitions.
Header for Transform component class.
Header for the 3D vector class.
Axis Aligned Bounding Box class.
Definition AABB.hpp:34
DLL AABB & operator+=(const AABB &lhs)
Expand this AABB to enclose another AABB.
Definition AABB.cpp:78
DLL void SetRadii(const Vector3 &aRadii)
Set the radii (half-extents) of the AABB.
Definition AABB.cpp:41
DLL AABB()
Default constructor.
DLL Transform GetTransform() const
Get the AABB as a transform, the AABB center becomes translation and the radii becomes scale.
Definition AABB.cpp:62
DLL float GetDistanceToPlane(const Plane &aPlane) const
Returns the shortest distance from any point in the plane's surface to the support point of the AABB ...
Definition AABB.cpp:67
DLL std::array< Vector3, 8 > GetPoints(const Vector3 &aOffset={ 0.0f, 0.0f, 0.0f, }) const
Get the eight corner points of the AABB.
Definition AABB.cpp:45
DLL const Vector3 & GetRadii() const
Get the radii (half-extents) of the AABB.
Definition AABB.cpp:33
DLL const Vector3 & GetCenter() const
Get the center position of the AABB.
Definition AABB.cpp:29
DLL void SetCenter(const Vector3 &aCenter)
Set the center position of the AABB.
Definition AABB.cpp:37
Plane class.
Definition Plane.hpp:33
Component class for any object that requires space transformations.
Definition Transform.hpp:34
3D vector class.
Definition Vector3.hpp:32
<- This is here just for the literals
Definition AABB.hpp:31