Math/Box,Rect: Add GetCorners method
This commit is contained in:
parent
5a299da930
commit
28d69ab552
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef NAZARA_MATH_BOX_HPP
|
||||
#define NAZARA_MATH_BOX_HPP
|
||||
|
||||
#include <NazaraUtils/EnumArray.hpp>
|
||||
#include <Nazara/Math/Enums.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
|
|
@ -46,6 +47,7 @@ namespace Nz
|
|||
constexpr Sphere<T> GetBoundingSphere() const;
|
||||
constexpr Vector3<T> GetCenter() const;
|
||||
constexpr Vector3<T> GetCorner(BoxCorner corner) const;
|
||||
constexpr EnumArray<BoxCorner, Vector3<T>> GetCorners() const;
|
||||
constexpr Vector3<T> GetLengths() const;
|
||||
constexpr Vector3<T> GetMaximum() const;
|
||||
constexpr Vector3<T> GetMinimum() const;
|
||||
|
|
|
|||
|
|
@ -309,6 +309,21 @@ namespace Nz
|
|||
return Vector3<T>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr EnumArray<BoxCorner, Vector3<T>> Box<T>::GetCorners() const
|
||||
{
|
||||
return {
|
||||
GetCorner(Nz::BoxCorner::FarLeftBottom),
|
||||
GetCorner(Nz::BoxCorner::FarLeftTop),
|
||||
GetCorner(Nz::BoxCorner::FarRightBottom),
|
||||
GetCorner(Nz::BoxCorner::FarRightTop),
|
||||
GetCorner(Nz::BoxCorner::NearLeftBottom),
|
||||
GetCorner(Nz::BoxCorner::NearLeftTop),
|
||||
GetCorner(Nz::BoxCorner::NearRightBottom),
|
||||
GetCorner(Nz::BoxCorner::NearRightTop)
|
||||
};
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets a Vector3 for the lengths
|
||||
* \return The lengths of the box (width, height, depth)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef NAZARA_MATH_RECT_HPP
|
||||
#define NAZARA_MATH_RECT_HPP
|
||||
|
||||
#include <NazaraUtils/EnumArray.hpp>
|
||||
#include <Nazara/Math/Enums.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <string>
|
||||
|
|
@ -41,6 +42,7 @@ namespace Nz
|
|||
|
||||
constexpr Vector2<T> GetCenter() const;
|
||||
constexpr Vector2<T> GetCorner(RectCorner corner) const;
|
||||
constexpr EnumArray<RectCorner, Vector2<T>> GetCorners() const;
|
||||
constexpr Vector2<T> GetLengths() const;
|
||||
constexpr Vector2<T> GetMaximum() const;
|
||||
constexpr Vector2<T> GetMinimum() const;
|
||||
|
|
|
|||
|
|
@ -250,6 +250,17 @@ namespace Nz
|
|||
return Vector2<T>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr EnumArray<RectCorner, Vector2<T>> Rect<T>::GetCorners() const
|
||||
{
|
||||
return {
|
||||
GetCorner(Nz::BoxCorner::LeftBottom),
|
||||
GetCorner(Nz::BoxCorner::LeftTop),
|
||||
GetCorner(Nz::BoxCorner::RightBottom),
|
||||
GetCorner(Nz::BoxCorner::RightTop)
|
||||
};
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets a Vector2 for the lengths
|
||||
* \return The lengths of the rectangle (width, height)
|
||||
|
|
|
|||
Loading…
Reference in New Issue