Math/Box: Rename FromExtends to FromExtents
This commit is contained in:
parent
5f8b7b361e
commit
aef8b01f15
|
|
@ -217,7 +217,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
obb.Update(transformMatrix);
|
obb.Update(transformMatrix);
|
||||||
|
|
||||||
aabb = Box<T>::FromExtends(obb(0), obb(1));
|
aabb = Box<T>::FromExtents(obb(0), obb(1));
|
||||||
for (unsigned int i = 2; i < 8; ++i)
|
for (unsigned int i = 2; i < 8; ++i)
|
||||||
aabb.ExtendTo(obb(i));
|
aabb.ExtendTo(obb(i));
|
||||||
}
|
}
|
||||||
|
|
@ -232,7 +232,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
obb.Update(translation);
|
obb.Update(translation);
|
||||||
|
|
||||||
aabb = Box<T>::FromExtends(obb(0), obb(1));
|
aabb = Box<T>::FromExtents(obb(0), obb(1));
|
||||||
for (unsigned int i = 2; i < 8; ++i)
|
for (unsigned int i = 2; i < 8; ++i)
|
||||||
aabb.ExtendTo(obb(i));
|
aabb.ExtendTo(obb(i));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ namespace Nz
|
||||||
constexpr bool operator!=(const Box& box) const;
|
constexpr bool operator!=(const Box& box) const;
|
||||||
|
|
||||||
static constexpr Box ApproxEqual(const Box& lhs, const Box& rhs, T maxDifference = std::numeric_limits<T>::epsilon());
|
static constexpr Box ApproxEqual(const Box& lhs, const Box& rhs, T maxDifference = std::numeric_limits<T>::epsilon());
|
||||||
static constexpr Box FromExtends(const Vector3<T>& vec1, const Vector3<T>& vec2);
|
static constexpr Box FromExtents(const Vector3<T>& vec1, const Vector3<T>& vec2);
|
||||||
static constexpr Box Lerp(const Box& from, const Box& to, T interpolation);
|
static constexpr Box Lerp(const Box& from, const Box& to, T interpolation);
|
||||||
static constexpr Box Invalid();
|
static constexpr Box Invalid();
|
||||||
static constexpr Box Zero();
|
static constexpr Box Zero();
|
||||||
|
|
|
||||||
|
|
@ -610,7 +610,7 @@ namespace Nz
|
||||||
std::abs(matrix(0,1)) * halfSize.x + std::abs(matrix(1,1)) * halfSize.y + std::abs(matrix(2,1)) * halfSize.z,
|
std::abs(matrix(0,1)) * halfSize.x + std::abs(matrix(1,1)) * halfSize.y + std::abs(matrix(2,1)) * halfSize.z,
|
||||||
std::abs(matrix(0,2)) * halfSize.x + std::abs(matrix(1,2)) * halfSize.y + std::abs(matrix(2,2)) * halfSize.z);
|
std::abs(matrix(0,2)) * halfSize.x + std::abs(matrix(1,2)) * halfSize.y + std::abs(matrix(2,2)) * halfSize.z);
|
||||||
|
|
||||||
return operator=(Boxf::FromExtends(center - halfSize, center + halfSize));
|
return operator=(Boxf::FromExtents(center - halfSize, center + halfSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -692,7 +692,7 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr Box<T> Box<T>::FromExtends(const Vector3<T>& vec1, const Vector3<T>& vec2)
|
constexpr Box<T> Box<T>::FromExtents(const Vector3<T>& vec1, const Vector3<T>& vec2)
|
||||||
{
|
{
|
||||||
Box box;
|
Box box;
|
||||||
box.x = std::min(vec1.x, vec2.x);
|
box.x = std::min(vec1.x, vec2.x);
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ namespace Nz
|
||||||
min.Minimize(corners[static_cast<BoxCorner>(i)]);
|
min.Minimize(corners[static_cast<BoxCorner>(i)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Box<T>::FromExtends(min, max);
|
return Box<T>::FromExtents(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ namespace Nz
|
||||||
if (aabb)
|
if (aabb)
|
||||||
{
|
{
|
||||||
Vector3f halfSize = radius * m_matrix.GetScale() * 0.5f;
|
Vector3f halfSize = radius * m_matrix.GetScale() * 0.5f;
|
||||||
*aabb = Boxf::FromExtends(-halfSize, halfSize);
|
*aabb = Boxf::FromExtents(-halfSize, halfSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -850,7 +850,7 @@ namespace Nz
|
||||||
|
|
||||||
if (aabb)
|
if (aabb)
|
||||||
{
|
{
|
||||||
*aabb = Boxf::FromExtends(-halfLengths, halfLengths);
|
*aabb = Boxf::FromExtents(-halfLengths, halfLengths);
|
||||||
aabb->Transform(matrix, false);
|
aabb->Transform(matrix, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -915,7 +915,7 @@ namespace Nz
|
||||||
if (aabb)
|
if (aabb)
|
||||||
{
|
{
|
||||||
Vector3f halfSize = size * matrix.GetScale() * 0.5f;
|
Vector3f halfSize = size * matrix.GetScale() * 0.5f;
|
||||||
*aabb = Boxf::FromExtends(-halfSize, halfSize);
|
*aabb = Boxf::FromExtents(-halfSize, halfSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < vertexCount; ++i)
|
for (unsigned int i = 0; i < vertexCount; ++i)
|
||||||
|
|
@ -995,7 +995,7 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aabb)
|
if (aabb)
|
||||||
*aabb = Boxf::FromExtends(matrix.Transform(Vector3f(-halfSizeX, 0.f, -halfSizeY), 0.f), matrix.Transform(Vector3f(halfSizeX, 0.f, halfSizeY), 0.f));
|
*aabb = Boxf::FromExtents(matrix.Transform(Vector3f(-halfSizeX, 0.f, -halfSizeY), 0.f), matrix.Transform(Vector3f(halfSizeX, 0.f, halfSizeY), 0.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateUvSphere(float radius, unsigned int sliceCount, unsigned int stackCount, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt32 indexOffset)
|
void GenerateUvSphere(float radius, unsigned int sliceCount, unsigned int stackCount, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt32 indexOffset)
|
||||||
|
|
@ -1048,7 +1048,7 @@ namespace Nz
|
||||||
if (aabb)
|
if (aabb)
|
||||||
{
|
{
|
||||||
Vector3f halfSize = radius * matrix.GetScale();
|
Vector3f halfSize = radius * matrix.GetScale();
|
||||||
*aabb = Boxf::FromExtends(-halfSize, halfSize);
|
*aabb = Boxf::FromExtents(-halfSize, halfSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -328,7 +328,7 @@ namespace Nz
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_frames[i].bounds = Boxf::FromExtends(min, max);
|
m_frames[i].bounds = Boxf::FromExtents(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Advance())
|
if (!Advance())
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ SCENARIO("Box", "[MATH][BOX]")
|
||||||
CHECK(secondWrongBox.Contains(0.f, 0.f, 0.f));
|
CHECK(secondWrongBox.Contains(0.f, 0.f, 0.f));
|
||||||
|
|
||||||
secondWrongBox = Nz::Boxf::Lerp(Nz::Boxf::Zero(), secondWrongBox, 0.f); // Zeroed
|
secondWrongBox = Nz::Boxf::Lerp(Nz::Boxf::Zero(), secondWrongBox, 0.f); // Zeroed
|
||||||
secondWrongBox.ExtendTo(Nz::Boxf::FromExtends(Nz::Vector3f(0.1f, 0.1f, 0.1f), Nz::Vector3f(0.9f, 0.9f, 0.9f)));
|
secondWrongBox.ExtendTo(Nz::Boxf::FromExtents(Nz::Vector3f(0.1f, 0.1f, 0.1f), Nz::Vector3f(0.9f, 0.9f, 0.9f)));
|
||||||
secondWrongBox.Translate(Nz::Vector3f(0.05f, 0.05f, 0.05f)); // Box 0.15 to 0.95
|
secondWrongBox.Translate(Nz::Vector3f(0.05f, 0.05f, 0.05f)); // Box 0.15 to 0.95
|
||||||
CHECK(firstWrongBox.Contains(secondWrongBox));
|
CHECK(firstWrongBox.Contains(secondWrongBox));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ SCENARIO("Sphere", "[MATH][SPHERE]")
|
||||||
|
|
||||||
WHEN("We get sphere from box unit and center")
|
WHEN("We get sphere from box unit and center")
|
||||||
{
|
{
|
||||||
Nz::Boxf centerUnitBox = Nz::Boxf::FromExtends(Nz::Vector3f::Unit() * -0.5f, Nz::Vector3f::Unit() * 0.5f);
|
Nz::Boxf centerUnitBox = Nz::Boxf::FromExtents(Nz::Vector3f::Unit() * -0.5f, Nz::Vector3f::Unit() * 0.5f);
|
||||||
|
|
||||||
THEN("This is equal to sphere center and radius 0.75")
|
THEN("This is equal to sphere center and radius 0.75")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue