]> OCCT Git - occt-copy.git/commitdiff
Porting restore face orientation tool to OCCT 7.1.0
authorduv <duv@opencascade.com>
Mon, 26 Jun 2017 08:56:08 +0000 (11:56 +0300)
committerduv <duv@opencascade.com>
Mon, 26 Jun 2017 12:32:25 +0000 (15:32 +0300)
src/BRepMesh/BRepMesh_EdgeSet.lxx
src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx

index ab5324eb9de5fb3270b8f23f9762a46d2f0efbd2..fbda91dc00a40c6af64344c6a8d4c4cfa6de289e 100644 (file)
@@ -152,21 +152,21 @@ Standard_Integer BRepMesh_EdgeSet<T, N>::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<T, N>::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<T, N>::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<T, N>::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
         {
index 77ad33346f55ada44db47791a0d991305dd1f1e5..d170ba69d4735416f748a35da36e023e9a135df8 100644 (file)
@@ -484,7 +484,8 @@ Standard_Integer BRepMesh_RestoreOrientationTool::traceRay (const BVH_Vec3d& the
 {
   Standard_Integer aStack[32];
 
-  const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& aBVH = theTriangulation.BVH();
+  const NCollection_Handle<BVH_Tree<Standard_Real, 3, BVH_BinaryTree> >& aBVH =
+    static_cast <const NCollection_Handle<BVH_Tree<Standard_Real, 3, BVH_BinaryTree> >&> (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
         {