0030131: Foundation Classes - support of Linear builder for 2D BVH trees

BVH_LinearBuilder and BVH_RadixSorter now accept N==2.
NCollection_Vec2/3/4 - added missing division by vec operators.
This commit is contained in:
osa
2018-09-11 21:56:14 +03:00
committed by bugmaster
parent 7604a15365
commit d0bcf7aa9b
6 changed files with 76 additions and 29 deletions

View File

@@ -217,6 +217,14 @@ public:
return *this;
}
//! Compute per-component division.
NCollection_Vec2& operator/= (const NCollection_Vec2& theRight)
{
v[0] /= theRight.v[0];
v[1] /= theRight.v[1];
return *this;
}
//! Compute per-component multiplication by scale factor.
NCollection_Vec2 operator* (const Element_t theFactor) const
{
@@ -230,6 +238,14 @@ public:
v[1] / theInvFactor);
}
//! Compute per-component division.
friend NCollection_Vec2 operator/ (const NCollection_Vec2& theLeft,
const NCollection_Vec2& theRight)
{
return NCollection_Vec2 (theLeft.v[0] / theRight.v[0],
theLeft.v[1] / theRight.v[1]);
}
//! Computes the dot product.
Element_t Dot (const NCollection_Vec2& theOther) const
{

View File

@@ -290,6 +290,15 @@ public:
return *this;
}
//! Compute per-component division.
NCollection_Vec3& operator/= (const NCollection_Vec3& theRight)
{
v[0] /= theRight.v[0];
v[1] /= theRight.v[1];
v[2] /= theRight.v[2];
return *this;
}
//! Compute per-component division by scale factor.
NCollection_Vec3 operator/ (const Element_t theInvFactor) const
{
@@ -297,6 +306,14 @@ public:
return aResult /= theInvFactor;
}
//! Compute per-component division.
friend NCollection_Vec3 operator/ (const NCollection_Vec3& theLeft,
const NCollection_Vec3& theRight)
{
NCollection_Vec3 aResult = NCollection_Vec3 (theLeft);
return aResult /= theRight;
}
//! Computes the dot product.
Element_t Dot (const NCollection_Vec3& theOther) const
{

View File

@@ -336,6 +336,16 @@ public:
return *this;
}
//! Compute per-component division.
NCollection_Vec4& operator/= (const NCollection_Vec4& theRight)
{
v[0] /= theRight.v[0];
v[1] /= theRight.v[1];
v[2] /= theRight.v[2];
v[3] /= theRight.v[3];
return *this;
}
//! Compute per-component division by scale factor.
NCollection_Vec4 operator/ (const Element_t theInvFactor)
{
@@ -343,6 +353,14 @@ public:
return aResult /= theInvFactor;
}
//! Compute per-component division.
friend NCollection_Vec4 operator/ (const NCollection_Vec4& theLeft,
const NCollection_Vec4& theRight)
{
NCollection_Vec4 aResult = NCollection_Vec4 (theLeft);
return aResult /= theRight;
}
private:
Element_t v[4]; //!< define the vector as array to avoid structure alignment issues