mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add spatial index for objects (#14631)
This commit is contained in:
parent
bed36139db
commit
a3648b0b16
17 changed files with 982 additions and 116 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "irrMath.h"
|
||||
|
||||
#include <functional>
|
||||
#include <array>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -32,6 +33,9 @@ public:
|
|||
//! Constructor with the same value for all elements
|
||||
explicit constexpr vector3d(T n) :
|
||||
X(n), Y(n), Z(n) {}
|
||||
//! Array - vector conversion
|
||||
constexpr vector3d(const std::array<T, 3> &arr) :
|
||||
X(arr[0]), Y(arr[1]), Z(arr[2]) {}
|
||||
|
||||
template <class U>
|
||||
constexpr static vector3d<T> from(const vector3d<U> &other)
|
||||
|
@ -187,6 +191,8 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
std::array<T, 3> toArray() const { return {X, Y, Z}; }
|
||||
|
||||
//! Get length of the vector.
|
||||
T getLength() const { return core::squareroot(X * X + Y * Y + Z * Z); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue