From 7362bef7e86730823578a1af5b6651d0c4c04453 Mon Sep 17 00:00:00 2001 From: duv Date: Mon, 26 Jun 2017 11:56:08 +0300 Subject: [PATCH] Porting restore face orientation tool to OCCT 7.1.0 --- src/BRepMesh/BRepMesh_EdgeSet.lxx | 28 +++++++++---------- .../BRepMesh_RestoreOrientationTool.cxx | 17 +++++------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/BRepMesh/BRepMesh_EdgeSet.lxx b/src/BRepMesh/BRepMesh_EdgeSet.lxx index ab5324eb9d..fbda91dc00 100644 --- a/src/BRepMesh/BRepMesh_EdgeSet.lxx +++ b/src/BRepMesh/BRepMesh_EdgeSet.lxx @@ -152,21 +152,21 @@ Standard_Integer BRepMesh_EdgeSet::ClosestEdge (const BVH_VecNt& theEdgeV1 { T aLftDist = EdgeToBoxDistance (theEdgeV1, theEdgeV2, - aBVH->MinPoint (aBVH->LeftChild (aNode)), - aBVH->MaxPoint (aBVH->LeftChild (aNode))); + aBVH->MinPoint (aBVH->Child<0> (aNode)), + aBVH->MaxPoint (aBVH->Child<0> (aNode))); T aRghDist = EdgeToBoxDistance (theEdgeV1, theEdgeV2, - aBVH->MinPoint (aBVH->RightChild (aNode)), - aBVH->MaxPoint (aBVH->RightChild (aNode))); + aBVH->MinPoint (aBVH->Child<1> (aNode)), + aBVH->MaxPoint (aBVH->Child<1> (aNode))); const bool aProceedLft = aLftDist < aMinDist; const bool aProceedRgh = aRghDist < aMinDist; if (aProceedLft && aProceedRgh) { - int aLeft = aBVH->LeftChild (aNode); - int aRight = aBVH->RightChild (aNode); + int aLeft = aBVH->Child<0> (aNode); + int aRight = aBVH->Child<1> (aNode); aNode = (aLftDist < aRghDist) ? aLeft : aRight; aStack[++aHead] = (aRghDist <= aLftDist) ? aLeft : aRight; @@ -175,7 +175,7 @@ Standard_Integer BRepMesh_EdgeSet::ClosestEdge (const BVH_VecNt& theEdgeV1 { if (aProceedLft || aProceedRgh) { - aNode = aProceedLft ? aBVH->LeftChild (aNode) : aBVH->RightChild (aNode); + aNode = aProceedLft ? aBVH->Child<0> (aNode) : aBVH->Child<1> (aNode); } else { @@ -258,21 +258,21 @@ Standard_Integer BRepMesh_EdgeSet::CoherentEdge (const BVH_VecNt& theEdgeV { T aLftDist = EdgeToBoxDistance (theEdgeV1, theEdgeV2, - aBVH->MinPoint (aBVH->LeftChild (aNode)), - aBVH->MaxPoint (aBVH->LeftChild (aNode))); + aBVH->MinPoint (aBVH->Child<0> (aNode)), + aBVH->MaxPoint (aBVH->Child<0> (aNode))); T aRghDist = EdgeToBoxDistance (theEdgeV1, theEdgeV2, - aBVH->MinPoint (aBVH->RightChild (aNode)), - aBVH->MaxPoint (aBVH->RightChild (aNode))); + aBVH->MinPoint (aBVH->Child<1> (aNode)), + aBVH->MaxPoint (aBVH->Child<1> (aNode))); const bool aProceedLft = aLftDist < aMinDist; const bool aProceedRgh = aRghDist < aMinDist; if (aProceedLft && aProceedRgh) { - int aLeft = aBVH->LeftChild (aNode); - int aRight = aBVH->RightChild (aNode); + int aLeft = aBVH->Child<0> (aNode); + int aRight = aBVH->Child<1> (aNode); aNode = (aLftDist < aRghDist) ? aLeft : aRight; aStack[++aHead] = (aRghDist <= aLftDist) ? aLeft : aRight; @@ -281,7 +281,7 @@ Standard_Integer BRepMesh_EdgeSet::CoherentEdge (const BVH_VecNt& theEdgeV { if (aProceedLft || aProceedRgh) { - aNode = aProceedLft ? aBVH->LeftChild (aNode) : aBVH->RightChild (aNode); + aNode = aProceedLft ? aBVH->Child<0> (aNode) : aBVH->Child<1> (aNode); } else { diff --git a/src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx b/src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx index 77ad33346f..d170ba69d4 100644 --- a/src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx +++ b/src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx @@ -484,7 +484,8 @@ Standard_Integer BRepMesh_RestoreOrientationTool::traceRay (const BVH_Vec3d& the { Standard_Integer aStack[32]; - const NCollection_Handle >& aBVH = theTriangulation.BVH(); + const NCollection_Handle >& aBVH = + static_cast >&> (theTriangulation.BVH()); if (aBVH.IsNull()) { @@ -535,14 +536,14 @@ Standard_Integer BRepMesh_RestoreOrientationTool::traceRay (const BVH_Vec3d& the } else { - BVH_Vec3d aTime0 = (aBVH->MinPoint (aBVH->LeftChild (aNode)) - theOrigin) * anInvDirect; - BVH_Vec3d aTime1 = (aBVH->MaxPoint (aBVH->LeftChild (aNode)) - theOrigin) * anInvDirect; + BVH_Vec3d aTime0 = (aBVH->MinPoint (aBVH->Child<0> (aNode)) - theOrigin) * anInvDirect; + BVH_Vec3d aTime1 = (aBVH->MaxPoint (aBVH->Child<0> (aNode)) - theOrigin) * anInvDirect; BVH_Vec3d aTimeMax = aTime0.cwiseMax (aTime1); BVH_Vec3d aTimeMin = aTime0.cwiseMin (aTime1); - aTime0 = (aBVH->MinPoint (aBVH->RightChild (aNode)) - theOrigin) * anInvDirect; - aTime1 = (aBVH->MaxPoint (aBVH->RightChild (aNode)) - theOrigin) * anInvDirect; + aTime0 = (aBVH->MinPoint (aBVH->Child<1> (aNode)) - theOrigin) * anInvDirect; + aTime1 = (aBVH->MaxPoint (aBVH->Child<1> (aNode)) - theOrigin) * anInvDirect; Standard_Real aTimeFinal = aTimeMax.minComp(); Standard_Real aTimeStart = aTimeMin.maxComp(); @@ -564,8 +565,8 @@ Standard_Integer BRepMesh_RestoreOrientationTool::traceRay (const BVH_Vec3d& the if (aHitLft && aHitRgh) { - int aLeft = aBVH->LeftChild (aNode); - int aRight = aBVH->RightChild (aNode); + int aLeft = aBVH->Child<0> (aNode); + int aRight = aBVH->Child<1> (aNode); aNode = (aTimeMin1 < aTimeMin2) ? aLeft : aRight; aStack[++aHead] = (aTimeMin2 <= aTimeMin1) ? aLeft : aRight; @@ -574,7 +575,7 @@ Standard_Integer BRepMesh_RestoreOrientationTool::traceRay (const BVH_Vec3d& the { if (aHitLft || aHitRgh) { - aNode = aHitLft ? aBVH->LeftChild (aNode) : aBVH->RightChild (aNode); + aNode = aHitLft ? aBVH->Child<0> (aNode) : aBVH->Child<1> (aNode); } else { -- 2.39.5