Added Floor, Ceil, and Round functions to AZ::Vector2/3/4 (#4470)

https://github.com/o3de/o3de/issues/4216
Signed-off-by: bosnichd <bosnichd@amazon.com>
monroegm-disable-blank-issue-2
bosnichd 4 years ago committed by GitHub
parent 9786d63596
commit 29b5f4c9e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -180,6 +180,13 @@ namespace AZ
bool IsGreaterEqualThan(const Vector2& v) const;
//! @}
//! Floor/Ceil/Round functions, operate on each component individually, result will be a new Vector2.
//! @{
Vector2 GetFloor() const;
Vector2 GetCeil() const;
Vector2 GetRound() const; // Ties to even (banker's rounding)
//! @}
//! Min/Max functions, operate on each component individually, result will be a new Vector2.
//! @{
Vector2 GetMin(const Vector2& v) const;

@ -398,6 +398,24 @@ namespace AZ
}
AZ_MATH_INLINE Vector2 Vector2::GetFloor() const
{
return Vector2(Simd::Vec2::Floor(m_value));
}
AZ_MATH_INLINE Vector2 Vector2::GetCeil() const
{
return Vector2(Simd::Vec2::Ceil(m_value));
}
AZ_MATH_INLINE Vector2 Vector2::GetRound() const
{
return Vector2(Simd::Vec2::Round(m_value));
}
AZ_MATH_INLINE Vector2 Vector2::GetMin(const Vector2& v) const
{
#if AZ_TRAIT_USE_PLATFORM_SIMD_SCALAR

@ -211,6 +211,13 @@ namespace AZ
bool IsGreaterEqualThan(const Vector3& rhs) const;
//! @}
//! Floor/Ceil/Round functions, operate on each component individually, result will be a new Vector3.
//! @{
Vector3 GetFloor() const;
Vector3 GetCeil() const;
Vector3 GetRound() const; // Ties to even (banker's rounding)
//! @}
//! Min/Max functions, operate on each component individually, result will be a new Vector3.
//! @{
Vector3 GetMin(const Vector3& v) const;

@ -481,6 +481,24 @@ namespace AZ
}
AZ_MATH_INLINE Vector3 Vector3::GetFloor() const
{
return Vector3(Simd::Vec3::Floor(m_value));
}
AZ_MATH_INLINE Vector3 Vector3::GetCeil() const
{
return Vector3(Simd::Vec3::Ceil(m_value));
}
AZ_MATH_INLINE Vector3 Vector3::GetRound() const
{
return Vector3(Simd::Vec3::Round(m_value));
}
AZ_MATH_INLINE Vector3 Vector3::GetMin(const Vector3& v) const
{
#if AZ_TRAIT_USE_PLATFORM_SIMD_SCALAR

@ -189,6 +189,13 @@ namespace AZ
bool IsGreaterEqualThan(const Vector4& rhs) const;
//! @}
//! Floor/Ceil/Round functions, operate on each component individually, result will be a new Vector4.
//! @{
Vector4 GetFloor() const;
Vector4 GetCeil() const;
Vector4 GetRound() const; // Ties to even (banker's rounding)
//! @}
//! Min/Max functions, operate on each component individually, result will be a new Vector4.
//! @{
Vector4 GetMin(const Vector4& v) const;

@ -464,6 +464,24 @@ namespace AZ
}
AZ_MATH_INLINE Vector4 Vector4::GetFloor() const
{
return Vector4(Simd::Vec4::Floor(m_value));
}
AZ_MATH_INLINE Vector4 Vector4::GetCeil() const
{
return Vector4(Simd::Vec4::Ceil(m_value));
}
AZ_MATH_INLINE Vector4 Vector4::GetRound() const
{
return Vector4(Simd::Vec4::Round(m_value));
}
AZ_MATH_INLINE Vector4 Vector4::GetMin(const Vector4& v) const
{
#if AZ_TRAIT_USE_PLATFORM_SIMD_SCALAR

Loading…
Cancel
Save