From 4ec89df6f59eefc76ed2e16ec6c0aee2f8293149 Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Mon, 23 Mar 2026 18:15:04 +0000 Subject: [PATCH] Modeling - Refactor BRepClass and FaceClassifier Implementation (#1167) - Migrated `TopClass_FaceClassifier` / `TopClass_Classifier2d` implementations to `.pxx` and updated BRepClass/Geom2dHatch wrappers to use them (removing `_0.cxx` generator glue). - Updated BRep class helper headers to use header inlines instead of separate `.lxx` files, and added/rewired passive/face classifier implementations. - Extended `NCollection_DynamicArray` / `NCollection_KDTree` APIs (insert helpers, callback-based range query) and added GTests for the new vector insert operations. --- .../TKMath/CSLib/CSLib_Class2d.cxx | 13 + .../TKMath/CSLib/CSLib_Class2d.hxx | 20 ++ .../GTests/NCollection_Vector_Test.cxx | 154 +++++++++++ .../NCollection/NCollection_DynamicArray.hxx | 111 +++++++- .../NCollection/NCollection_KDTree.hxx | 76 ++++++ .../BRepFill/BRepFill_AdvancedEvolved.cxx | 4 +- .../TKGeomAlgo/Geom2dHatch/FILES.cmake | 4 +- .../Geom2dHatch/Geom2dHatch_Classifier.cxx | 82 ++++++ .../Geom2dHatch/Geom2dHatch_Classifier.hxx | 30 +-- .../Geom2dHatch/Geom2dHatch_Classifier_0.cxx | 36 --- .../Geom2dHatch_FClass2dOfClassifier.cxx | 74 ++++++ .../Geom2dHatch_FClass2dOfClassifier.hxx | 26 +- .../Geom2dHatch_FClass2dOfClassifier_0.cxx | 30 --- .../TKGeomAlgo/TopClass/FILES.cmake | 6 +- .../TopClass/TopClass_Classifier2d.gxx | 244 ------------------ .../TopClass/TopClass_Classifier2d.lxx | 56 ---- .../TopClass/TopClass_Classifier2d.pxx | 227 ++++++++++++++++ .../TopClass/TopClass_FaceClassifier.gxx | 180 ------------- .../TopClass/TopClass_FaceClassifier.lxx | 38 --- .../TopClass/TopClass_FaceClassifier.pxx | 178 +++++++++++++ .../TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx | 31 ++- .../TKTopAlgo/BRepClass/BRepClass_Edge.hxx | 12 +- .../TKTopAlgo/BRepClass/BRepClass_Edge.lxx | 43 --- .../BRepClass_FClass2dOfFClassifier.cxx | 73 ++++++ .../BRepClass_FClass2dOfFClassifier.hxx | 26 +- .../BRepClass_FClass2dOfFClassifier_0.cxx | 30 --- .../BRepClass/BRepClass_FClassifier.cxx | 82 ++++++ .../BRepClass/BRepClass_FClassifier.hxx | 30 +-- .../BRepClass/BRepClass_FClassifier_0.cxx | 36 --- .../BRepClass/BRepClass_FaceExplorer.hxx | 10 +- .../BRepClass/BRepClass_FaceExplorer.lxx | 43 --- .../BRepClass_FacePassiveClassifier.cxx | 73 ++++++ .../BRepClass_FacePassiveClassifier.hxx | 26 +- .../BRepClass_FacePassiveClassifier_0.cxx | 30 --- .../TKTopAlgo/BRepClass/FILES.cmake | 8 +- .../BRepClass3d/BRepClass3d_SolidExplorer.cxx | 15 +- .../BRepExtrema/BRepExtrema_DistanceSS.cxx | 1 + .../BRepTopAdaptor/BRepTopAdaptor_HVertex.hxx | 6 +- .../BRepTopAdaptor/BRepTopAdaptor_HVertex.lxx | 23 -- .../TKTopAlgo/BRepTopAdaptor/FILES.cmake | 1 - .../BRepTools/BRepTools_GTrsfModification.hxx | 2 +- .../BRepTools_NurbsConvertModification.hxx | 2 +- 42 files changed, 1233 insertions(+), 959 deletions(-) create mode 100644 src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier.cxx delete mode 100644 src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier_0.cxx create mode 100644 src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier.cxx delete mode 100644 src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier_0.cxx delete mode 100644 src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.gxx delete mode 100644 src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.lxx create mode 100644 src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.pxx delete mode 100644 src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.gxx delete mode 100644 src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.lxx create mode 100644 src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.pxx delete mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Edge.lxx create mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier.cxx delete mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier_0.cxx create mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier.cxx delete mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier_0.cxx delete mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FaceExplorer.lxx create mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier.cxx delete mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier_0.cxx delete mode 100644 src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_HVertex.lxx diff --git a/src/FoundationClasses/TKMath/CSLib/CSLib_Class2d.cxx b/src/FoundationClasses/TKMath/CSLib/CSLib_Class2d.cxx index e5b1f87cf7..b1ba6eadb3 100644 --- a/src/FoundationClasses/TKMath/CSLib/CSLib_Class2d.cxx +++ b/src/FoundationClasses/TKMath/CSLib/CSLib_Class2d.cxx @@ -125,6 +125,19 @@ CSLib_Class2d::CSLib_Class2d(const NCollection_Sequence& thePnts2d, //================================================================================================= +CSLib_Class2d::CSLib_Class2d(const NCollection_Vector& thePnts2d, + const double theTolU, + const double theTolV, + const double theUMin, + const double theVMin, + const double theUMax, + const double theVMax) +{ + init(thePnts2d, theTolU, theTolV, theUMin, theVMin, theUMax, theVMax); +} + +//================================================================================================= + CSLib_Class2d::Result CSLib_Class2d::SiDans(const gp_Pnt2d& thePoint) const { if (myPointsCount == 0) diff --git a/src/FoundationClasses/TKMath/CSLib/CSLib_Class2d.hxx b/src/FoundationClasses/TKMath/CSLib/CSLib_Class2d.hxx index 5f7b2095db..d9f2a2fe47 100644 --- a/src/FoundationClasses/TKMath/CSLib/CSLib_Class2d.hxx +++ b/src/FoundationClasses/TKMath/CSLib/CSLib_Class2d.hxx @@ -22,6 +22,7 @@ #include #include #include +#include class gp_Pnt2d; @@ -90,6 +91,25 @@ public: double theUMax, double theVMax); + //! Constructs a 2D classifier from a vector of polygon vertices. + //! + //! Same as the array constructor but accepts a vector for convenience. + //! + //! @param[in] thePnts2d Vector of polygon vertices (minimum 3 points required) + //! @param[in] theTolU Tolerance in U direction for boundary detection + //! @param[in] theTolV Tolerance in V direction for boundary detection + //! @param[in] theUMin Minimum U bound of the polygon domain + //! @param[in] theVMin Minimum V bound of the polygon domain + //! @param[in] theUMax Maximum U bound of the polygon domain + //! @param[in] theVMax Maximum V bound of the polygon domain + Standard_EXPORT CSLib_Class2d(const NCollection_Vector& thePnts2d, + double theTolU, + double theTolV, + double theUMin, + double theVMin, + double theUMax, + double theVMax); + //! Move constructor. CSLib_Class2d(CSLib_Class2d&& theOther) noexcept : myPnts2dX(std::move(theOther.myPnts2dX)), diff --git a/src/FoundationClasses/TKernel/GTests/NCollection_Vector_Test.cxx b/src/FoundationClasses/TKernel/GTests/NCollection_Vector_Test.cxx index 3a2dd250d4..f8fc1ec813 100644 --- a/src/FoundationClasses/TKernel/GTests/NCollection_Vector_Test.cxx +++ b/src/FoundationClasses/TKernel/GTests/NCollection_Vector_Test.cxx @@ -644,4 +644,158 @@ TEST(NCollection_VectorTest, SetValue_ReplacesExisting) EXPECT_EQ(10, aVector(0).myA); EXPECT_EQ(200, aVector(1).myA); EXPECT_EQ(30, aVector(2).myA); +} + +TEST(NCollection_VectorTest, InsertAfter_Middle) +{ + NCollection_Vector aVector; + aVector.Append(10); + aVector.Append(20); + aVector.Append(30); + aVector.Append(40); + + // Insert 99 after index 1 (after 20): [10, 20, 99, 30, 40] + aVector.InsertAfter(1, 99); + + EXPECT_EQ(5, aVector.Length()); + EXPECT_EQ(10, aVector(0)); + EXPECT_EQ(20, aVector(1)); + EXPECT_EQ(99, aVector(2)); + EXPECT_EQ(30, aVector(3)); + EXPECT_EQ(40, aVector(4)); +} + +TEST(NCollection_VectorTest, InsertAfter_First) +{ + NCollection_Vector aVector; + aVector.Append(10); + aVector.Append(20); + aVector.Append(30); + + // Insert 99 after index 0 (after 10): [10, 99, 20, 30] + aVector.InsertAfter(0, 99); + + EXPECT_EQ(4, aVector.Length()); + EXPECT_EQ(10, aVector(0)); + EXPECT_EQ(99, aVector(1)); + EXPECT_EQ(20, aVector(2)); + EXPECT_EQ(30, aVector(3)); +} + +TEST(NCollection_VectorTest, InsertAfter_Last) +{ + NCollection_Vector aVector; + aVector.Append(10); + aVector.Append(20); + aVector.Append(30); + + // Insert 99 after last index (after 30): [10, 20, 30, 99] + aVector.InsertAfter(2, 99); + + EXPECT_EQ(4, aVector.Length()); + EXPECT_EQ(10, aVector(0)); + EXPECT_EQ(20, aVector(1)); + EXPECT_EQ(30, aVector(2)); + EXPECT_EQ(99, aVector(3)); +} + +TEST(NCollection_VectorTest, InsertAfter_SingleElement) +{ + NCollection_Vector aVector; + aVector.Append(10); + + // Insert 99 after index 0: [10, 99] + aVector.InsertAfter(0, 99); + + EXPECT_EQ(2, aVector.Length()); + EXPECT_EQ(10, aVector(0)); + EXPECT_EQ(99, aVector(1)); +} + +TEST(NCollection_VectorTest, InsertBefore_Middle) +{ + NCollection_Vector aVector; + aVector.Append(10); + aVector.Append(20); + aVector.Append(30); + aVector.Append(40); + + // Insert 99 before index 2 (before 30): [10, 20, 99, 30, 40] + aVector.InsertBefore(2, 99); + + EXPECT_EQ(5, aVector.Length()); + EXPECT_EQ(10, aVector(0)); + EXPECT_EQ(20, aVector(1)); + EXPECT_EQ(99, aVector(2)); + EXPECT_EQ(30, aVector(3)); + EXPECT_EQ(40, aVector(4)); +} + +TEST(NCollection_VectorTest, InsertBefore_First) +{ + NCollection_Vector aVector; + aVector.Append(10); + aVector.Append(20); + aVector.Append(30); + + // Insert 99 before index 0: [99, 10, 20, 30] + aVector.InsertBefore(0, 99); + + EXPECT_EQ(4, aVector.Length()); + EXPECT_EQ(99, aVector(0)); + EXPECT_EQ(10, aVector(1)); + EXPECT_EQ(20, aVector(2)); + EXPECT_EQ(30, aVector(3)); +} + +TEST(NCollection_VectorTest, InsertBefore_Last) +{ + NCollection_Vector aVector; + aVector.Append(10); + aVector.Append(20); + aVector.Append(30); + + // Insert 99 before last index (before 30): [10, 20, 99, 30] + aVector.InsertBefore(2, 99); + + EXPECT_EQ(4, aVector.Length()); + EXPECT_EQ(10, aVector(0)); + EXPECT_EQ(20, aVector(1)); + EXPECT_EQ(99, aVector(2)); + EXPECT_EQ(30, aVector(3)); +} + +TEST(NCollection_VectorTest, InsertAfter_MoveSemantics) +{ + NCollection_Vector aVector; + aVector.EmplaceAppend(10); + aVector.EmplaceAppend(20); + aVector.EmplaceAppend(30); + + // Move-insert 99 after index 1: [10, 20, 99, 30] + aVector.InsertAfter(1, VecMoveOnlyType(99)); + + EXPECT_EQ(4, aVector.Length()); + EXPECT_EQ(10, aVector(0).myValue); + EXPECT_EQ(20, aVector(1).myValue); + EXPECT_EQ(99, aVector(2).myValue); + EXPECT_EQ(30, aVector(3).myValue); +} + +TEST(NCollection_VectorTest, InsertAfter_MultipleInserts) +{ + NCollection_Vector aVector; + aVector.Append(10); + aVector.Append(40); + + // Insert 20 after 10: [10, 20, 40] + aVector.InsertAfter(0, 20); + // Insert 30 after 20: [10, 20, 30, 40] + aVector.InsertAfter(1, 30); + + EXPECT_EQ(4, aVector.Length()); + EXPECT_EQ(10, aVector(0)); + EXPECT_EQ(20, aVector(1)); + EXPECT_EQ(30, aVector(2)); + EXPECT_EQ(40, aVector(3)); } \ No newline at end of file diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_DynamicArray.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_DynamicArray.hxx index b6453f90bb..eba9d024d0 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_DynamicArray.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_DynamicArray.hxx @@ -27,7 +27,9 @@ #include #include +#include #include +#include #include //! Class NCollection_DynamicArray (dynamic array of objects) @@ -234,14 +236,73 @@ public: //! @name public methods return *aPnt; } + //! Insert a value after the element at theIndex, shifting subsequent elements right. + //! @param theIndex index after which to insert (must be in [0, Length()-1]) + //! @param theValue value to insert + //! @return reference to the inserted element + reference InsertAfter(const int theIndex, const TheItemType& theValue) + { + Standard_OutOfRange_Raise_if(theIndex < 0 || static_cast(theIndex) >= myUsedSize, + "NCollection_DynamicArray::InsertAfter: index out of range"); + // Grow by one element at the end. + Appended(); + // Shift elements [theIndex+1 .. myUsedSize-2] right by one position. + for (size_t i = myUsedSize - 1; i > static_cast(theIndex) + 1; --i) + at(i) = std::move(at(i - 1)); + at(static_cast(theIndex) + 1) = theValue; + return at(static_cast(theIndex) + 1); + } + + //! Insert a value after the element at theIndex (move version). + reference InsertAfter(const int theIndex, TheItemType&& theValue) + { + Standard_OutOfRange_Raise_if(theIndex < 0 || static_cast(theIndex) >= myUsedSize, + "NCollection_DynamicArray::InsertAfter: index out of range"); + Appended(); + for (size_t i = myUsedSize - 1; i > static_cast(theIndex) + 1; --i) + at(i) = std::move(at(i - 1)); + at(static_cast(theIndex) + 1) = std::forward(theValue); + return at(static_cast(theIndex) + 1); + } + + //! Insert a value before the element at theIndex, shifting it and subsequent elements right. + //! @param theIndex index before which to insert (must be in [0, Length()-1]) + //! @param theValue value to insert + //! @return reference to the inserted element + reference InsertBefore(const int theIndex, const TheItemType& theValue) + { + Standard_OutOfRange_Raise_if(theIndex < 0 || static_cast(theIndex) >= myUsedSize, + "NCollection_DynamicArray::InsertBefore: index out of range"); + Appended(); + for (size_t i = myUsedSize - 1; i > static_cast(theIndex); --i) + at(i) = std::move(at(i - 1)); + at(static_cast(theIndex)) = theValue; + return at(static_cast(theIndex)); + } + + //! Insert a value before the element at theIndex (move version). + reference InsertBefore(const int theIndex, TheItemType&& theValue) + { + Standard_OutOfRange_Raise_if(theIndex < 0 || static_cast(theIndex) >= myUsedSize, + "NCollection_DynamicArray::InsertBefore: index out of range"); + Appended(); + for (size_t i = myUsedSize - 1; i > static_cast(theIndex); --i) + at(i) = std::move(at(i - 1)); + at(static_cast(theIndex)) = std::forward(theValue); + return at(static_cast(theIndex)); + } + void EraseLast() { if (myUsedSize == 0) { return; } - TheItemType* aLastElem = &ChangeLast(); - myAlloc.destroy(aLastElem); + if constexpr (!std::is_trivially_destructible_v) + { + TheItemType* aLastElem = &ChangeLast(); + myAlloc.destroy(aLastElem); + } myUsedSize--; } @@ -299,7 +360,10 @@ public: //! @name public methods pointer aPnt = &at(anIndex); if (isExisting) { - myAlloc.destroy(aPnt); + if constexpr (!std::is_trivially_destructible_v) + { + myAlloc.destroy(aPnt); + } } myAlloc.construct(aPnt, std::forward(theArgs)...); return *aPnt; @@ -364,7 +428,10 @@ public: //! @name public methods pointer aPnt = &at(anIndex); if (isExisting) { - myAlloc.destroy(aPnt); + if constexpr (!std::is_trivially_destructible_v) + { + myAlloc.destroy(aPnt); + } } myAlloc.construct(aPnt, theValue); return *aPnt; @@ -392,7 +459,10 @@ public: //! @name public methods pointer aPnt = &at(anIndex); if (isExisting) { - myAlloc.destroy(aPnt); + if constexpr (!std::is_trivially_destructible_v) + { + myAlloc.destroy(aPnt); + } } myAlloc.construct(aPnt, std::forward(theValue)); return *aPnt; @@ -400,14 +470,19 @@ public: //! @name public methods void Clear(const bool theReleaseMemory = false) { - size_t aUsedSize = 0; for (size_t aBlockInd = 0; aBlockInd < myContainer.Size(); aBlockInd++) { TheItemType* aCurStart = getArray()[aBlockInd]; - for (size_t anElemInd = 0; anElemInd < myInternalSize && aUsedSize < myUsedSize; - anElemInd++, aUsedSize++) + if constexpr (!std::is_trivially_destructible_v) { - aCurStart[anElemInd].~TheItemType(); + const size_t aBlockStart = aBlockInd * myInternalSize; + const size_t aCount = (myUsedSize > aBlockStart + myInternalSize) + ? myInternalSize + : (myUsedSize > aBlockStart ? myUsedSize - aBlockStart : 0); + for (size_t anElemInd = 0; anElemInd < aCount; anElemInd++) + { + aCurStart[anElemInd].~TheItemType(); + } } if (theReleaseMemory) myAlloc.deallocate(aCurStart, myInternalSize); @@ -456,11 +531,21 @@ protected: { TheItemType* aCurStart = getArray()[aBlockInd]; TheItemType* aNewBlock = myAlloc.allocate(myInternalSize); - for (size_t anElemInd = 0; anElemInd < myInternalSize && aUsedSize < myUsedSize; - anElemInd++, aUsedSize++) + if constexpr (std::is_trivially_copyable_v) { - pointer aPnt = &aNewBlock[anElemInd]; - myAlloc.construct(aPnt, aCurStart[anElemInd]); + const size_t aCount = + (myUsedSize - aUsedSize < myInternalSize) ? myUsedSize - aUsedSize : myInternalSize; + std::memcpy(aNewBlock, aCurStart, aCount * sizeof(TheItemType)); + aUsedSize += aCount; + } + else + { + for (size_t anElemInd = 0; anElemInd < myInternalSize && aUsedSize < myUsedSize; + anElemInd++, aUsedSize++) + { + pointer aPnt = &aNewBlock[anElemInd]; + myAlloc.construct(aPnt, aCurStart[anElemInd]); + } } getArray()[aBlockInd] = aNewBlock; } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_KDTree.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_KDTree.hxx index 10bd909536..716609977f 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_KDTree.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_KDTree.hxx @@ -368,6 +368,24 @@ public: return aResult; } + //! Calls theFunctor for each point within theRadius of theQuery. + //! Zero-allocation alternative to RangeSearch - avoids DynamicArray overhead. + //! Indices passed to theFunctor are 1-based (same convention as RangeSearch). + //! @tparam Functor callable with signature void(size_t theIndex) + //! @param[in] theQuery query point + //! @param[in] theRadius search radius + //! @param[in] theFunctor callback invoked for each found 1-based index + template + void ForEachInRange(const ThePointType& theQuery, double theRadius, Functor theFunctor) const + { + if (IsEmpty() || theRadius < 0.0) + { + return; + } + const double aRadiusSq = theRadius * theRadius; + forEachInRangeRecursive(theQuery, aRadiusSq, 1, static_cast(mySize), 0, theFunctor); + } + //! Finds all points within the axis-aligned bounding box [theMin, theMax]. //! @param[in] theMin minimum corner of the box //! @param[in] theMax maximum corner of the box @@ -925,6 +943,64 @@ private: } } + //! Recursive range search (sphere) with callback - zero-allocation variant. + template + void forEachInRangeRecursive(const ThePointType& theQuery, + double theRadiusSq, + int theLo, + int theHi, + int theDepth, + Functor& theFunctor) const + { + if (theLo > theHi) + { + return; + } + if (theHi - theLo + 1 <= THE_LEAF_SIZE) + { + for (int i = theLo; i <= theHi; ++i) + { + const size_t anIdx = myIndices.Value(i); + const double aSqDist = squareDistance(theQuery, myPoints.Value(static_cast(anIdx))); + if (aSqDist <= theRadiusSq) + { + theFunctor(anIdx); + } + } + return; + } + const int aMid = (theLo + theHi) / 2; + const size_t aNodeIndex = myIndices.Value(aMid); + const ThePointType& aNodePoint = myPoints.Value(static_cast(aNodeIndex)); + const double aSqDist = squareDistance(theQuery, aNodePoint); + if (aSqDist <= theRadiusSq) + { + theFunctor(aNodeIndex); + } + if (theLo == theHi) + { + return; + } + const int aAxis = theDepth % TheDimension; + const double aDiff = theQuery.Coord(aAxis + 1) - aNodePoint.Coord(aAxis + 1); + if (aDiff <= 0.0) + { + forEachInRangeRecursive(theQuery, theRadiusSq, theLo, aMid - 1, theDepth + 1, theFunctor); + if (aDiff * aDiff <= theRadiusSq) + { + forEachInRangeRecursive(theQuery, theRadiusSq, aMid + 1, theHi, theDepth + 1, theFunctor); + } + } + else + { + forEachInRangeRecursive(theQuery, theRadiusSq, aMid + 1, theHi, theDepth + 1, theFunctor); + if (aDiff * aDiff <= theRadiusSq) + { + forEachInRangeRecursive(theQuery, theRadiusSq, theLo, aMid - 1, theDepth + 1, theFunctor); + } + } + } + //! Recursive box search (AABB) with leaf buckets. void boxSearchRecursive(const ThePointType& theMin, const ThePointType& theMax, diff --git a/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_AdvancedEvolved.cxx b/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_AdvancedEvolved.cxx index fde8378bc8..04a0575758 100644 --- a/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_AdvancedEvolved.cxx +++ b/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_AdvancedEvolved.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -456,8 +457,7 @@ void BRepFill_AdvancedEvolved::Perform(const TopoDS_Wire& theSpine, NCollection_IndexedMap aMFLids; TopExp::MapShapes(myTopBottom, TopAbs_FACE, aMFLids); - TopExp_Explorer anExp(myResult, TopAbs_FACE); - for (; anExp.More(); anExp.Next()) + for (TopExp_Explorer anExp(myResult, TopAbs_FACE); anExp.More(); anExp.Next()) { BRep_Builder aBB; if (aShell.IsNull()) diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/FILES.cmake b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/FILES.cmake index 10d6680124..5efccf859e 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/FILES.cmake +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/FILES.cmake @@ -2,15 +2,15 @@ set(OCCT_Geom2dHatch_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_Geom2dHatch_FILES + Geom2dHatch_Classifier.cxx Geom2dHatch_Classifier.hxx - Geom2dHatch_Classifier_0.cxx Geom2dHatch_Element.cxx Geom2dHatch_Element.hxx Geom2dHatch_Elements.cxx Geom2dHatch_Elements.hxx + Geom2dHatch_FClass2dOfClassifier.cxx Geom2dHatch_FClass2dOfClassifier.hxx - Geom2dHatch_FClass2dOfClassifier_0.cxx Geom2dHatch_Hatcher.cxx Geom2dHatch_Hatcher.hxx Geom2dHatch_Hatcher.lxx diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier.cxx new file mode 100644 index 0000000000..a039ed0dae --- /dev/null +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier.cxx @@ -0,0 +1,82 @@ +// Created on: 1994-02-03 +// Created by: Jean Marc LACHAUME +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-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. + +#include + +#include +#include +#include +#include +#include +#include +#include + +//================================================================================================= + +Geom2dHatch_Classifier::Geom2dHatch_Classifier() + : myEdgeParameter(0.0), + rejected(false), + nowires(true) +{ +} + +//================================================================================================= + +Geom2dHatch_Classifier::Geom2dHatch_Classifier(Geom2dHatch_Elements& F, + const gp_Pnt2d& P, + const double Tol) + : myEdgeParameter(0.0), + rejected(false), + nowires(true) +{ + Perform(F, P, Tol); +} + +//================================================================================================= + +void Geom2dHatch_Classifier::Perform(Geom2dHatch_Elements& F, const gp_Pnt2d& P, const double Tol) +{ + TopClass_FaceClassifier::Perform(rejected, + nowires, + myClassifier, + myEdge, + myPosition, + myEdgeParameter, + F, + P, + Tol); +} + +//================================================================================================= + +TopAbs_State Geom2dHatch_Classifier::State() const +{ + return TopClass_FaceClassifier::State(rejected, nowires, myClassifier); +} + +//================================================================================================= + +const Geom2dAdaptor_Curve& Geom2dHatch_Classifier::Edge() const +{ + return TopClass_FaceClassifier::Edge(rejected, myEdge); +} + +//================================================================================================= + +double Geom2dHatch_Classifier::EdgeParameter() const +{ + return TopClass_FaceClassifier::EdgeParameter(rejected, myEdgeParameter); +} diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier.hxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier.hxx index 788e7a32f6..346238d5ec 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier.hxx @@ -54,11 +54,11 @@ public: //! Returns True when the state was computed by a //! rejection. The state is OUT. - bool Rejected() const; + bool Rejected() const { return rejected; } //! Returns True if the face contains no wire. //! The state is IN. - bool NoWires() const; + bool NoWires() const { return nowires; } //! Returns the Edge used to determine the //! classification. When the State is ON this is the @@ -71,7 +71,7 @@ public: //! Returns the position of the point on the edge //! returned by Edge. - IntRes2d_Position Position() const; + IntRes2d_Position Position() const { return myPosition; } protected: Geom2dHatch_FClass2dOfClassifier myClassifier; @@ -82,28 +82,4 @@ protected: bool nowires; }; -#define TheFaceExplorer Geom2dHatch_Elements -#define TheFaceExplorer_hxx -#define TheEdge Geom2dAdaptor_Curve -#define TheEdge_hxx -#define TheIntersection2d Geom2dHatch_Intersector -#define TheIntersection2d_hxx -#define TopClass_FClass2d Geom2dHatch_FClass2dOfClassifier -#define TopClass_FClass2d_hxx -#define TopClass_FaceClassifier Geom2dHatch_Classifier -#define TopClass_FaceClassifier_hxx - -#include - -#undef TheFaceExplorer -#undef TheFaceExplorer_hxx -#undef TheEdge -#undef TheEdge_hxx -#undef TheIntersection2d -#undef TheIntersection2d_hxx -#undef TopClass_FClass2d -#undef TopClass_FClass2d_hxx -#undef TopClass_FaceClassifier -#undef TopClass_FaceClassifier_hxx - #endif // _Geom2dHatch_Classifier_HeaderFile diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier_0.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier_0.cxx deleted file mode 100644 index 578ed98314..0000000000 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_Classifier_0.cxx +++ /dev/null @@ -1,36 +0,0 @@ -// Created on: 1994-02-03 -// Created by: Jean Marc LACHAUME -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-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. - -#include - -#include -#include -#include -#include -#include -#include - -#define TheFaceExplorer Geom2dHatch_Elements -#define TheFaceExplorer_hxx -#define TheEdge Geom2dAdaptor_Curve -#define TheEdge_hxx -#define TheIntersection2d Geom2dHatch_Intersector -#define TheIntersection2d_hxx -#define TopClass_FClass2d Geom2dHatch_FClass2dOfClassifier -#define TopClass_FClass2d_hxx -#define TopClass_FaceClassifier Geom2dHatch_Classifier -#define TopClass_FaceClassifier_hxx -#include diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier.cxx new file mode 100644 index 0000000000..fd884895f7 --- /dev/null +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier.cxx @@ -0,0 +1,74 @@ +// Created on: 1994-02-03 +// Created by: Jean Marc LACHAUME +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-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. + +#include + +#include +#include +#include +#include +#include + +//================================================================================================= + +Geom2dHatch_FClass2dOfClassifier::Geom2dHatch_FClass2dOfClassifier() + : myIsSet(false), + myFirstCompare(true), + myFirstTrans(true), + myParam(0.0), + myTolerance(0.0), + myClosest(0), + myState(TopAbs_UNKNOWN), + myIsHeadOrEnd(false) +{ +} + +//================================================================================================= + +void Geom2dHatch_FClass2dOfClassifier::Reset(const gp_Lin2d& L, const double P, const double Tol) +{ + TopClass_Classifier2d::Reset(myLin, + myParam, + myTolerance, + myState, + myFirstCompare, + myFirstTrans, + myClosest, + myIsSet, + myIsHeadOrEnd, + L, + P, + Tol); +} + +//================================================================================================= + +void Geom2dHatch_FClass2dOfClassifier::Compare(const Geom2dAdaptor_Curve& E, + const TopAbs_Orientation Or) +{ + TopClass_Classifier2d::Compare(myClosest, + myIntersector, + myLin, + myParam, + myTolerance, + myState, + myFirstCompare, + myFirstTrans, + myTrans, + myIsHeadOrEnd, + E, + Or); +} diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier.hxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier.hxx index 6d002ad24b..9f1671cf24 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier.hxx @@ -51,24 +51,24 @@ public: Standard_EXPORT void Compare(const Geom2dAdaptor_Curve& E, const TopAbs_Orientation Or); //! Returns the current value of the parameter. - double Parameter() const; + double Parameter() const { return myParam; } //! Returns the intersecting algorithm. - Geom2dHatch_Intersector& Intersector(); + Geom2dHatch_Intersector& Intersector() { return myIntersector; } //! Returns 0 if the last compared edge had no //! relevant intersection. Else returns the index of //! this intersection in the last intersection //! algorithm. - int ClosestIntersection() const; + int ClosestIntersection() const { return myClosest; } //! Returns the current state of the point. - TopAbs_State State() const; + TopAbs_State State() const { return myState; } //! Returns the true if the closest intersection point //! represents head or end of the edge. Returns false //! otherwise. - bool IsHeadOrEnd() const; + bool IsHeadOrEnd() const { return myIsHeadOrEnd; } private: bool myIsSet; @@ -84,20 +84,4 @@ private: bool myIsHeadOrEnd; }; -#define TheEdge Geom2dAdaptor_Curve -#define TheEdge_hxx -#define TheIntersector Geom2dHatch_Intersector -#define TheIntersector_hxx -#define TopClass_Classifier2d Geom2dHatch_FClass2dOfClassifier -#define TopClass_Classifier2d_hxx - -#include - -#undef TheEdge -#undef TheEdge_hxx -#undef TheIntersector -#undef TheIntersector_hxx -#undef TopClass_Classifier2d -#undef TopClass_Classifier2d_hxx - #endif // _Geom2dHatch_FClass2dOfClassifier_HeaderFile diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier_0.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier_0.cxx deleted file mode 100644 index ae13f8d9d7..0000000000 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dHatch/Geom2dHatch_FClass2dOfClassifier_0.cxx +++ /dev/null @@ -1,30 +0,0 @@ -// Created on: 1994-02-03 -// Created by: Jean Marc LACHAUME -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-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. - -#include - -#include -#include -#include -#include - -#define TheEdge Geom2dAdaptor_Curve -#define TheEdge_hxx -#define TheIntersector Geom2dHatch_Intersector -#define TheIntersector_hxx -#define TopClass_Classifier2d Geom2dHatch_FClass2dOfClassifier -#define TopClass_Classifier2d_hxx -#include diff --git a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/FILES.cmake b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/FILES.cmake index 0b630b0380..225c373a74 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/FILES.cmake +++ b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/FILES.cmake @@ -2,8 +2,6 @@ set(OCCT_TopClass_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TopClass_FILES - TopClass_Classifier2d.gxx - TopClass_Classifier2d.lxx - TopClass_FaceClassifier.gxx - TopClass_FaceClassifier.lxx + TopClass_Classifier2d.pxx + TopClass_FaceClassifier.pxx ) diff --git a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.gxx b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.gxx deleted file mode 100644 index 4d008b8b5a..0000000000 --- a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.gxx +++ /dev/null @@ -1,244 +0,0 @@ -// Created on: 1992-11-17 -// Created by: Laurent BUCHARD -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-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. - -// Modified: Mon May 13 15:20:43 1996 -//-- Reinitialisation des transitions complexes - -// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 - -#include -#include -#include - -//================================================================================================= - -TopClass_Classifier2d::TopClass_Classifier2d() - : myIsSet(false), - myFirstCompare(true), - myFirstTrans(true), - myParam(0.0), - myTolerance(0.0), - myClosest(0), - myState(TopAbs_UNKNOWN), // skv OCC12627 - myIsHeadOrEnd(false) // skv OCC12627 -{ -} - -//================================================================================================= - -void TopClass_Classifier2d::Reset(const gp_Lin2d& L, const double P, const double Tol) -{ - myLin = L; - myParam = P; - myTolerance = Tol; - myState = TopAbs_UNKNOWN; - myFirstCompare = true; - myFirstTrans = true; - myClosest = 0; - myIsSet = true; - // Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin - myIsHeadOrEnd = false; - // Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End -} - -//================================================================================================= - -void TopClass_Classifier2d::Compare(const TheEdge& E, const TopAbs_Orientation Or) -{ - // intersect the edge and the segment - myClosest = 0; - myIntersector.Perform(myLin, myParam, myTolerance, E); - if (!myIntersector.IsDone()) - return; - if ((myIntersector.NbPoints() == 0) && (myIntersector.NbSegments() == 0)) - return; - - // find the closest point - int iPoint, iSegment, nbPoints, nbSegments; - - const IntRes2d_IntersectionPoint* PClosest = NULL; - - double dMin = RealLast(); - nbPoints = myIntersector.NbPoints(); - for (iPoint = 1; iPoint <= nbPoints; iPoint++) - { - const IntRes2d_IntersectionPoint& PInter = myIntersector.Point(iPoint); - // test for ON - if (PInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head) - { - myClosest = iPoint; - myState = TopAbs_ON; - return; - } - double paramfirst = PInter.ParamOnFirst(); - if (paramfirst < dMin) - { - myClosest = iPoint; - PClosest = &PInter; - dMin = paramfirst; - } - } - - // for the segments we only test the first point - nbSegments = myIntersector.NbSegments(); - for (iSegment = 1; iSegment <= nbSegments; iSegment++) - { - const IntRes2d_IntersectionSegment& SegInter = myIntersector.Segment(iSegment); - const IntRes2d_IntersectionPoint& PInter = SegInter.FirstPoint(); - if (PInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head) - { - myClosest = nbPoints + iSegment + iSegment - 1; - myState = TopAbs_ON; - return; - } - double paramfirst = PInter.ParamOnFirst(); - if (paramfirst < dMin) - { - myClosest = nbPoints + iSegment + iSegment - 1; - PClosest = &PInter; - dMin = paramfirst; - } - } - - // if no point was found return - if (myClosest == 0) - return; - - // if the Edge is INTERNAL or EXTERNAL, no problem - if (Or == TopAbs_INTERNAL) - { - myState = TopAbs_IN; - return; - } - else if (Or == TopAbs_EXTERNAL) - { - myState = TopAbs_OUT; - return; - } - - if (!myFirstCompare) - { - bool b = (dMin > myParam); - if (b) - { - // dMin > myParam : le point le plus proche (dMin) trouve dans CETTE - // intersection ligne,arete n'est pas le plus proche - // de TOUS les points d'intersection avec les autres aretes (myParam). - return; - } - } - - // process the closest point PClosest, found at dMin on line. - myFirstCompare = false; - - if (myParam > dMin) - { //-- lbr le 13 mai 96 - myFirstTrans = true; - } - - myParam = dMin; - const IntRes2d_Transition& T2 = PClosest->TransitionOfSecond(); - // Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin - // bool isHeadorEnd = (T2.PositionOnCurve() == IntRes2d_Head) || - // (T2.PositionOnCurve() == IntRes2d_End); - myIsHeadOrEnd = (T2.PositionOnCurve() == IntRes2d_Head) || (T2.PositionOnCurve() == IntRes2d_End); - // Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End - - // transition on the segment - - TopAbs_Orientation SegTrans = TopAbs_FORWARD; - - const IntRes2d_Transition& T1 = PClosest->TransitionOfFirst(); - switch (T1.TransitionType()) - { - case IntRes2d_In: - if (Or == TopAbs_REVERSED) - SegTrans = TopAbs_REVERSED; - else - SegTrans = TopAbs_FORWARD; - break; - case IntRes2d_Out: - if (Or == TopAbs_REVERSED) - SegTrans = TopAbs_FORWARD; - else - SegTrans = TopAbs_REVERSED; - break; - case IntRes2d_Touch: - switch (T1.Situation()) - { - case IntRes2d_Inside: - if (Or == TopAbs_REVERSED) - SegTrans = TopAbs_EXTERNAL; - else - SegTrans = TopAbs_INTERNAL; - break; - case IntRes2d_Outside: - if (Or == TopAbs_REVERSED) - SegTrans = TopAbs_INTERNAL; - else - SegTrans = TopAbs_EXTERNAL; - break; - case IntRes2d_Unknown: - return; - } - break; - case IntRes2d_Undecided: - return; - } - - // are we inside the Edge ? - // const IntRes2d_Transition& T2 = PClosest->TransitionOfSecond(); - if (!myIsHeadOrEnd) - { - // PClosest is inside the edge - switch (SegTrans) - { - - case TopAbs_FORWARD: - case TopAbs_EXTERNAL: - myState = TopAbs_OUT; - break; - - case TopAbs_REVERSED: - case TopAbs_INTERNAL: - myState = TopAbs_IN; - break; - } - } - else - { - // PClosest is Head or End of the edge : update the complex transition - gp_Dir2d Tang2d, Norm2d; - double Curv; - myIntersector.LocalGeometry(E, PClosest->ParamOnSecond(), Tang2d, Norm2d, Curv); - gp_Dir Tang(Tang2d.X(), Tang2d.Y(), 0.); - gp_Dir Norm(Norm2d.X(), Norm2d.Y(), 0.); - if (myFirstTrans) - { - gp_Dir D(myLin.Direction().X(), myLin.Direction().Y(), 0.); - myTrans.Reset(D); - myFirstTrans = false; - } - - TopAbs_Orientation Ort; - if (T2.PositionOnCurve() == IntRes2d_Head) - Ort = TopAbs_FORWARD; - else - Ort = TopAbs_REVERSED; - myTrans.Compare(RealEpsilon(), Tang, Norm, Curv, SegTrans, Ort); - myState = myTrans.StateBefore(); - } -} diff --git a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.lxx b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.lxx deleted file mode 100644 index 6b72cfdf17..0000000000 --- a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.lxx +++ /dev/null @@ -1,56 +0,0 @@ -// Created on: 1992-11-17 -// Created by: Remi LEQUETTE -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-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. - -// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 - -//================================================================================================= - -inline double TopClass_Classifier2d::Parameter() const -{ - return myParam; -} - -//================================================================================================= - -inline TheIntersector& TopClass_Classifier2d::Intersector() -{ - return myIntersector; -} - -//================================================================================================= - -inline int TopClass_Classifier2d::ClosestIntersection() const -{ - return myClosest; -} - -//================================================================================================= - -inline TopAbs_State TopClass_Classifier2d::State() const -{ - return myState; -} - -// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin - -//================================================================================================= - -inline bool TopClass_Classifier2d::IsHeadOrEnd() const -{ - return myIsHeadOrEnd; -} - -// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End diff --git a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.pxx b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.pxx new file mode 100644 index 0000000000..8534b7e883 --- /dev/null +++ b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_Classifier2d.pxx @@ -0,0 +1,227 @@ +// Created on: 1992-11-17 +// Created by: Laurent BUCHARD +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-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. + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace TopClass_Classifier2d +{ + +//================================================================================================= + +inline void Reset(gp_Lin2d& theLin, + double& theParam, + double& theTolerance, + TopAbs_State& theState, + bool& theFirstCompare, + bool& theFirstTrans, + int& theClosest, + bool& theIsSet, + bool& theIsHeadOrEnd, + const gp_Lin2d& theL, + const double theP, + const double theTol) +{ + theLin = theL; + theParam = theP; + theTolerance = theTol; + theState = TopAbs_UNKNOWN; + theFirstCompare = true; + theFirstTrans = true; + theClosest = 0; + theIsSet = true; + theIsHeadOrEnd = false; +} + +//================================================================================================= + +template +inline void Compare(int& theClosest, + TheIntersector& theIntersector, + const gp_Lin2d& theLin, + double& theParam, + const double theTolerance, + TopAbs_State& theState, + bool& theFirstCompare, + bool& theFirstTrans, + TopTrans_CurveTransition& theTrans, + bool& theIsHeadOrEnd, + const TheEdge& theEdge, + const TopAbs_Orientation theOr) +{ + // Intersect the edge and the segment. + theClosest = 0; + theIntersector.Perform(theLin, theParam, theTolerance, theEdge); + if (!theIntersector.IsDone()) + return; + if ((theIntersector.NbPoints() == 0) && (theIntersector.NbSegments() == 0)) + return; + + // Find the closest point. + int aPoint, aSegment, aNbPoints, aNbSegments; + + const IntRes2d_IntersectionPoint* aPClosest = nullptr; + + double aDMin = RealLast(); + aNbPoints = theIntersector.NbPoints(); + for (aPoint = 1; aPoint <= aNbPoints; aPoint++) + { + const IntRes2d_IntersectionPoint& aPInter = theIntersector.Point(aPoint); + // Test for ON. + if (aPInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head) + { + theClosest = aPoint; + theState = TopAbs_ON; + return; + } + const double aParamFirst = aPInter.ParamOnFirst(); + if (aParamFirst < aDMin) + { + theClosest = aPoint; + aPClosest = &aPInter; + aDMin = aParamFirst; + } + } + + // For the segments we only test the first point. + aNbSegments = theIntersector.NbSegments(); + for (aSegment = 1; aSegment <= aNbSegments; aSegment++) + { + const IntRes2d_IntersectionSegment& aSegInter = theIntersector.Segment(aSegment); + const IntRes2d_IntersectionPoint& aPInter = aSegInter.FirstPoint(); + if (aPInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head) + { + theClosest = aNbPoints + aSegment + aSegment - 1; + theState = TopAbs_ON; + return; + } + const double aParamFirst = aPInter.ParamOnFirst(); + if (aParamFirst < aDMin) + { + theClosest = aNbPoints + aSegment + aSegment - 1; + aPClosest = &aPInter; + aDMin = aParamFirst; + } + } + + // If no point was found return. + if (theClosest == 0) + return; + + // If the edge is INTERNAL or EXTERNAL, no problem. + if (theOr == TopAbs_INTERNAL) + { + theState = TopAbs_IN; + return; + } + else if (theOr == TopAbs_EXTERNAL) + { + theState = TopAbs_OUT; + return; + } + + if (!theFirstCompare) + { + if (aDMin > theParam) + return; + } + + // Process the closest point aPClosest, found at aDMin on line. + theFirstCompare = false; + + if (theParam > aDMin) + theFirstTrans = true; + + theParam = aDMin; + const IntRes2d_Transition& aT2 = aPClosest->TransitionOfSecond(); + theIsHeadOrEnd = + (aT2.PositionOnCurve() == IntRes2d_Head) || (aT2.PositionOnCurve() == IntRes2d_End); + + // Transition on the segment. + TopAbs_Orientation aSegTrans = TopAbs_FORWARD; + + const IntRes2d_Transition& aT1 = aPClosest->TransitionOfFirst(); + switch (aT1.TransitionType()) + { + case IntRes2d_In: + aSegTrans = (theOr == TopAbs_REVERSED) ? TopAbs_REVERSED : TopAbs_FORWARD; + break; + case IntRes2d_Out: + aSegTrans = (theOr == TopAbs_REVERSED) ? TopAbs_FORWARD : TopAbs_REVERSED; + break; + case IntRes2d_Touch: + switch (aT1.Situation()) + { + case IntRes2d_Inside: + aSegTrans = (theOr == TopAbs_REVERSED) ? TopAbs_EXTERNAL : TopAbs_INTERNAL; + break; + case IntRes2d_Outside: + aSegTrans = (theOr == TopAbs_REVERSED) ? TopAbs_INTERNAL : TopAbs_EXTERNAL; + break; + case IntRes2d_Unknown: + return; + } + break; + case IntRes2d_Undecided: + return; + } + + // Are we inside the edge? + if (!theIsHeadOrEnd) + { + // aPClosest is inside the edge. + switch (aSegTrans) + { + case TopAbs_FORWARD: + case TopAbs_EXTERNAL: + theState = TopAbs_OUT; + break; + + case TopAbs_REVERSED: + case TopAbs_INTERNAL: + theState = TopAbs_IN; + break; + } + } + else + { + // aPClosest is Head or End of the edge: update the complex transition. + gp_Dir2d aTang2d, aNorm2d; + double aCurv; + theIntersector.LocalGeometry(theEdge, aPClosest->ParamOnSecond(), aTang2d, aNorm2d, aCurv); + gp_Dir aTang(aTang2d.X(), aTang2d.Y(), 0.); + gp_Dir aNorm(aNorm2d.X(), aNorm2d.Y(), 0.); + if (theFirstTrans) + { + gp_Dir aDir(theLin.Direction().X(), theLin.Direction().Y(), 0.); + theTrans.Reset(aDir); + theFirstTrans = false; + } + + const TopAbs_Orientation aOrt = + (aT2.PositionOnCurve() == IntRes2d_Head) ? TopAbs_FORWARD : TopAbs_REVERSED; + theTrans.Compare(RealEpsilon(), aTang, aNorm, aCurv, aSegTrans, aOrt); + theState = theTrans.StateBefore(); + } +} + +} // namespace TopClass_Classifier2d diff --git a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.gxx b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.gxx deleted file mode 100644 index fe0f6cc928..0000000000 --- a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.gxx +++ /dev/null @@ -1,180 +0,0 @@ -// Created on: 1992-11-18 -// Created by: Remi LEQUETTE -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-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. - -// Modified by skv - Thu Jul 13 18:00:34 2006 OCC12627 -// The method Perform is totally rewroted. - -#include -#include - -//================================================================================================= - -TopClass_FaceClassifier::TopClass_FaceClassifier() - : myEdgeParameter(0.0), - rejected(false), - nowires(true) -{ -} - -//================================================================================================= - -TopClass_FaceClassifier::TopClass_FaceClassifier(TheFaceExplorer& FExp, - const gp_Pnt2d& P, - const double Tol) - : myEdgeParameter(0.0), - rejected(false), - nowires(true) -{ - Perform(FExp, P, Tol); -} - -//================================================================================================= - -void TopClass_FaceClassifier::Perform(TheFaceExplorer& Fexp, const gp_Pnt2d& P, const double Tol) -{ - gp_Pnt2d aPoint(P); - bool aResOfPointCheck = false; - while (aResOfPointCheck == false) - { - aResOfPointCheck = Fexp.CheckPoint(aPoint); - } - - // Test for rejection. - rejected = Fexp.Reject(aPoint); - - if (rejected) - return; - - gp_Lin2d aLine; - double aParam; - bool IsValidSegment = Fexp.Segment(aPoint, aLine, aParam); - TheEdge anEdge; - TopAbs_Orientation anEdgeOri; - int aClosestInd; - IntRes2d_IntersectionPoint aPInter; - TopAbs_State aState = TopAbs_UNKNOWN; - bool IsWReject; - bool IsEReject; - - nowires = true; - - while (IsValidSegment) - { - myClassifier.Reset(aLine, aParam, Tol); - - for (Fexp.InitWires(); Fexp.MoreWires(); Fexp.NextWire()) - { - nowires = false; - IsWReject = Fexp.RejectWire(aLine, myClassifier.Parameter()); - - if (!IsWReject) - { - // test this wire - for (Fexp.InitEdges(); Fexp.MoreEdges(); Fexp.NextEdge()) - { - IsEReject = Fexp.RejectEdge(aLine, myClassifier.Parameter()); - - if (!IsEReject) - { - // test this edge - Fexp.CurrentEdge(anEdge, anEdgeOri); - - if (anEdgeOri == TopAbs_FORWARD || anEdgeOri == TopAbs_REVERSED) - { - myClassifier.Compare(anEdge, anEdgeOri); - aClosestInd = myClassifier.ClosestIntersection(); - - if (aClosestInd != 0) - { - // save the closest edge - TheIntersection2d& anIntersector = myClassifier.Intersector(); - int aNbPnts = anIntersector.NbPoints(); - - myEdge = anEdge; - - if (aClosestInd <= aNbPnts) - { - aPInter = anIntersector.Point(aClosestInd); - } - else - { - aClosestInd -= aNbPnts; - - if (aClosestInd & 1) - { - aPInter = anIntersector.Segment((aClosestInd + 1) / 2).FirstPoint(); - } - else - { - aPInter = anIntersector.Segment((aClosestInd + 1) / 2).LastPoint(); - } - } - - myPosition = aPInter.TransitionOfSecond().PositionOnCurve(); - myEdgeParameter = aPInter.ParamOnSecond(); - } - // if we are ON, we stop - aState = myClassifier.State(); - - if (aState == TopAbs_ON) - return; - } - } - } - - // if we are out of the wire we stop - aState = myClassifier.State(); - - if (aState == TopAbs_OUT) - return; - } - } - - if (!myClassifier.IsHeadOrEnd() && aState != TopAbs_UNKNOWN) - break; - - // Bad case for classification. Trying to get another segment. - IsValidSegment = Fexp.OtherSegment(aPoint, aLine, aParam); - } -} - -//================================================================================================= - -TopAbs_State TopClass_FaceClassifier::State() const -{ - if (rejected) - return TopAbs_OUT; - else if (nowires) - return TopAbs_IN; - else - return myClassifier.State(); -} - -//================================================================================================= - -const TheEdge& TopClass_FaceClassifier::Edge() const -{ - Standard_DomainError_Raise_if(rejected, "TopClass_FaceClassifier::Edge:rejected"); - return myEdge; -} - -//================================================================================================= - -double TopClass_FaceClassifier::EdgeParameter() const -{ - Standard_DomainError_Raise_if(rejected, "TopClass_FaceClassifier::EdgeParameter:rejected"); - return myEdgeParameter; -} diff --git a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.lxx b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.lxx deleted file mode 100644 index 1ccfb6b2fb..0000000000 --- a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.lxx +++ /dev/null @@ -1,38 +0,0 @@ -// Created on: 1992-11-18 -// Created by: Remi LEQUETTE -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-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. - -#include TheFaceExplorer_hxx - -//================================================================================================= - -inline bool TopClass_FaceClassifier::Rejected() const -{ - return rejected; -} - -//================================================================================================= - -inline bool TopClass_FaceClassifier::NoWires() const -{ - return nowires; -} - -//================================================================================================= - -inline IntRes2d_Position TopClass_FaceClassifier::Position() const -{ - return myPosition; -} diff --git a/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.pxx b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.pxx new file mode 100644 index 0000000000..dd719cbd6a --- /dev/null +++ b/src/ModelingAlgorithms/TKGeomAlgo/TopClass/TopClass_FaceClassifier.pxx @@ -0,0 +1,178 @@ +// Created on: 1992-11-18 +// Created by: Remi LEQUETTE +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-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. + +#include +#include +#include +#include +#include +#include + +namespace TopClass_FaceClassifier +{ + +//================================================================================================= + +template +inline void Perform(bool& theRejected, + bool& theNoWires, + FClass2d& theClassifier, + TheEdge& theEdge, + IntRes2d_Position& thePosition, + double& theEdgeParameter, + TheFaceExplorer& theFexp, + const gp_Pnt2d& theP, + const double theTol) +{ + gp_Pnt2d aPoint(theP); + bool aResOfPointCheck = false; + while (aResOfPointCheck == false) + { + aResOfPointCheck = theFexp.CheckPoint(aPoint); + } + + // Test for rejection. + theRejected = theFexp.Reject(aPoint); + + if (theRejected) + return; + + gp_Lin2d aLine; + double aParam; + bool aIsValidSegment = theFexp.Segment(aPoint, aLine, aParam); + TheEdge anEdge; + TopAbs_Orientation anEdgeOri; + int aClosestInd; + IntRes2d_IntersectionPoint aPInter; + TopAbs_State aState = TopAbs_UNKNOWN; + bool aIsWReject; + bool aIsEReject; + + theNoWires = true; + + while (aIsValidSegment) + { + theClassifier.Reset(aLine, aParam, theTol); + + for (theFexp.InitWires(); theFexp.MoreWires(); theFexp.NextWire()) + { + theNoWires = false; + aIsWReject = theFexp.RejectWire(aLine, theClassifier.Parameter()); + + if (!aIsWReject) + { + // Test this wire. + for (theFexp.InitEdges(); theFexp.MoreEdges(); theFexp.NextEdge()) + { + aIsEReject = theFexp.RejectEdge(aLine, theClassifier.Parameter()); + + if (!aIsEReject) + { + // Test this edge. + theFexp.CurrentEdge(anEdge, anEdgeOri); + + if (anEdgeOri == TopAbs_FORWARD || anEdgeOri == TopAbs_REVERSED) + { + theClassifier.Compare(anEdge, anEdgeOri); + aClosestInd = theClassifier.ClosestIntersection(); + + if (aClosestInd != 0) + { + // Save the closest edge. + auto& anIntersector = theClassifier.Intersector(); + int aNbPnts = anIntersector.NbPoints(); + + theEdge = anEdge; + + if (aClosestInd <= aNbPnts) + { + aPInter = anIntersector.Point(aClosestInd); + } + else + { + aClosestInd -= aNbPnts; + + if (aClosestInd & 1) + { + aPInter = anIntersector.Segment((aClosestInd + 1) / 2).FirstPoint(); + } + else + { + aPInter = anIntersector.Segment((aClosestInd + 1) / 2).LastPoint(); + } + } + + thePosition = aPInter.TransitionOfSecond().PositionOnCurve(); + theEdgeParameter = aPInter.ParamOnSecond(); + } + // If we are ON, we stop. + aState = theClassifier.State(); + + if (aState == TopAbs_ON) + return; + } + } + } + + // If we are out of the wire we stop. + aState = theClassifier.State(); + + if (aState == TopAbs_OUT) + return; + } + } + + if (!theClassifier.IsHeadOrEnd() && aState != TopAbs_UNKNOWN) + break; + + // Bad case for classification. Trying to get another segment. + aIsValidSegment = theFexp.OtherSegment(aPoint, aLine, aParam); + } +} + +//================================================================================================= + +template +inline TopAbs_State State(const bool theRejected, + const bool theNoWires, + const FClass2d& theClassifier) +{ + if (theRejected) + return TopAbs_OUT; + else if (theNoWires) + return TopAbs_IN; + else + return theClassifier.State(); +} + +//================================================================================================= + +template +inline const TheEdge& Edge([[maybe_unused]] const bool theRejected, const TheEdge& theEdge) +{ + Standard_DomainError_Raise_if(theRejected, "TopClass_FaceClassifier::Edge : rejected"); + return theEdge; +} + +//================================================================================================= + +inline double EdgeParameter([[maybe_unused]] const bool theRejected, const double theEdgeParameter) +{ + Standard_DomainError_Raise_if(theRejected, "TopClass_FaceClassifier::EdgeParameter : rejected"); + return theEdgeParameter; +} + +} // namespace TopClass_FaceClassifier diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx index 765108caf1..0c30bf5b13 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx @@ -700,13 +700,42 @@ BRepCheck_Status BRepCheck_Edge::CheckPolygonOnTriangulation(const TopoDS_Edge& { NCollection_List>& aListOfCR = (*((occ::handle*)&theEdge.TShape()))->ChangeCurves(); - NCollection_List>::Iterator anITCR(aListOfCR); + bool aHasPolygonOnTriangulation = false; + bool aHasCurve3D = false; + for (NCollection_List>::Iterator anITCR(aListOfCR); + anITCR.More(); + anITCR.Next()) + { + const occ::handle& aCR = anITCR.Value(); + if (aCR->IsPolygonOnTriangulation()) + { + aHasPolygonOnTriangulation = true; + } + if (aCR->IsCurve3D() && !aCR->Curve3D().IsNull()) + { + aHasCurve3D = true; + } + + if (aHasPolygonOnTriangulation && aHasCurve3D) + { + break; + } + } + + if (!aHasPolygonOnTriangulation || !aHasCurve3D) + { + return BRepCheck_NoError; + } BRepAdaptor_Curve aBC; aBC.Initialize(theEdge); if (!aBC.Is3DCurve()) + { return BRepCheck_NoError; + } + + NCollection_List>::Iterator anITCR(aListOfCR); while (anITCR.More()) { diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Edge.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Edge.hxx index 7225cc037b..1f54e6e781 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Edge.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Edge.hxx @@ -41,12 +41,14 @@ public: Standard_EXPORT BRepClass_Edge(const TopoDS_Edge& E, const TopoDS_Face& F); //! Returns the current Edge - TopoDS_Edge& Edge(); - const TopoDS_Edge& Edge() const; + TopoDS_Edge& Edge() { return myEdge; } + + const TopoDS_Edge& Edge() const { return myEdge; } //! Returns the Face for the current Edge - TopoDS_Face& Face(); - const TopoDS_Face& Face() const; + TopoDS_Face& Face() { return myFace; } + + const TopoDS_Face& Face() const { return myFace; } //! Returns the next Edge const TopoDS_Edge& NextEdge() const { return myNextEdge; } @@ -80,6 +82,4 @@ private: bool myUseBndBox; }; -#include - #endif // _BRepClass_Edge_HeaderFile diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Edge.lxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Edge.lxx deleted file mode 100644 index 2cdc58504f..0000000000 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_Edge.lxx +++ /dev/null @@ -1,43 +0,0 @@ -// Created on: 1992-11-19 -// Created by: Remi LEQUETTE -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-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. - -//================================================================================================= - -inline TopoDS_Edge& BRepClass_Edge::Edge() -{ - return myEdge; -} - -//================================================================================================= - -inline const TopoDS_Edge& BRepClass_Edge::Edge() const -{ - return myEdge; -} - -//================================================================================================= - -inline TopoDS_Face& BRepClass_Edge::Face() -{ - return myFace; -} - -//================================================================================================= - -inline const TopoDS_Face& BRepClass_Edge::Face() const -{ - return myFace; -} diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier.cxx new file mode 100644 index 0000000000..3dedacca9c --- /dev/null +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier.cxx @@ -0,0 +1,73 @@ +// Created on: 1992-11-18 +// Created by: Remi LEQUETTE +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-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. + +#include + +#include +#include +#include +#include +#include + +//================================================================================================= + +BRepClass_FClass2dOfFClassifier::BRepClass_FClass2dOfFClassifier() + : myIsSet(false), + myFirstCompare(true), + myFirstTrans(true), + myParam(0.0), + myTolerance(0.0), + myClosest(0), + myState(TopAbs_UNKNOWN), + myIsHeadOrEnd(false) +{ +} + +//================================================================================================= + +void BRepClass_FClass2dOfFClassifier::Reset(const gp_Lin2d& L, const double P, const double Tol) +{ + TopClass_Classifier2d::Reset(myLin, + myParam, + myTolerance, + myState, + myFirstCompare, + myFirstTrans, + myClosest, + myIsSet, + myIsHeadOrEnd, + L, + P, + Tol); +} + +//================================================================================================= + +void BRepClass_FClass2dOfFClassifier::Compare(const BRepClass_Edge& E, const TopAbs_Orientation Or) +{ + TopClass_Classifier2d::Compare(myClosest, + myIntersector, + myLin, + myParam, + myTolerance, + myState, + myFirstCompare, + myFirstTrans, + myTrans, + myIsHeadOrEnd, + E, + Or); +} diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier.hxx index 58e4f89d3d..3738f75ecf 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier.hxx @@ -50,24 +50,24 @@ public: Standard_EXPORT void Compare(const BRepClass_Edge& E, const TopAbs_Orientation Or); //! Returns the current value of the parameter. - double Parameter() const; + double Parameter() const { return myParam; } //! Returns the intersecting algorithm. - BRepClass_Intersector& Intersector(); + BRepClass_Intersector& Intersector() { return myIntersector; } //! Returns 0 if the last compared edge had no //! relevant intersection. Else returns the index of //! this intersection in the last intersection //! algorithm. - int ClosestIntersection() const; + int ClosestIntersection() const { return myClosest; } //! Returns the current state of the point. - TopAbs_State State() const; + TopAbs_State State() const { return myState; } //! Returns the true if the closest intersection point //! represents head or end of the edge. Returns false //! otherwise. - bool IsHeadOrEnd() const; + bool IsHeadOrEnd() const { return myIsHeadOrEnd; } private: bool myIsSet; @@ -83,20 +83,4 @@ private: bool myIsHeadOrEnd; }; -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersector BRepClass_Intersector -#define TheIntersector_hxx -#define TopClass_Classifier2d BRepClass_FClass2dOfFClassifier -#define TopClass_Classifier2d_hxx - -#include - -#undef TheEdge -#undef TheEdge_hxx -#undef TheIntersector -#undef TheIntersector_hxx -#undef TopClass_Classifier2d -#undef TopClass_Classifier2d_hxx - #endif // _BRepClass_FClass2dOfFClassifier_HeaderFile diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier_0.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier_0.cxx deleted file mode 100644 index e06138ef61..0000000000 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClass2dOfFClassifier_0.cxx +++ /dev/null @@ -1,30 +0,0 @@ -// Created on: 1992-11-18 -// Created by: Remi LEQUETTE -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-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. - -#include - -#include -#include -#include -#include - -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersector BRepClass_Intersector -#define TheIntersector_hxx -#define TopClass_Classifier2d BRepClass_FClass2dOfFClassifier -#define TopClass_Classifier2d_hxx -#include diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier.cxx new file mode 100644 index 0000000000..94ba4cddd9 --- /dev/null +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier.cxx @@ -0,0 +1,82 @@ +// Created on: 1992-11-18 +// Created by: Remi LEQUETTE +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-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. + +#include + +#include +#include +#include +#include +#include +#include +#include + +//================================================================================================= + +BRepClass_FClassifier::BRepClass_FClassifier() + : myEdgeParameter(0.0), + rejected(false), + nowires(true) +{ +} + +//================================================================================================= + +BRepClass_FClassifier::BRepClass_FClassifier(BRepClass_FaceExplorer& F, + const gp_Pnt2d& P, + const double Tol) + : myEdgeParameter(0.0), + rejected(false), + nowires(true) +{ + Perform(F, P, Tol); +} + +//================================================================================================= + +void BRepClass_FClassifier::Perform(BRepClass_FaceExplorer& F, const gp_Pnt2d& P, const double Tol) +{ + TopClass_FaceClassifier::Perform(rejected, + nowires, + myClassifier, + myEdge, + myPosition, + myEdgeParameter, + F, + P, + Tol); +} + +//================================================================================================= + +TopAbs_State BRepClass_FClassifier::State() const +{ + return TopClass_FaceClassifier::State(rejected, nowires, myClassifier); +} + +//================================================================================================= + +const BRepClass_Edge& BRepClass_FClassifier::Edge() const +{ + return TopClass_FaceClassifier::Edge(rejected, myEdge); +} + +//================================================================================================= + +double BRepClass_FClassifier::EdgeParameter() const +{ + return TopClass_FaceClassifier::EdgeParameter(rejected, myEdgeParameter); +} diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier.hxx index 61ac06f5c2..7ff0d0b6b2 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier.hxx @@ -54,11 +54,11 @@ public: //! Returns True when the state was computed by a //! rejection. The state is OUT. - bool Rejected() const; + bool Rejected() const { return rejected; } //! Returns True if the face contains no wire. The //! state is IN. - bool NoWires() const; + bool NoWires() const { return nowires; } //! Returns the Edge used to determine the //! classification. When the State is ON this is the @@ -71,7 +71,7 @@ public: //! Returns the position of the point on the edge //! returned by Edge. - IntRes2d_Position Position() const; + IntRes2d_Position Position() const { return myPosition; } protected: BRepClass_FClass2dOfFClassifier myClassifier; @@ -82,28 +82,4 @@ protected: bool nowires; }; -#define TheFaceExplorer BRepClass_FaceExplorer -#define TheFaceExplorer_hxx -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersection2d BRepClass_Intersector -#define TheIntersection2d_hxx -#define TopClass_FClass2d BRepClass_FClass2dOfFClassifier -#define TopClass_FClass2d_hxx -#define TopClass_FaceClassifier BRepClass_FClassifier -#define TopClass_FaceClassifier_hxx - -#include - -#undef TheFaceExplorer -#undef TheFaceExplorer_hxx -#undef TheEdge -#undef TheEdge_hxx -#undef TheIntersection2d -#undef TheIntersection2d_hxx -#undef TopClass_FClass2d -#undef TopClass_FClass2d_hxx -#undef TopClass_FaceClassifier -#undef TopClass_FaceClassifier_hxx - #endif // _BRepClass_FClassifier_HeaderFile diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier_0.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier_0.cxx deleted file mode 100644 index bf2db10e93..0000000000 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FClassifier_0.cxx +++ /dev/null @@ -1,36 +0,0 @@ -// Created on: 1992-11-18 -// Created by: Remi LEQUETTE -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-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. - -#include - -#include -#include -#include -#include -#include -#include - -#define TheFaceExplorer BRepClass_FaceExplorer -#define TheFaceExplorer_hxx -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersection2d BRepClass_Intersector -#define TheIntersection2d_hxx -#define TopClass_FClass2d BRepClass_FClass2dOfFClassifier -#define TopClass_FClass2d_hxx -#define TopClass_FaceClassifier BRepClass_FClassifier -#define TopClass_FaceClassifier_hxx -#include diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FaceExplorer.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FaceExplorer.hxx index a00b2dbb76..761f815e62 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FaceExplorer.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FaceExplorer.hxx @@ -65,10 +65,10 @@ public: Standard_EXPORT void InitWires(); //! Returns True if there is a current wire. - bool MoreWires() const; + bool MoreWires() const { return myWExplorer.More(); } //! Sets the explorer to the next wire. - void NextWire(); + void NextWire() { myWExplorer.Next(); } //! Returns True if the wire bounding volume does not //! intersect the segment. @@ -79,10 +79,10 @@ public: Standard_EXPORT void InitEdges(); //! Returns True if there is a current edge. - bool MoreEdges() const; + bool MoreEdges() const { return myEExplorer.More(); } //! Sets the explorer to the next edge. - void NextEdge(); + void NextEdge() { myEExplorer.Next(); } //! Returns True if the edge bounding volume does not //! intersect the segment. @@ -127,6 +127,4 @@ private: double myVMax; }; -#include - #endif // _BRepClass_FaceExplorer_HeaderFile diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FaceExplorer.lxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FaceExplorer.lxx deleted file mode 100644 index b283a81de0..0000000000 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FaceExplorer.lxx +++ /dev/null @@ -1,43 +0,0 @@ -// Created on: 1993-01-25 -// Created by: Remi LEQUETTE -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-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. - -//================================================================================================= - -inline bool BRepClass_FaceExplorer::MoreWires() const -{ - return myWExplorer.More(); -} - -//================================================================================================= - -inline void BRepClass_FaceExplorer::NextWire() -{ - myWExplorer.Next(); -} - -//================================================================================================= - -inline bool BRepClass_FaceExplorer::MoreEdges() const -{ - return myEExplorer.More(); -} - -//================================================================================================= - -inline void BRepClass_FaceExplorer::NextEdge() -{ - myEExplorer.Next(); -} diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier.cxx new file mode 100644 index 0000000000..2fec4fdee6 --- /dev/null +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier.cxx @@ -0,0 +1,73 @@ +// Created on: 1992-11-18 +// Created by: Remi LEQUETTE +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-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. + +#include + +#include +#include +#include +#include +#include + +//================================================================================================= + +BRepClass_FacePassiveClassifier::BRepClass_FacePassiveClassifier() + : myIsSet(false), + myFirstCompare(true), + myFirstTrans(true), + myParam(0.0), + myTolerance(0.0), + myClosest(0), + myState(TopAbs_UNKNOWN), + myIsHeadOrEnd(false) +{ +} + +//================================================================================================= + +void BRepClass_FacePassiveClassifier::Reset(const gp_Lin2d& L, const double P, const double Tol) +{ + TopClass_Classifier2d::Reset(myLin, + myParam, + myTolerance, + myState, + myFirstCompare, + myFirstTrans, + myClosest, + myIsSet, + myIsHeadOrEnd, + L, + P, + Tol); +} + +//================================================================================================= + +void BRepClass_FacePassiveClassifier::Compare(const BRepClass_Edge& E, const TopAbs_Orientation Or) +{ + TopClass_Classifier2d::Compare(myClosest, + myIntersector, + myLin, + myParam, + myTolerance, + myState, + myFirstCompare, + myFirstTrans, + myTrans, + myIsHeadOrEnd, + E, + Or); +} diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier.hxx index f0a5498ccc..ac83bc9cfc 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier.hxx @@ -51,24 +51,24 @@ public: Standard_EXPORT void Compare(const BRepClass_Edge& E, const TopAbs_Orientation Or); //! Returns the current value of the parameter. - double Parameter() const; + double Parameter() const { return myParam; } //! Returns the intersecting algorithm. - BRepClass_Intersector& Intersector(); + BRepClass_Intersector& Intersector() { return myIntersector; } //! Returns 0 if the last compared edge had no //! relevant intersection. Else returns the index of //! this intersection in the last intersection //! algorithm. - int ClosestIntersection() const; + int ClosestIntersection() const { return myClosest; } //! Returns the current state of the point. - TopAbs_State State() const; + TopAbs_State State() const { return myState; } //! Returns the true if the closest intersection point //! represents head or end of the edge. Returns false //! otherwise. - bool IsHeadOrEnd() const; + bool IsHeadOrEnd() const { return myIsHeadOrEnd; } private: bool myIsSet; @@ -84,20 +84,4 @@ private: bool myIsHeadOrEnd; }; -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersector BRepClass_Intersector -#define TheIntersector_hxx -#define TopClass_Classifier2d BRepClass_FacePassiveClassifier -#define TopClass_Classifier2d_hxx - -#include - -#undef TheEdge -#undef TheEdge_hxx -#undef TheIntersector -#undef TheIntersector_hxx -#undef TopClass_Classifier2d -#undef TopClass_Classifier2d_hxx - #endif // _BRepClass_FacePassiveClassifier_HeaderFile diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier_0.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier_0.cxx deleted file mode 100644 index d1b7d2eb42..0000000000 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/BRepClass_FacePassiveClassifier_0.cxx +++ /dev/null @@ -1,30 +0,0 @@ -// Created on: 1992-11-18 -// Created by: Remi LEQUETTE -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-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. - -#include - -#include -#include -#include -#include - -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersector BRepClass_Intersector -#define TheIntersector_hxx -#define TopClass_Classifier2d BRepClass_FacePassiveClassifier -#define TopClass_Classifier2d_hxx -#include diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/FILES.cmake b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/FILES.cmake index ee42412937..bad0cf8d76 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass/FILES.cmake +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass/FILES.cmake @@ -4,18 +4,16 @@ set(OCCT_BRepClass_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_BRepClass_FILES BRepClass_Edge.cxx BRepClass_Edge.hxx - BRepClass_Edge.lxx BRepClass_FaceClassifier.cxx BRepClass_FaceClassifier.hxx BRepClass_FaceExplorer.cxx BRepClass_FaceExplorer.hxx - BRepClass_FaceExplorer.lxx + BRepClass_FacePassiveClassifier.cxx BRepClass_FacePassiveClassifier.hxx - BRepClass_FacePassiveClassifier_0.cxx + BRepClass_FClass2dOfFClassifier.cxx BRepClass_FClass2dOfFClassifier.hxx - BRepClass_FClass2dOfFClassifier_0.cxx + BRepClass_FClassifier.cxx BRepClass_FClassifier.hxx - BRepClass_FClassifier_0.cxx BRepClass_Intersector.cxx BRepClass_Intersector.hxx ) diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx index 469dc60528..f3771c3a47 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx @@ -82,15 +82,16 @@ bool BRepClass3d_SolidExplorer::FindAPointInTheFace(const TopoDS_Face& _face, TopoDS_Face face = _face; face.Orientation(TopAbs_FORWARD); - TopExp_Explorer faceexplorer; - BRepAdaptor_Curve2d c; - gp_Vec2d T; - gp_Pnt2d P; + gp_Vec2d T; + gp_Pnt2d P; - for (faceexplorer.Init(face, TopAbs_EDGE); faceexplorer.More(); faceexplorer.Next()) + for (TopExp_Explorer faceexplorer(face, TopAbs_EDGE); faceexplorer.More(); faceexplorer.Next()) { - TopoDS_Edge Edge = TopoDS::Edge(faceexplorer.Current()); - c.Initialize(Edge, face); + TopoDS_Edge Edge = TopoDS::Edge(faceexplorer.Current()); + BRepAdaptor_Curve2d c(Edge, face); + if (c.Curve().IsNull()) + continue; + c.D1((c.LastParameter() - c.FirstParameter()) * param_ + c.FirstParameter(), P, T); double x = T.X(); diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistanceSS.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistanceSS.cxx index 43476050e8..96608614a9 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistanceSS.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistanceSS.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_HVertex.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_HVertex.hxx index b9305a8a69..25a1edbad9 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_HVertex.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_HVertex.hxx @@ -33,9 +33,9 @@ public: Standard_EXPORT BRepTopAdaptor_HVertex(const TopoDS_Vertex& Vtx, const occ::handle& Curve); - const TopoDS_Vertex& Vertex() const; + const TopoDS_Vertex& Vertex() const { return myVtx; } - TopoDS_Vertex& ChangeVertex(); + TopoDS_Vertex& ChangeVertex() { return myVtx; } Standard_EXPORT gp_Pnt2d Value() override; @@ -55,6 +55,4 @@ private: occ::handle myCurve; }; -#include - #endif // _BRepTopAdaptor_HVertex_HeaderFile diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_HVertex.lxx b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_HVertex.lxx deleted file mode 100644 index 654b1cf9ce..0000000000 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_HVertex.lxx +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-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. - -inline const TopoDS_Vertex& BRepTopAdaptor_HVertex::Vertex() const -{ - return myVtx; -} - -inline TopoDS_Vertex& BRepTopAdaptor_HVertex::ChangeVertex() -{ - return myVtx; -} diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/FILES.cmake b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/FILES.cmake index c0ea348558..0443a30672 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/FILES.cmake +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/FILES.cmake @@ -7,7 +7,6 @@ set(OCCT_BRepTopAdaptor_FILES BRepTopAdaptor_FClass2d.hxx BRepTopAdaptor_HVertex.cxx BRepTopAdaptor_HVertex.hxx - BRepTopAdaptor_HVertex.lxx BRepTopAdaptor_Tool.cxx BRepTopAdaptor_Tool.hxx diff --git a/src/ModelingData/TKBRep/BRepTools/BRepTools_GTrsfModification.hxx b/src/ModelingData/TKBRep/BRepTools/BRepTools_GTrsfModification.hxx index 9a84485ed7..a98a7ab5e9 100644 --- a/src/ModelingData/TKBRep/BRepTools/BRepTools_GTrsfModification.hxx +++ b/src/ModelingData/TKBRep/BRepTools/BRepTools_GTrsfModification.hxx @@ -54,7 +54,7 @@ public: //! true if the orientation of the modified //! face changes in the shells which contain it. //! Here, will return true if the - //! -- gp_Trsf is negative. + //! - gp_Trsf is negative. Standard_EXPORT bool NewSurface(const TopoDS_Face& F, occ::handle& S, TopLoc_Location& L, diff --git a/src/ModelingData/TKBRep/BRepTools/BRepTools_NurbsConvertModification.hxx b/src/ModelingData/TKBRep/BRepTools/BRepTools_NurbsConvertModification.hxx index 442ff203e8..53f71bf364 100644 --- a/src/ModelingData/TKBRep/BRepTools/BRepTools_NurbsConvertModification.hxx +++ b/src/ModelingData/TKBRep/BRepTools/BRepTools_NurbsConvertModification.hxx @@ -54,7 +54,7 @@ public: //! true if the orientation of the modified //! face changes in the shells which contain it. //! Here, will return true if the - //! -- gp_Trsf is negative. + //! - gp_Trsf is negative. Standard_EXPORT bool NewSurface(const TopoDS_Face& F, occ::handle& S, TopLoc_Location& L,