diff --git a/src/BVH/BVH_BinnedBuilder.lxx b/src/BVH/BVH_BinnedBuilder.lxx index 3ea88cd5c0..7ad8c22e5f 100644 --- a/src/BVH/BVH_BinnedBuilder.lxx +++ b/src/BVH/BVH_BinnedBuilder.lxx @@ -165,7 +165,7 @@ void BVH_BinnedBuilder::BuildNode (BVH_Set* theSet, // Find best split for (Standard_Integer anAxis = 0; anAxis < (N < 4 ? N : 3); ++anAxis) { - if (BVH::VecComp::Get (aSize, anAxis) <= THE_NODE_MIN_SIZE) + if (BVH::VecComp::Get (aSize, anAxis) <= BVH::THE_NODE_MIN_SIZE) continue; BVH_BinVector aBins; diff --git a/src/BVH/BVH_Box.hxx b/src/BVH/BVH_Box.hxx index fc1f4a76bf..95c2d7c108 100644 --- a/src/BVH/BVH_Box.hxx +++ b/src/BVH/BVH_Box.hxx @@ -18,7 +18,9 @@ #include -//! Axis aligned bounding box (AABB). +//! Defines axis aligned bounding box (AABB) based on BVH vectors. +//! \tparam T Numeric data type +//! \tparam N Vector dimension template class BVH_Box { @@ -29,26 +31,26 @@ public: public: //! Creates uninitialized bounding box. - BVH_Box() : myInitialized (Standard_False) {} + BVH_Box() : myIsInited (Standard_False) {} //! Creates bounding box of given point. BVH_Box (const BVH_VecNt& thePoint) - : myMinPoint (thePoint), - myMaxPoint (thePoint), - myInitialized (Standard_True) {} + : myMinPoint (thePoint), + myMaxPoint (thePoint), + myIsInited (Standard_True) {} //! Creates copy of another bounding box. BVH_Box (const BVH_Box& theBox) - : myMinPoint (theBox.myMinPoint), - myMaxPoint (theBox.myMaxPoint), - myInitialized (theBox.myInitialized) {} + : myMinPoint (theBox.myMinPoint), + myMaxPoint (theBox.myMaxPoint), + myIsInited (theBox.myIsInited) {} //! Creates bounding box from corner points. BVH_Box (const BVH_VecNt& theMinPoint, const BVH_VecNt& theMaxPoint) - : myMinPoint (theMinPoint), - myMaxPoint (theMaxPoint), - myInitialized (Standard_True) {} + : myMinPoint (theMinPoint), + myMaxPoint (theMaxPoint), + myIsInited (Standard_True) {} public: @@ -85,14 +87,170 @@ public: //! Returns center of bounding box. BVH_VecNt Center() const; + //! Returns center of bounding box along the given axis. + T Center (const Standard_Integer theAxis) const; + protected: - BVH_VecNt myMinPoint; //!< Minimum point of bounding box - BVH_VecNt myMaxPoint; //!< Maximum point of bounding box - Standard_Boolean myInitialized; //!< Is bounding box valid? + BVH_VecNt myMinPoint; //!< Minimum point of bounding box + BVH_VecNt myMaxPoint; //!< Maximum point of bounding box + Standard_Boolean myIsInited; //!< Is bounding box initialized? }; +namespace BVH +{ + //! Tool class for calculating box center along the given axis. + //! \tparam T Numeric data type + //! \tparam N Vector dimension + template + struct CenterAxis + { + // Not implemented + }; + + template + struct CenterAxis + { + static T Center (const BVH_Box& theBox, const Standard_Integer theAxis) + { + if (theAxis == 0) + { + return (theBox.CornerMin().x() + theBox.CornerMax().x()) * static_cast (0.5); + } + else if (theAxis == 1) + { + return (theBox.CornerMin().y() + theBox.CornerMax().y()) * static_cast (0.5); + } + return static_cast (0.0); + } + }; + + template + struct CenterAxis + { + static T Center (const BVH_Box& theBox, const Standard_Integer theAxis) + { + if (theAxis == 0) + { + return (theBox.CornerMin().x() + theBox.CornerMax().x()) * static_cast (0.5); + } + else if (theAxis == 1) + { + return (theBox.CornerMin().y() + theBox.CornerMax().y()) * static_cast (0.5); + } + else if (theAxis == 2) + { + return (theBox.CornerMin().z() + theBox.CornerMax().z()) * static_cast (0.5); + } + return static_cast (0.0); + } + }; + + template + struct CenterAxis + { + static T Center (const BVH_Box& theBox, const Standard_Integer theAxis) + { + if (theAxis == 0) + { + return (theBox.CornerMin().x() + theBox.CornerMax().x()) * static_cast (0.5); + } + else if (theAxis == 1) + { + return (theBox.CornerMin().y() + theBox.CornerMax().y()) * static_cast (0.5); + } + else if (theAxis == 2) + { + return (theBox.CornerMin().z() + theBox.CornerMax().z()) * static_cast (0.5); + } + return static_cast (0.0); + } + }; + + //! Tool class for calculating surface area of the box. + //! \tparam T Numeric data type + //! \tparam N Vector dimension + template + struct SurfaceCalculator + { + // Not implemented + }; + + template + struct SurfaceCalculator + { + static T Area (const typename BVH_Box::BVH_VecNt& theSize) + { + return theSize.x() * theSize.y(); + } + }; + + template + struct SurfaceCalculator + { + static T Area (const typename BVH_Box::BVH_VecNt& theSize) + { + return ( theSize.x() * theSize.y() + + theSize.x() * theSize.z() + + theSize.z() * theSize.y() ) * static_cast (2.0); + } + }; + + template + struct SurfaceCalculator + { + static T Area (const typename BVH_Box::BVH_VecNt& theSize) + { + return ( theSize.x() * theSize.y() + + theSize.x() * theSize.z() + + theSize.z() * theSize.y() ) * static_cast (2.0); + } + }; + + //! Tool class for calculate component-wise vector minimum + //! and maximum (optimized version). + //! \tparam T Numeric data type + //! \tparam N Vector dimension + template + struct BoxMinMax + { + typedef typename BVH::VectorType::Type BVH_VecNt; + + static void CwiseMin (BVH_VecNt& theVec1, const BVH_VecNt& theVec2) + { + theVec1.x() = Min (theVec1.x(), theVec2.x()); + theVec1.y() = Min (theVec1.y(), theVec2.y()); + theVec1.z() = Min (theVec1.z(), theVec2.z()); + } + + static void CwiseMax (BVH_VecNt& theVec1, const BVH_VecNt& theVec2) + { + theVec1.x() = Max (theVec1.x(), theVec2.x()); + theVec1.y() = Max (theVec1.y(), theVec2.y()); + theVec1.z() = Max (theVec1.z(), theVec2.z()); + } + }; + + template + struct BoxMinMax + { + typedef typename BVH::VectorType::Type BVH_VecNt; + + static void CwiseMin (BVH_VecNt& theVec1, const BVH_VecNt& theVec2) + { + theVec1.x() = Min (theVec1.x(), theVec2.x()); + theVec1.y() = Min (theVec1.y(), theVec2.y()); + } + + static void CwiseMax (BVH_VecNt& theVec1, const BVH_VecNt& theVec2) + { + theVec1.x() = Max (theVec1.x(), theVec2.x()); + theVec1.y() = Max (theVec1.y(), theVec2.y()); + } + }; +} + #include #endif // _BVH_Box_Header diff --git a/src/BVH/BVH_Box.lxx b/src/BVH/BVH_Box.lxx index b727561018..5082c66f73 100644 --- a/src/BVH/BVH_Box.lxx +++ b/src/BVH/BVH_Box.lxx @@ -15,76 +15,6 @@ #include -namespace BVH -{ - template - struct CenterAxis { - // Not implemented - }; - - template - struct CenterAxis - { - static T Center (const BVH_Box& theBox, - const Standard_Integer theAxis) - { - if (theAxis == 0) - { - return (theBox.CornerMin().x() + theBox.CornerMax().x()) * static_cast (0.5); - } - else if (theAxis == 1) - { - return (theBox.CornerMin().y() + theBox.CornerMax().y()) * static_cast (0.5); - } - return static_cast (0.0); - } - }; - - template - struct CenterAxis - { - static T Center (const BVH_Box& theBox, - const Standard_Integer theAxis) - { - if (theAxis == 0) - { - return (theBox.CornerMin().x() + theBox.CornerMax().x()) * static_cast (0.5); - } - else if (theAxis == 1) - { - return (theBox.CornerMin().y() + theBox.CornerMax().y()) * static_cast (0.5); - } - else if (theAxis == 2) - { - return (theBox.CornerMin().z() + theBox.CornerMax().z()) * static_cast (0.5); - } - return static_cast (0.0); - } - }; - - template - struct CenterAxis - { - static T Center (const BVH_Box& theBox, - const Standard_Integer theAxis) - { - if (theAxis == 0) - { - return (theBox.CornerMin().x() + theBox.CornerMax().x()) * static_cast (0.5); - } - else if (theAxis == 1) - { - return (theBox.CornerMin().y() + theBox.CornerMax().y()) * static_cast (0.5); - } - else if (theAxis == 2) - { - return (theBox.CornerMin().z() + theBox.CornerMax().z()) * static_cast (0.5); - } - return static_cast (0.0); - } - }; -} - // ======================================================================= // function : Clear // purpose : @@ -92,7 +22,7 @@ namespace BVH template void BVH_Box::Clear() { - myInitialized = Standard_False; + myIsInited = Standard_False; } // ======================================================================= @@ -102,7 +32,7 @@ void BVH_Box::Clear() template Standard_Boolean BVH_Box::IsValid() const { - return myInitialized; + return myIsInited; } // ======================================================================= @@ -112,12 +42,12 @@ Standard_Boolean BVH_Box::IsValid() const template void BVH_Box::Add (const BVH_VecNt& thePoint) { - if (!myInitialized) + if (!myIsInited) { myMinPoint = thePoint; myMaxPoint = thePoint; - myInitialized = Standard_True; + myIsInited = Standard_True; } else { @@ -126,47 +56,6 @@ void BVH_Box::Add (const BVH_VecNt& thePoint) } } -namespace BVH -{ - template - struct BoxMinMax - { - typedef typename BVH::VectorType::Type BVH_VecNt; - - static void CwiseMin (BVH_VecNt& theVec1, const BVH_VecNt& theVec2) - { - theVec1.x() = Min (theVec1.x(), theVec2.x()); - theVec1.y() = Min (theVec1.y(), theVec2.y()); - theVec1.z() = Min (theVec1.z(), theVec2.z()); - } - - static void CwiseMax (BVH_VecNt& theVec1, const BVH_VecNt& theVec2) - { - theVec1.x() = Max (theVec1.x(), theVec2.x()); - theVec1.y() = Max (theVec1.y(), theVec2.y()); - theVec1.z() = Max (theVec1.z(), theVec2.z()); - } - }; - - template - struct BoxMinMax - { - typedef typename BVH::VectorType::Type BVH_VecNt; - - static void CwiseMin (BVH_VecNt& theVec1, const BVH_VecNt& theVec2) - { - theVec1.x() = Min (theVec1.x(), theVec2.x()); - theVec1.y() = Min (theVec1.y(), theVec2.y()); - } - - static void CwiseMax (BVH_VecNt& theVec1, const BVH_VecNt& theVec2) - { - theVec1.x() = Max (theVec1.x(), theVec2.x()); - theVec1.y() = Max (theVec1.y(), theVec2.y()); - } - }; -} - // ======================================================================= // function : Combine // purpose : @@ -174,14 +63,14 @@ namespace BVH template void BVH_Box::Combine (const BVH_Box& theBox) { - if (theBox.myInitialized) + if (theBox.myIsInited) { - if (!myInitialized) + if (!myIsInited) { myMinPoint = theBox.myMinPoint; myMaxPoint = theBox.myMaxPoint; - myInitialized = Standard_True; + myIsInited = Standard_True; } else { @@ -191,46 +80,6 @@ void BVH_Box::Combine (const BVH_Box& theBox) } } -namespace BVH -{ - template - struct SurfaceCalculator - { - // Not implemented - }; - - template - struct SurfaceCalculator - { - static T Area (const typename BVH_Box::BVH_VecNt& theSize) - { - return theSize.x() * theSize.y(); - } - }; - - template - struct SurfaceCalculator - { - static T Area (const typename BVH_Box::BVH_VecNt& theSize) - { - return ( theSize.x() * theSize.y() + - theSize.x() * theSize.z() + - theSize.z() * theSize.y() ) * static_cast (2.0); - } - }; - - template - struct SurfaceCalculator - { - static T Area (const typename BVH_Box::BVH_VecNt& theSize) - { - return ( theSize.x() * theSize.y() + - theSize.x() * theSize.z() + - theSize.z() * theSize.y() ) * static_cast (2.0); - } - }; -} - // ======================================================================= // function : Area // purpose : @@ -238,8 +87,8 @@ namespace BVH template T BVH_Box::Area() const { - return !myInitialized ? static_cast (0.0) : - BVHTools::SurfaceCalculator::Area (myMaxPoint - myMinPoint); + return !myIsInited ? static_cast (0.0) : + BVH::SurfaceCalculator::Area (myMaxPoint - myMinPoint); } // ======================================================================= @@ -301,3 +150,13 @@ typename BVH_Box::BVH_VecNt BVH_Box::Center() const { return (myMinPoint + myMaxPoint) * static_cast (0.5); } + +// ======================================================================= +// function : Center +// purpose : +// ======================================================================= +template +T BVH_Box::Center (const Standard_Integer theAxis) const +{ + return BVH::CenterAxis::Center (*this, theAxis); +} diff --git a/src/BVH/BVH_Builder.hxx b/src/BVH/BVH_Builder.hxx index 15213437c1..d42ff32b54 100644 --- a/src/BVH/BVH_Builder.hxx +++ b/src/BVH/BVH_Builder.hxx @@ -19,32 +19,35 @@ #include #include -namespace +namespace BVH { //! Minimum node size to split. const Standard_Real THE_NODE_MIN_SIZE = 1e-5; } -//! Performs building of BVH tree. +//! Performs construction of BVH tree using bounding +//! boxes (AABBs) of abstract objects. +//! \tparam T Numeric data type +//! \tparam N Vector dimension template class BVH_Builder { public: - //! Creates abstract BVH builder. + //! Creates new abstract BVH builder. BVH_Builder (const Standard_Integer theLeafNodeSize, const Standard_Integer theMaxTreeDepth); //! Releases resources of BVH builder. virtual ~BVH_Builder(); -public: - - //! Builds BVH using specified algorithm. + //! Builds BVH using specific algorithm. virtual void Build (BVH_Set* theSet, BVH_Tree* theBVH, const BVH_Box& theBox) = 0; +protected: + //! Updates depth of constructed BVH tree. void UpdateDepth (BVH_Tree* theBVH, const Standard_Integer theLevel) @@ -57,8 +60,8 @@ public: protected: - Standard_Integer myMaxTreeDepth; //!< Maximum depth of constructed BVH - Standard_Integer myLeafNodeSize; //!< Maximum number of primitives per leaf + Standard_Integer myMaxTreeDepth; //!< Maximum depth of constructed BVH + Standard_Integer myLeafNodeSize; //!< Maximum number of objects per leaf }; diff --git a/src/BVH/BVH_Geometry.hxx b/src/BVH/BVH_Geometry.hxx index 6bc38f6b88..9c2c322ed8 100644 --- a/src/BVH/BVH_Geometry.hxx +++ b/src/BVH/BVH_Geometry.hxx @@ -19,7 +19,10 @@ #include #include -//! BVH geometry as a set of abstract geometric objects. +//! BVH geometry as a set of abstract geometric objects +//! organized with bounding volume hierarchy (BVH). +//! \tparam T Numeric data type +//! \tparam N Vector dimension template class BVH_Geometry : public BVH_ObjectSet { @@ -36,16 +39,16 @@ public: //! Marks geometry as outdated. virtual void MarkDirty(); - //! Returns AABB of whole geometry. + //! Returns AABB of the whole geometry. virtual BVH_Box Box() const; - //! Returns constructed BVH tree. + //! Returns BVH tree (and builds it if necessary). virtual const NCollection_Handle >& BVH(); - //! Returns the method (builder) to construct BVH. + //! Returns the method (builder) used to construct BVH. virtual const NCollection_Handle >& Builder() const; - //! Sets the method (builder) to construct BVH. + //! Sets the method (builder) used to construct BVH. virtual void SetBuilder (NCollection_Handle >& theBuilder); protected: diff --git a/src/BVH/BVH_LinearBuilder.lxx b/src/BVH/BVH_LinearBuilder.lxx index 26a7d0d0e4..350777128a 100644 --- a/src/BVH/BVH_LinearBuilder.lxx +++ b/src/BVH/BVH_LinearBuilder.lxx @@ -149,7 +149,7 @@ namespace BVH for (Standard_Integer aPrimIdx = aData.y(); aPrimIdx <= aData.z(); ++aPrimIdx) { - const typename BVH_Box aBox = theSet->Box (aPrimIdx); + const BVH_Box aBox = theSet->Box (aPrimIdx); if (aPrimIdx == aData.y()) { @@ -179,7 +179,7 @@ Standard_Integer BVH_LinearBuilder::EmitHierachy (BVH_Tree* std::vector::iterator theStart, std::vector::iterator theFinal) { - if (theFinal - theStart > myLeafNodeSize && theBit >= 0) + if (theFinal - theStart > BVH_Builder::myLeafNodeSize && theBit >= 0) { std::vector::iterator aPosition = std::lower_bound ( theStart, theFinal, BVH_EncodedLink(), BVH::BitComparator (theBit)); diff --git a/src/BVH/BVH_Object.hxx b/src/BVH/BVH_Object.hxx index 96a36fbb70..2c36cea0fb 100644 --- a/src/BVH/BVH_Object.hxx +++ b/src/BVH/BVH_Object.hxx @@ -21,7 +21,9 @@ #include -//! Abstract geometric object. +//! Abstract geometric object bounded by BVH box. +//! \tparam T Numeric data type +//! \tparam N Vector dimension template class BVH_Object { @@ -35,21 +37,21 @@ public: public: - //! Returns AABB of geometric object. + //! Returns AABB of the geometric object. virtual BVH_Box Box() const = 0; - //! Returns properties of geometric object. + //! Returns properties of the geometric object. virtual const NCollection_Handle& Properties() const; - //! Sets properties of geometric object. + //! Sets properties of the geometric object. virtual void SetProperties (const NCollection_Handle& theProperties); - //! Marks object state as outdated. + //! Marks object state as outdated (needs BVH rebuilding). virtual void MarkDirty(); protected: - Standard_Boolean myIsDirty; //!< Marks that internal object state need to be updated + Standard_Boolean myIsDirty; //!< Marks internal object state as outdated NCollection_Handle myProperties; //!< Generic properties assigned to the object }; diff --git a/src/BVH/BVH_ObjectSet.hxx b/src/BVH/BVH_ObjectSet.hxx index 39db0089d9..20964e19cf 100644 --- a/src/BVH/BVH_ObjectSet.hxx +++ b/src/BVH/BVH_ObjectSet.hxx @@ -19,20 +19,20 @@ #include #include -#include - -//! Set of abstract geometric objects to build BVH. +//! Array of abstract entities (bounded by BVH boxes) to built BVH. +//! \tparam T Numeric data type +//! \tparam N Vector dimension template class BVH_ObjectSet : public BVH_Set { public: - //! Type for array of geometric objects. + //! Type of array of geometric objects. typedef NCollection_Vector > > BVH_ObjectList; public: - //! Creates set of geometric objects. + //! Creates new set of geometric objects. BVH_ObjectSet(); //! Releases resources of set of geometric objects. @@ -40,13 +40,13 @@ public: public: - //! Clears all geometric objects. + //! Removes all geometric objects. virtual void Clear(); - //! Returns array of geometric objects. + //! Returns reference to the array of geometric objects. BVH_ObjectList& Objects(); - //! Returns array of geometric objects. + //! Returns reference to the array of geometric objects. const BVH_ObjectList& Objects() const; public: @@ -54,13 +54,13 @@ public: //! Return total number of objects. virtual Standard_Integer Size() const; - //! Returns AABB of specified object. + //! Returns AABB of the given object. virtual BVH_Box Box (const Standard_Integer theIndex) const; - //! Returns centroid position in specified axis. + //! Returns centroid position along the given axis. virtual T Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const; - //! Swaps indices of two specified objects in the set. + //! Performs transposing the two given objects in the set. virtual void Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2); protected: diff --git a/src/BVH/BVH_ObjectSet.lxx b/src/BVH/BVH_ObjectSet.lxx index 3140af31da..87d93528d6 100644 --- a/src/BVH/BVH_ObjectSet.lxx +++ b/src/BVH/BVH_ObjectSet.lxx @@ -95,8 +95,8 @@ template T BVH_ObjectSet::Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const { - typename BVH_Set::BVH_BoxNt aBox = myObjects.Value (theIndex)->Box(); - return BVH::CenterAxis::Center (aBox, theAxis); + // Note: general implementation, not optimal + return BVH::CenterAxis::Center (myObjects.Value (theIndex)->Box(), theAxis); } // ======================================================================= @@ -107,9 +107,6 @@ template void BVH_ObjectSet::Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2) { - NCollection_Handle > anObject1 = myObjects.Value (theIndex1); - NCollection_Handle > anObject2 = myObjects.Value (theIndex2); - - myObjects.ChangeValue (theIndex1) = anObject2; - myObjects.ChangeValue (theIndex2) = anObject1; + std::swap (myObjects.ChangeValue (theIndex1), + myObjects.ChangeValue (theIndex2)); } diff --git a/src/BVH/BVH_PrimitiveSet.hxx b/src/BVH/BVH_PrimitiveSet.hxx index a1e7f4ca69..93b08a2553 100644 --- a/src/BVH/BVH_PrimitiveSet.hxx +++ b/src/BVH/BVH_PrimitiveSet.hxx @@ -19,7 +19,14 @@ #include #include -//! Set of abstract geometric primitives. +//! Set of abstract geometric primitives organized with bounding +//! volume hierarchy (BVH). Unlike an object set, this collection +//! is designed for storing structural elements of a single object +//! (such as triangles in the object triangulation). Because there +//! may be a large number of such elements, the implementations of +//! this interface should be sufficiently optimized. +//! \tparam T Numeric data type +//! \tparam N Vector dimension template class BVH_PrimitiveSet : public BVH_Object, public BVH_Set { @@ -40,13 +47,13 @@ public: //! Returns AABB of primitive set. virtual BVH_Box Box() const; - //! Returns constructed BVH tree. + //! Returns BVH tree (and builds it if necessary). virtual const NCollection_Handle >& BVH(); - //! Returns the method (builder) to construct BVH. + //! Returns the method (builder) used to construct BVH. virtual const NCollection_Handle >& Builder() const; - //! Sets the method (builder) to construct BVH. + //! Sets the method (builder) used to construct BVH. virtual void SetBuilder (NCollection_Handle >& theBuilder); protected: diff --git a/src/BVH/BVH_Set.hxx b/src/BVH/BVH_Set.hxx index 743288be56..274f09f41a 100644 --- a/src/BVH/BVH_Set.hxx +++ b/src/BVH/BVH_Set.hxx @@ -18,7 +18,10 @@ #include -//! Set of abstract entities to build BVH. +//! Set of abstract entities (bounded by BVH boxes). This is +//! the minimal geometry interface needed to construct BVH. +//! \tparam T Numeric data type +//! \tparam N Vector dimension template class BVH_Set { @@ -34,22 +37,22 @@ public: //! Releases resources of set of objects. virtual ~BVH_Set() = 0; - //! Returns AABB of entire set of objects. + //! Returns AABB of the entire set of objects. virtual BVH_Box Box() const; public: - //! Return total number of objects. + //! Returns total number of objects. virtual Standard_Integer Size() const = 0; - //! Returns AABB of specified object. + //! Returns AABB of the given object. virtual BVH_Box Box (const Standard_Integer theIndex) const = 0; - //! Returns centroid position in specified axis. + //! Returns centroid position along the given axis. virtual T Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const = 0; - //! Swaps indices of two specified objects in the set. + //! Performs transposing the two given objects in the set. virtual void Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2) = 0; diff --git a/src/BVH/BVH_SweepPlaneBuilder.lxx b/src/BVH/BVH_SweepPlaneBuilder.lxx index 1708206f2f..9454fbad36 100644 --- a/src/BVH/BVH_SweepPlaneBuilder.lxx +++ b/src/BVH/BVH_SweepPlaneBuilder.lxx @@ -70,7 +70,7 @@ void BVH_SweepPlaneBuilder::BuildNode (BVH_Set* theSet, { const T aNodeSize = BVH::VecComp::Get (theBVH->MaxPoint (theNode), anAxis) - BVH::VecComp::Get (theBVH->MinPoint (theNode), anAxis); - if (aNodeSize <= THE_NODE_MIN_SIZE) + if (aNodeSize <= BVH::THE_NODE_MIN_SIZE) { continue; } @@ -114,6 +114,9 @@ void BVH_SweepPlaneBuilder::BuildNode (BVH_Set* theSet, } } + delete [] aLftSet; + delete [] aRghSet; + if (aMinSplitAxis == -1) { return; diff --git a/src/BVH/BVH_Tree.hxx b/src/BVH/BVH_Tree.hxx index 5aeecd080a..fecaabd71d 100644 --- a/src/BVH/BVH_Tree.hxx +++ b/src/BVH/BVH_Tree.hxx @@ -50,73 +50,73 @@ public: //! Returns minimum point of the given node. BVH_VecNt& MinPoint (const Standard_Integer theNodeIndex) { - return BVH::ArrayOp::ChangeValue (myMinPointBuffer, theNodeIndex); + return BVH::Array::ChangeValue (myMinPointBuffer, theNodeIndex); } //! Returns maximum point of the given node. BVH_VecNt& MaxPoint (const Standard_Integer theNodeIndex) { - return BVH::ArrayOp::ChangeValue (myMaxPointBuffer, theNodeIndex); + return BVH::Array::ChangeValue (myMaxPointBuffer, theNodeIndex); } //! Returns minimum point of the given node. const BVH_VecNt& MinPoint (const Standard_Integer theNodeIndex) const { - return BVH::ArrayOp::Value (myMinPointBuffer, theNodeIndex); + return BVH::Array::Value (myMinPointBuffer, theNodeIndex); } //! Returns maximum point of the given node. const BVH_VecNt& MaxPoint (const Standard_Integer theNodeIndex) const { - return BVH::ArrayOp::Value (myMaxPointBuffer, theNodeIndex); + return BVH::Array::Value (myMaxPointBuffer, theNodeIndex); } //! Returns index of left child of the given inner node. Standard_Integer& LeftChild (const Standard_Integer theNodeIndex) { - return BVH::ArrayOp::ChangeValue (myNodeInfoBuffer, theNodeIndex).y(); + return BVH::Array::ChangeValue (myNodeInfoBuffer, theNodeIndex).y(); } //! Returns index of left child of the given inner node. Standard_Integer LeftChild (const Standard_Integer theNodeIndex) const { - return BVH::ArrayOp::Value (myNodeInfoBuffer, theNodeIndex).y(); + return BVH::Array::Value (myNodeInfoBuffer, theNodeIndex).y(); } //! Returns index of right child of the given inner node. Standard_Integer& RightChild (const Standard_Integer theNodeIndex) { - return BVH::ArrayOp::ChangeValue (myNodeInfoBuffer, theNodeIndex).z(); + return BVH::Array::ChangeValue (myNodeInfoBuffer, theNodeIndex).z(); } //! Returns index of right child of the given inner node. Standard_Integer RightChild (const Standard_Integer theNodeIndex) const { - return BVH::ArrayOp::Value (myNodeInfoBuffer, theNodeIndex).z(); + return BVH::Array::Value (myNodeInfoBuffer, theNodeIndex).z(); } //! Returns index of first primitive of the given leaf node. Standard_Integer& BegPrimitive (const Standard_Integer theNodeIndex) { - return BVH::ArrayOp::ChangeValue (myNodeInfoBuffer, theNodeIndex).y(); + return BVH::Array::ChangeValue (myNodeInfoBuffer, theNodeIndex).y(); } //! Returns index of first primitive of the given leaf node. Standard_Integer BegPrimitive (const Standard_Integer theNodeIndex) const { - return BVH::ArrayOp::Value (myNodeInfoBuffer, theNodeIndex).y(); + return BVH::Array::Value (myNodeInfoBuffer, theNodeIndex).y(); } //! Returns index of last primitive of the given leaf node. Standard_Integer& EndPrimitive (const Standard_Integer theNodeIndex) { - return BVH::ArrayOp::ChangeValue (myNodeInfoBuffer, theNodeIndex).z(); + return BVH::Array::ChangeValue (myNodeInfoBuffer, theNodeIndex).z(); } //! Returns index of last primitive of the given leaf node. Standard_Integer EndPrimitive (const Standard_Integer theNodeIndex) const { - return BVH::ArrayOp::Value (myNodeInfoBuffer, theNodeIndex).z(); + return BVH::Array::Value (myNodeInfoBuffer, theNodeIndex).z(); } //! Returns number of primitives for the given tree node. @@ -128,37 +128,37 @@ public: //! Returns level (depth) of the given node. Standard_Integer& Level (const Standard_Integer theNodeIndex) { - return BVH::ArrayOp::ChangeValue (myNodeInfoBuffer, theNodeIndex).w(); + return BVH::Array::ChangeValue (myNodeInfoBuffer, theNodeIndex).w(); } //! Returns level (depth) of the given node. Standard_Integer Level (const Standard_Integer theNodeIndex) const { - return BVH::ArrayOp::Value (myNodeInfoBuffer, theNodeIndex).w(); + return BVH::Array::Value (myNodeInfoBuffer, theNodeIndex).w(); } //! Is node a leaf (outer)? Standard_Boolean IsOuter (const Standard_Integer theNodeIndex) const { - return BVH::ArrayOp::Value (myNodeInfoBuffer, theNodeIndex).x() > 0; + return BVH::Array::Value (myNodeInfoBuffer, theNodeIndex).x() > 0; } //! Sets node type to 'outer'. void SetOuter (const Standard_Integer theNodeIndex) { - BVH::ArrayOp::ChangeValue (myNodeInfoBuffer, theNodeIndex).x() = 1; + BVH::Array::ChangeValue (myNodeInfoBuffer, theNodeIndex).x() = 1; } //! Sets node type to 'inner'. void SetInner (const Standard_Integer theNodeIndex) { - BVH::ArrayOp::ChangeValue (myNodeInfoBuffer, theNodeIndex).x() = 0; + BVH::Array::ChangeValue (myNodeInfoBuffer, theNodeIndex).x() = 0; } //! Returns total number of BVH nodes. Standard_Integer Length() const { - return BVH::ArrayOp::Size (myNodeInfoBuffer); + return BVH::Array::Size (myNodeInfoBuffer); } //! Returns depth of BVH tree from last build. diff --git a/src/BVH/BVH_Tree.lxx b/src/BVH/BVH_Tree.lxx index ac3d5a5dfe..e0bd7d0076 100644 --- a/src/BVH/BVH_Tree.lxx +++ b/src/BVH/BVH_Tree.lxx @@ -22,10 +22,10 @@ void BVH_Tree::Clear() { myDepth = 0; - BVH::ArrayOp::Clear (myMinPointBuffer); - BVH::ArrayOp::Clear (myMaxPointBuffer); + BVH::Array::Clear (myMinPointBuffer); + BVH::Array::Clear (myMaxPointBuffer); - BVH::ArrayOp::Clear (myNodeInfoBuffer); + BVH::Array::Clear (myNodeInfoBuffer); } // ======================================================================= @@ -36,9 +36,9 @@ template Standard_Integer BVH_Tree::AddLeafNode (const Standard_Integer theBegElem, const Standard_Integer theEndElem) { - BVH::ArrayOp::Append (myNodeInfoBuffer, BVH_Vec4i (1, theBegElem, theEndElem, 0)); + BVH::Array::Append (myNodeInfoBuffer, BVH_Vec4i (1, theBegElem, theEndElem, 0)); - return static_cast (BVH::ArrayOp::Size (myNodeInfoBuffer) - 1); + return static_cast (BVH::Array::Size (myNodeInfoBuffer) - 1); } // ======================================================================= @@ -49,9 +49,9 @@ template Standard_Integer BVH_Tree::AddInnerNode (const Standard_Integer theLftChild, const Standard_Integer theRghChild) { - BVH::ArrayOp::Append (myNodeInfoBuffer, BVH_Vec4i (0, theLftChild, theRghChild, 0)); + BVH::Array::Append (myNodeInfoBuffer, BVH_Vec4i (0, theLftChild, theRghChild, 0)); - return static_cast (BVH::ArrayOp::Size (myNodeInfoBuffer) - 1); + return static_cast (BVH::Array::Size (myNodeInfoBuffer) - 1); } // ======================================================================= @@ -64,12 +64,12 @@ Standard_Integer BVH_Tree::AddLeafNode (const BVH_VecNt& theMinPoint const Standard_Integer theBegElem, const Standard_Integer theEndElem) { - BVH::ArrayOp::Append (myMinPointBuffer, theMinPoint); - BVH::ArrayOp::Append (myMaxPointBuffer, theMaxPoint); + BVH::Array::Append (myMinPointBuffer, theMinPoint); + BVH::Array::Append (myMaxPointBuffer, theMaxPoint); - BVH::ArrayOp::Append (myNodeInfoBuffer, BVH_Vec4i (1, theBegElem, theEndElem, 0)); + BVH::Array::Append (myNodeInfoBuffer, BVH_Vec4i (1, theBegElem, theEndElem, 0)); - return static_cast (BVH::ArrayOp::Size (myNodeInfoBuffer) - 1); + return static_cast (BVH::Array::Size (myNodeInfoBuffer) - 1); } // ======================================================================= @@ -82,12 +82,12 @@ Standard_Integer BVH_Tree::AddInnerNode (const BVH_VecNt& theMinPoin const Standard_Integer theLftChild, const Standard_Integer theRghChild) { - BVH::ArrayOp::Append (myMinPointBuffer, theMinPoint); - BVH::ArrayOp::Append (myMaxPointBuffer, theMaxPoint); + BVH::Array::Append (myMinPointBuffer, theMinPoint); + BVH::Array::Append (myMaxPointBuffer, theMaxPoint); - BVH::ArrayOp::Append (myNodeInfoBuffer, BVH_Vec4i (0, theLftChild, theRghChild, 0)); + BVH::Array::Append (myNodeInfoBuffer, BVH_Vec4i (0, theLftChild, theRghChild, 0)); - return static_cast (BVH::ArrayOp::Size (myNodeInfoBuffer) - 1); + return static_cast (BVH::Array::Size (myNodeInfoBuffer) - 1); } // ======================================================================= @@ -116,10 +116,12 @@ Standard_Integer BVH_Tree::AddInnerNode (const BVH_Box& theAABB, namespace BVH { + //! Internal function for recursive calculation of + //! surface area heuristic (SAH) of the given tree. template void EstimateSAH (const BVH_Tree* theTree, const Standard_Integer theNode, - T theProbability, + T theProb, T& theSAH) { BVH_Box aBox (theTree->MinPoint (theNode), @@ -127,28 +129,28 @@ namespace BVH if (theTree->IsOuter (theNode)) { - theSAH += theProbability * (theTree->EndPrimitive (theNode) - theTree->BegPrimitive (theNode) + 1); + theSAH += theProb * (theTree->EndPrimitive (theNode) - theTree->BegPrimitive (theNode) + 1); } else { - theSAH += theProbability * static_cast (2.0); + theSAH += theProb * static_cast (2.0); BVH_Box aLftBox (theTree->MinPoint (theTree->LeftChild (theNode)), theTree->MaxPoint (theTree->LeftChild (theNode))); - if (theProbability > 0.0) + if (theProb > 0.0) { EstimateSAH (theTree, theTree->LeftChild (theNode), - theProbability * aLftBox.Area() / aBox.Area(), theSAH); + theProb * aLftBox.Area() / aBox.Area(), theSAH); } BVH_Box aRghBox (theTree->MinPoint (theTree->RightChild (theNode)), theTree->MaxPoint (theTree->RightChild (theNode))); - if (theProbability > 0.0) + if (theProb > 0.0) { EstimateSAH (theTree, theTree->RightChild (theNode), - theProbability * aRghBox.Area() / aBox.Area(), theSAH); + theProb * aRghBox.Area() / aBox.Area(), theSAH); } } } diff --git a/src/BVH/BVH_Triangulation.hxx b/src/BVH/BVH_Triangulation.hxx index f809d5f664..cd91f90827 100644 --- a/src/BVH/BVH_Triangulation.hxx +++ b/src/BVH/BVH_Triangulation.hxx @@ -18,7 +18,9 @@ #include -//! Triangulation as an example of primitive set. +//! Triangulation as an example of BVH primitive set. +//! \tparam T Numeric data type +//! \tparam N Vector dimension template class BVH_Triangulation : public BVH_PrimitiveSet { @@ -28,10 +30,10 @@ public: public: - //! Creates new triangulation. + //! Creates empty triangulation. BVH_Triangulation(); - //! Releases resources of geometric object. + //! Releases resources of triangulation. virtual ~BVH_Triangulation(); public: @@ -39,22 +41,22 @@ public: //! Array of vertex coordinates. typename BVH::ArrayType::Type Vertices; - //! Array of indices of triangle indicies vertices. + //! Array of indices of triangle vertices. BVH_Array4i Elements; public: - //! Return total number of triangles. + //! Returns total number of triangles. virtual Standard_Integer Size() const; - //! Returns AABB of specified triangle. + //! Returns AABB of the given triangle. virtual BVH_Box Box (const Standard_Integer theIndex) const; - //! Returns centroid position in specified axis. + //! Returns centroid position along the given axis. virtual T Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const; - //! Swaps indices of two specified triangles. + //! Performs transposing the two given triangles in the set. virtual void Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2); diff --git a/src/BVH/BVH_Triangulation.lxx b/src/BVH/BVH_Triangulation.lxx index 5cc9d64f26..19ff30f49c 100644 --- a/src/BVH/BVH_Triangulation.lxx +++ b/src/BVH/BVH_Triangulation.lxx @@ -40,7 +40,7 @@ BVH_Triangulation::~BVH_Triangulation() template Standard_Integer BVH_Triangulation::Size() const { - return BVH::ArrayOp::Size (Elements); + return BVH::Array::Size (Elements); } // ======================================================================= @@ -50,11 +50,11 @@ Standard_Integer BVH_Triangulation::Size() const template BVH_Box BVH_Triangulation::Box (const Standard_Integer theIndex) const { - const BVH_Vec4i& anIndex = BVH::ArrayOp::Value (Elements, theIndex); + const BVH_Vec4i& anIndex = BVH::Array::Value (Elements, theIndex); - const BVH_VecNt& aPoint0 = BVH::ArrayOp::Value (Vertices, anIndex.x()); - const BVH_VecNt& aPoint1 = BVH::ArrayOp::Value (Vertices, anIndex.y()); - const BVH_VecNt& aPoint2 = BVH::ArrayOp::Value (Vertices, anIndex.z()); + const BVH_VecNt& aPoint0 = BVH::Array::Value (Vertices, anIndex.x()); + const BVH_VecNt& aPoint1 = BVH::Array::Value (Vertices, anIndex.y()); + const BVH_VecNt& aPoint2 = BVH::Array::Value (Vertices, anIndex.z()); BVH_VecNt aMinPoint = aPoint0; BVH_VecNt aMaxPoint = aPoint0; @@ -75,11 +75,11 @@ template T BVH_Triangulation::Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const { - const BVH_Vec4i& anIndex = BVH::ArrayOp::Value (Elements, theIndex); + const BVH_Vec4i& anIndex = BVH::Array::Value (Elements, theIndex); - const BVH_VecNt& aPoint0 = BVH::ArrayOp::Value (Vertices, anIndex.x()); - const BVH_VecNt& aPoint1 = BVH::ArrayOp::Value (Vertices, anIndex.y()); - const BVH_VecNt& aPoint2 = BVH::ArrayOp::Value (Vertices, anIndex.z()); + const BVH_VecNt& aPoint0 = BVH::Array::Value (Vertices, anIndex.x()); + const BVH_VecNt& aPoint1 = BVH::Array::Value (Vertices, anIndex.y()); + const BVH_VecNt& aPoint2 = BVH::Array::Value (Vertices, anIndex.z()); return ( BVH::VecComp::Get (aPoint0, theAxis) + BVH::VecComp::Get (aPoint1, theAxis) + @@ -94,8 +94,8 @@ template void BVH_Triangulation::Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2) { - BVH_Vec4i& anIndices1 = BVH::ArrayOp::ChangeValue (Elements, theIndex1); - BVH_Vec4i& anIndices2 = BVH::ArrayOp::ChangeValue (Elements, theIndex2); + BVH_Vec4i& anIndices1 = BVH::Array::ChangeValue (Elements, theIndex1); + BVH_Vec4i& anIndices2 = BVH::Array::ChangeValue (Elements, theIndex2); std::swap (anIndices1, anIndices2); } diff --git a/src/BVH/BVH_Types.hxx b/src/BVH/BVH_Types.hxx index d67f04fc0c..afada8168a 100644 --- a/src/BVH/BVH_Types.hxx +++ b/src/BVH/BVH_Types.hxx @@ -19,18 +19,18 @@ // Use this macro to switch between STL and OCCT vector types #define _BVH_USE_STD_VECTOR_ +#include + +#include #include #include -#include #include -#include -#include - -#include namespace BVH { - //! Allows for fast switching between Eigen and NCollection vectors. + //! Tool class for selecting appropriate vector type (Eigen or NCollection). + //! \tparam T Numeric data type + //! \tparam N Component number template struct VectorType { // Not implemented @@ -56,16 +56,9 @@ namespace BVH typedef NCollection_Vec4 Type; }; - template struct ArrayType - { - #ifndef _BVH_USE_STD_VECTOR_ - typedef NCollection_Vector::Type> Type; - #else - typedef std::vector::Type> Type; - #endif - }; - - //! Allows to fast switching between Eigen and NCollection matrices. + //! Tool class for selecting appropriate matrix type (Eigen or NCollection). + //! \tparam T Numeric data type + //! \tparam N Matrix dimension template struct MatrixType { // Not implemented @@ -76,13 +69,17 @@ namespace BVH typedef NCollection_Mat4 Type; }; - template - static inline Standard_Integer IntFloor (const T theValue) + //! Tool class for selecting type of array of vectors (STD or NCollection vector). + //! \tparam T Numeric data type + //! \tparam N Component number + template struct ArrayType { - const Standard_Integer aRes = static_cast (theValue); - - return aRes - static_cast (aRes > theValue); - } + #ifndef _BVH_USE_STD_VECTOR_ + typedef NCollection_Vector::Type> Type; + #else + typedef std::vector::Type> Type; + #endif + }; } //! 2D vector of integers. @@ -133,6 +130,111 @@ typedef BVH::MatrixType::Type BVH_Mat4f; //! 4x4 matrix of double precision reals. typedef BVH::MatrixType::Type BVH_Mat4d; -#include +namespace BVH +{ + //! Tool class for accessing specific vector component (by index). + //! \tparam T Numeric data type + //! \tparam N Component number + template struct VecComp + { + // Not implemented + }; + + template struct VecComp + { + typedef typename BVH::VectorType::Type BVH_Vec2t; + + static T Get (const BVH_Vec2t& theVec, const Standard_Integer theAxis) + { + return theAxis == 0 ? theVec.x() : theVec.y(); + } + }; + + template struct VecComp + { + typedef typename BVH::VectorType::Type BVH_Vec3t; + + static T Get (const BVH_Vec3t& theVec, const Standard_Integer theAxis) + { + return theAxis == 0 ? theVec.x() : ( theAxis == 1 ? theVec.y() : theVec.z() ); + } + }; + + template struct VecComp + { + typedef typename BVH::VectorType::Type BVH_Vec4t; + + static T Get (const BVH_Vec4t& theVec, const Standard_Integer theAxis) + { + return theAxis == 0 ? theVec.x() : + (theAxis == 1 ? theVec.y() : ( theAxis == 2 ? theVec.z() : theVec.w() )); + } + }; + + //! Tool class providing typical operations on the array. It allows + //! for interoperability between STD vector and NCollection vector. + //! \tparam T Numeric data type + //! \tparam N Component number + template struct Array + { + typedef typename BVH::ArrayType::Type BVH_ArrayNt; + + static inline const typename BVH::VectorType::Type& Value ( + const BVH_ArrayNt& theArray, const Standard_Integer theIndex) + { +#ifdef _BVH_USE_STD_VECTOR_ + return theArray[theIndex]; +#else + return theArray.Value (theIndex); +#endif + } + + static inline typename BVH::VectorType::Type& ChangeValue ( + BVH_ArrayNt& theArray, const Standard_Integer theIndex) + { +#ifdef _BVH_USE_STD_VECTOR_ + return theArray[theIndex]; +#else + return theArray.ChangeValue (theIndex); +#endif + } + + static inline void Append (BVH_ArrayNt& theArray, + const typename BVH::VectorType::Type& theElement) + { +#ifdef _BVH_USE_STD_VECTOR_ + theArray.push_back (theElement); +#else + theArray.Append (theElement); +#endif + } + + static inline Standard_Integer Size (const BVH_ArrayNt& theArray) + { +#ifdef _BVH_USE_STD_VECTOR_ + return static_cast (theArray.size()); +#else + return static_cast (theArray.Size()); +#endif + } + + static inline void Clear (BVH_ArrayNt& theArray) + { +#ifdef _BVH_USE_STD_VECTOR_ + theArray.clear(); +#else + theArray.Clear(); +#endif + } + }; + + template + static inline Standard_Integer IntFloor (const T theValue) + { + const Standard_Integer aRes = static_cast (theValue); + + return aRes - static_cast (aRes > theValue); + } +} #endif // _BVH_Types_Header diff --git a/src/BVH/BVH_Types.lxx b/src/BVH/BVH_Types.lxx deleted file mode 100644 index b4d5650e76..0000000000 --- a/src/BVH/BVH_Types.lxx +++ /dev/null @@ -1,112 +0,0 @@ -// Created on: 2013-12-20 -// Created by: Denis BOGOLEPOV -// Copyright (c) 2013-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -namespace BVH -{ - template struct VecComp - { - // Not implemented - }; - - template struct VecComp - { - typedef typename BVH::VectorType::Type BVH_Vec2t; - - static T Get (const BVH_Vec2t& theVec, - const Standard_Integer theAxis) - { - return theAxis == 0 ? theVec.x() : theVec.y(); - } - }; - - template struct VecComp - { - typedef typename BVH::VectorType::Type BVH_Vec3t; - - static T Get (const BVH_Vec3t& theVec, - const Standard_Integer theAxis) - { - return theAxis == 0 ? theVec.x() : ( theAxis == 1 ? theVec.y() : theVec.z() ); - } - }; - - template struct VecComp - { - typedef typename BVH::VectorType::Type BVH_Vec4t; - - static T Get (const BVH_Vec4t& theVec, - const Standard_Integer theAxis) - { - return theAxis == 0 - ? theVec.x() - : (theAxis == 1 ? theVec.y() : ( theAxis == 2 ? theVec.z() : theVec.w() )); - } - }; - - template struct ArrayOp - { - typedef typename BVH::ArrayType::Type BVH_ArrayNt; - - static inline - const typename BVH::VectorType::Type& Value (const BVH_ArrayNt& theArray, - const Standard_Integer theIndex) - { - #ifdef _BVH_USE_STD_VECTOR_ - return theArray[theIndex]; - #else - return theArray.Value (theIndex); - #endif - } - - static inline - typename BVH::VectorType::Type& ChangeValue (BVH_ArrayNt& theArray, - const Standard_Integer theIndex) - { - #ifdef _BVH_USE_STD_VECTOR_ - return theArray[theIndex]; - #else - return theArray.ChangeValue (theIndex); - #endif - } - - static inline void Append (BVH_ArrayNt& theArray, - const typename BVH::VectorType::Type& theElement) - { - #ifdef _BVH_USE_STD_VECTOR_ - theArray.push_back (theElement); - #else - theArray.Append (theElement); - #endif - } - - static inline Standard_Integer Size (const BVH_ArrayNt& theArray) - { - #ifdef _BVH_USE_STD_VECTOR_ - return static_cast (theArray.size()); - #else - return static_cast (theArray.Size()); - #endif - } - - static inline void Clear (BVH_ArrayNt& theArray) - { - #ifdef _BVH_USE_STD_VECTOR_ - theArray.clear(); - #else - theArray.Clear(); - #endif - } - }; -} diff --git a/src/BVH/FILES b/src/BVH/FILES index c50ec7b8b5..5c73d634ef 100644 --- a/src/BVH/FILES +++ b/src/BVH/FILES @@ -31,6 +31,5 @@ BVH_Tree.lxx BVH_Triangulation.hxx BVH_Triangulation.lxx BVH_Types.hxx -BVH_Types.lxx BVH_QueueBuilder.hxx BVH_QueueBuilder.lxx