0027870: Modeling - refactoring of HLR algorithms
authorabk <abk@opencascade.com>
Wed, 5 Oct 2016 10:49:44 +0000 (13:49 +0300)
committerapn <apn@opencascade.com>
Thu, 3 Nov 2016 11:16:56 +0000 (14:16 +0300)
Toolkit 'TKHLR' was fully refactored for 'Standard_Address' and macros except about half of package 'HLRBREP' there 'Standard_Address' is used through the 'generic' mechanism.

69 files changed:
src/Contap/Contap_ContAna.cxx
src/Contap/Contap_Contour.cxx
src/Contap/Contap_SurfFunction.cxx
src/DBRep/DBRep_HideData.cxx
src/HLRAlgo/FILES
src/HLRAlgo/HLRAlgo.cxx
src/HLRAlgo/HLRAlgo.hxx
src/HLRAlgo/HLRAlgo_BiPoint.cxx
src/HLRAlgo/HLRAlgo_BiPoint.hxx
src/HLRAlgo/HLRAlgo_Coincidence.cxx [deleted file]
src/HLRAlgo/HLRAlgo_Coincidence.hxx
src/HLRAlgo/HLRAlgo_Coincidence.lxx [deleted file]
src/HLRAlgo/HLRAlgo_EdgeIterator.cxx
src/HLRAlgo/HLRAlgo_EdgeIterator.hxx
src/HLRAlgo/HLRAlgo_EdgeIterator.lxx
src/HLRAlgo/HLRAlgo_EdgesBlock.cxx
src/HLRAlgo/HLRAlgo_EdgesBlock.hxx
src/HLRAlgo/HLRAlgo_PolyAlgo.cxx
src/HLRAlgo/HLRAlgo_PolyAlgo.hxx
src/HLRAlgo/HLRAlgo_PolyData.cxx
src/HLRAlgo/HLRAlgo_PolyData.hxx
src/HLRAlgo/HLRAlgo_PolyData.lxx
src/HLRAlgo/HLRAlgo_PolyHidingData.hxx
src/HLRAlgo/HLRAlgo_PolyHidingData.lxx [deleted file]
src/HLRAlgo/HLRAlgo_PolyInternalData.cxx
src/HLRAlgo/HLRAlgo_PolyInternalData.hxx
src/HLRAlgo/HLRAlgo_PolyInternalNode.hxx
src/HLRAlgo/HLRAlgo_PolyInternalNode.lxx [deleted file]
src/HLRAlgo/HLRAlgo_PolyInternalSegment.hxx
src/HLRAlgo/HLRAlgo_PolyInternalSegment.lxx [deleted file]
src/HLRAlgo/HLRAlgo_PolyMask.hxx [new file with mode: 0644]
src/HLRAlgo/HLRAlgo_PolyShellData.cxx
src/HLRAlgo/HLRAlgo_PolyShellData.hxx
src/HLRAlgo/HLRAlgo_PolyShellData.lxx
src/HLRAlgo/HLRAlgo_TriangleData.hxx
src/HLRAlgo/HLRAlgo_TriangleData.lxx [deleted file]
src/HLRAlgo/HLRAlgo_WiresBlock.cxx
src/HLRAlgo/HLRAlgo_WiresBlock.hxx
src/HLRAlgo/HLRAlgo_WiresBlock.lxx [deleted file]
src/HLRBRep/HLRBRep_BiPnt2D.hxx
src/HLRBRep/HLRBRep_CLProps.hxx
src/HLRBRep/HLRBRep_CLPropsATool.hxx
src/HLRBRep/HLRBRep_CLPropsATool.lxx
src/HLRBRep/HLRBRep_CLProps_0.cxx
src/HLRBRep/HLRBRep_Curve.cxx
src/HLRBRep/HLRBRep_Curve.hxx
src/HLRBRep/HLRBRep_Curve.lxx
src/HLRBRep/HLRBRep_Data.cxx
src/HLRBRep/HLRBRep_Data.hxx
src/HLRBRep/HLRBRep_EdgeData.cxx
src/HLRBRep/HLRBRep_EdgeData.hxx
src/HLRBRep/HLRBRep_EdgeData.lxx
src/HLRBRep/HLRBRep_InternalAlgo.cxx
src/HLRBRep/HLRBRep_Intersector.cxx
src/HLRBRep/HLRBRep_Intersector.hxx
src/HLRBRep/HLRBRep_PolyAlgo.cxx
src/HLRBRep/HLRBRep_PolyAlgo.hxx
src/HLRBRep/HLRBRep_PolyHLRToShape.cxx
src/HLRBRep/HLRBRep_ShapeBounds.cxx
src/HLRBRep/HLRBRep_ShapeBounds.hxx
src/HLRBRep/HLRBRep_ShapeBounds.lxx
src/HLRBRep/HLRBRep_Surface.cxx
src/HLRBRep/HLRBRep_Surface.hxx
src/HLRBRep/HLRBRep_Surface.lxx
src/HLRTest/HLRTest_DrawablePolyEdgeTool.cxx
src/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx
src/HLRTopoBRep/HLRTopoBRep_Data.cxx
src/HLRTopoBRep/HLRTopoBRep_Data.hxx
src/StdPrs/StdPrs_HLRPolyShape.cxx

index c5f40d0..d7a0599 100644 (file)
@@ -28,7 +28,7 @@
 #include <Standard_OutOfRange.hxx>
 #include <StdFail_NotDone.hxx>
 
-#define Tolpetit 1.e-8
+static const Standard_Real Tolpetit = 1.e-8;
 
 Contap_ContAna::Contap_ContAna (): done(Standard_False) {}
 
index d5e7aa5..1b071f9 100644 (file)
@@ -44,9 +44,9 @@
 #include <TColStd_Array1OfInteger.hxx>
 #include <TopTrans_CurveTransition.hxx>
 
-#define Tolpetit 1.e-10  // pour dist au carre
+static const Standard_Real Tolpetit = 1.e-10; // pour dist au carre
 
-#define tole 5.e-6
+static const Standard_Real tole = 5.e-6;
 
 Contap_Contour::Contap_Contour () : 
 done(Standard_False),modeset(Standard_False)
index f4eeb7a..6645815 100644 (file)
@@ -14,7 +14,7 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-// jag 940616 #define Tolpetit 1.e-16
+// jag 940616 Tolpetit = 1.e-16
 
 #include <Adaptor3d_HSurface.hxx>
 #include <Adaptor3d_HSurfaceTool.hxx>
index 92bf56d..2adcb32 100644 (file)
@@ -72,7 +72,7 @@ void DBRep_HideData::Set(const Standard_Integer viewID,
   HLRAlgo_EdgeStatus status;
 
   for (hider->InitHide(); hider->MoreHide(); hider->NextHide()) {
-    hider->Hide(Coordinates,status,Sori,reg1,regn,outl,intl);
+    Coordinates = &hider->Hide(status,Sori,reg1,regn,outl,intl);
     dx = PntX2 - PntX1;
     dy = PntY2 - PntY1;
     dz = PntZ2 - PntZ1;
index 9d48682..b1ffa81 100644 (file)
@@ -6,9 +6,7 @@ HLRAlgo_Array1OfPISeg.hxx
 HLRAlgo_Array1OfTData.hxx
 HLRAlgo_BiPoint.cxx
 HLRAlgo_BiPoint.hxx
-HLRAlgo_Coincidence.cxx
 HLRAlgo_Coincidence.hxx
-HLRAlgo_Coincidence.lxx
 HLRAlgo_EdgeIterator.cxx
 HLRAlgo_EdgeIterator.hxx
 HLRAlgo_EdgeIterator.lxx
@@ -36,15 +34,13 @@ HLRAlgo_PolyData.cxx
 HLRAlgo_PolyData.hxx
 HLRAlgo_PolyData.lxx
 HLRAlgo_PolyHidingData.hxx
-HLRAlgo_PolyHidingData.lxx
 HLRAlgo_PolyInternalData.cxx
 HLRAlgo_PolyInternalData.hxx
 HLRAlgo_PolyInternalData.lxx
 HLRAlgo_PolyInternalNode.cxx
 HLRAlgo_PolyInternalNode.hxx
-HLRAlgo_PolyInternalNode.lxx
 HLRAlgo_PolyInternalSegment.hxx
-HLRAlgo_PolyInternalSegment.lxx
+HLRAlgo_PolyMask.hxx
 HLRAlgo_PolyShellData.cxx
 HLRAlgo_PolyShellData.hxx
 HLRAlgo_PolyShellData.lxx
@@ -52,7 +48,5 @@ HLRAlgo_Projector.cxx
 HLRAlgo_Projector.hxx
 HLRAlgo_Projector.lxx
 HLRAlgo_TriangleData.hxx
-HLRAlgo_TriangleData.lxx
 HLRAlgo_WiresBlock.cxx
 HLRAlgo_WiresBlock.hxx
-HLRAlgo_WiresBlock.lxx
index 59b9347..0d7d2b6 100644 (file)
@@ -40,8 +40,8 @@ static const Standard_Real sinu6 = sin(6.*M_PI/14.);
 void HLRAlgo::UpdateMinMax (const Standard_Real x,
                             const Standard_Real y,
                             const Standard_Real z,
-                            const Standard_Address Min,
-                            const Standard_Address Max)
+                            Standard_Real Min[16],
+                            Standard_Real Max[16])
 {
   Standard_Real d[16];
   d[ 0] = cosu0 * x + sinu0 * y;
@@ -61,12 +61,16 @@ void HLRAlgo::UpdateMinMax (const Standard_Real x,
   d[14] = z;
   d[15] = z;
 
-  Standard_Integer i = 0;
-  while (i < 16)
+  for (Standard_Integer i = 0; i < 16; ++i)
   {
-    if (((Standard_Real*)Min)[i] > d[i]) ((Standard_Real*)Min)[i] = d[i];
-    if (((Standard_Real*)Max)[i] < d[i]) ((Standard_Real*)Max)[i] = d[i];
-    i++;
+    if (Min[i] > d[i])
+    {
+      Min[i] = d[i];
+    }
+    if (Max[i] < d[i])
+    {
+      Max[i] = d[i];
+    }
   }
 }
 
@@ -76,14 +80,14 @@ void HLRAlgo::UpdateMinMax (const Standard_Real x,
 //=======================================================================
 
 void HLRAlgo::EnlargeMinMax (const Standard_Real tol,
-                             const Standard_Address Min,
-                             const Standard_Address Max)
+                             Standard_Real Min[16],
+                             Standard_Real Max[16])
 {
   Standard_Integer i = 0;
   while (i < 16)
   {
-    ((Standard_Real*)Min)[i] -= tol;
-    ((Standard_Real*)Max)[i] += tol;
+    Min[i] -= tol;
+    Max[i] += tol;
     i++;
   }
 }
@@ -94,14 +98,14 @@ void HLRAlgo::EnlargeMinMax (const Standard_Real tol,
 //=======================================================================
 
 void HLRAlgo::InitMinMax (const Standard_Real Big,
-                          const Standard_Address Min,
-                          const Standard_Address Max)
+                          Standard_Real Min[16],
+                          Standard_Real Max[16])
 {
   Standard_Integer i = 0;
   while (i < 16)
   {
-    ((Standard_Real*)Min)[i] =  Big;
-    ((Standard_Real*)Max)[i] = -Big;
+    Min[i] =  Big;
+    Max[i] = -Big;
     i++;
   }
 }
@@ -111,42 +115,42 @@ void HLRAlgo::InitMinMax (const Standard_Real Big,
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo::EncodeMinMax (const Standard_Address Min,
-                            const Standard_Address Max,
-                            const Standard_Address MM)
+void HLRAlgo::EncodeMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& Min,
+                            HLRAlgo_EdgesBlock::MinMaxIndices& Max,
+                            HLRAlgo_EdgesBlock::MinMaxIndices& MM)
 {
-  ((Standard_Integer*)MM)[ 0] = ((Standard_Integer*)Min)[ 1]&0x00007fff;
-  ((Standard_Integer*)MM)[ 8] = ((Standard_Integer*)Max)[ 1]&0x00007fff;
-  ((Standard_Integer*)MM)[ 0]+=(((Standard_Integer*)Min)[ 0]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 8]+=(((Standard_Integer*)Max)[ 0]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 1] = ((Standard_Integer*)Min)[ 3]&0x00007fff;
-  ((Standard_Integer*)MM)[ 9] = ((Standard_Integer*)Max)[ 3]&0x00007fff;
-  ((Standard_Integer*)MM)[ 1]+=(((Standard_Integer*)Min)[ 2]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 9]+=(((Standard_Integer*)Max)[ 2]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 2] = ((Standard_Integer*)Min)[ 5]&0x00007fff;
-  ((Standard_Integer*)MM)[10] = ((Standard_Integer*)Max)[ 5]&0x00007fff;
-  ((Standard_Integer*)MM)[ 2]+=(((Standard_Integer*)Min)[ 4]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[10]+=(((Standard_Integer*)Max)[ 4]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 3] = ((Standard_Integer*)Min)[ 7]&0x00007fff;
-  ((Standard_Integer*)MM)[11] = ((Standard_Integer*)Max)[ 7]&0x00007fff;
-  ((Standard_Integer*)MM)[ 3]+=(((Standard_Integer*)Min)[ 6]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[11]+=(((Standard_Integer*)Max)[ 6]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 4] = ((Standard_Integer*)Min)[ 9]&0x00007fff;
-  ((Standard_Integer*)MM)[12] = ((Standard_Integer*)Max)[ 9]&0x00007fff;
-  ((Standard_Integer*)MM)[ 4]+=(((Standard_Integer*)Min)[ 8]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[12]+=(((Standard_Integer*)Max)[ 8]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 5] = ((Standard_Integer*)Min)[11]&0x00007fff;
-  ((Standard_Integer*)MM)[13] = ((Standard_Integer*)Max)[11]&0x00007fff;
-  ((Standard_Integer*)MM)[ 5]+=(((Standard_Integer*)Min)[10]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[13]+=(((Standard_Integer*)Max)[10]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 6] = ((Standard_Integer*)Min)[13]&0x00007fff;
-  ((Standard_Integer*)MM)[14] = ((Standard_Integer*)Max)[13]&0x00007fff;
-  ((Standard_Integer*)MM)[ 6]+=(((Standard_Integer*)Min)[12]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[14]+=(((Standard_Integer*)Max)[12]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[ 7] = ((Standard_Integer*)Min)[15]&0x00007fff;
-  ((Standard_Integer*)MM)[15] = ((Standard_Integer*)Max)[15]&0x00007fff;
-  ((Standard_Integer*)MM)[ 7]+=(((Standard_Integer*)Min)[14]&0x00007fff)<<16;
-  ((Standard_Integer*)MM)[15]+=(((Standard_Integer*)Max)[14]&0x00007fff)<<16;
+  MM.Min[0] =  Min.Min[1] & 0x00007fff;
+  MM.Max[0] =  Max.Min[1] & 0x00007fff;
+  MM.Min[0] += (Min.Min[0] & 0x00007fff) << 16;
+  MM.Max[0] += (Max.Min[0] & 0x00007fff) <<16;
+  MM.Min[1] =  Min.Min[3] & 0x00007fff;
+  MM.Max[1] =  Max.Min[3] & 0x00007fff;
+  MM.Min[1] += (Min.Min[2] & 0x00007fff) << 16;
+  MM.Max[1] += (Max.Min[2] & 0x00007fff) << 16;
+  MM.Min[2] =  Min.Min[5] & 0x00007fff;
+  MM.Max[2] =  Max.Min[5] & 0x00007fff;
+  MM.Min[2] += (Min.Min[4] & 0x00007fff) << 16;
+  MM.Max[2] += (Max.Min[4] & 0x00007fff) << 16;
+  MM.Min[3] =  Min.Min[7] & 0x00007fff;
+  MM.Max[3] =  Max.Min[7] & 0x00007fff;
+  MM.Min[3] += (Min.Min[6] & 0x00007fff) << 16;
+  MM.Max[3] += (Max.Min[6] & 0x00007fff) << 16;
+  MM.Min[4] =  Min.Max[1] & 0x00007fff;
+  MM.Max[4] =  Max.Max[1] & 0x00007fff;
+  MM.Min[4] += (Min.Max[0] & 0x00007fff) << 16;
+  MM.Max[4] += (Max.Max[0] & 0x00007fff) << 16;
+  MM.Min[5] =  Min.Max[3] & 0x00007fff;
+  MM.Max[5] =  Max.Max[3] & 0x00007fff;
+  MM.Min[5] += (Min.Max[2] & 0x00007fff) << 16;
+  MM.Max[5] += (Max.Max[2] & 0x00007fff) << 16;
+  MM.Min[6] =  Min.Max[5] & 0x00007fff;
+  MM.Max[6] =  Max.Max[5] & 0x00007fff;
+  MM.Min[6] += (Min.Max[4] & 0x00007fff) << 16;
+  MM.Max[6] += (Max.Max[4] & 0x00007fff) << 16;
+  MM.Min[7] =  Min.Max[7] & 0x00007fff;
+  MM.Max[7] =  Max.Max[7] & 0x00007fff;
+  MM.Min[7] += (Min.Max[6] & 0x00007fff) << 16;
+  MM.Max[7] += (Max.Max[6] & 0x00007fff) << 16;
 }
 
 //=======================================================================
@@ -154,15 +158,17 @@ void HLRAlgo::EncodeMinMax (const Standard_Address Min,
 //purpose  : 
 //=======================================================================
 
-Standard_Real HLRAlgo::SizeBox(const Standard_Address Min,
-                               const Standard_Address Max)
+Standard_Real HLRAlgo::SizeBox(HLRAlgo_EdgesBlock::MinMaxIndices& Min,
+                               HLRAlgo_EdgesBlock::MinMaxIndices& Max)
 {
-  Standard_Real s = ((Standard_Integer *)Max)[0] - ((Standard_Integer *)Min)[0];
-  Standard_Integer i = 1;
-  while (i < 14)
+  Standard_Real s = Max.Min[0] - Min.Min[0];
+  for (Standard_Integer aI = 1; aI < 8; ++aI)
   {
-    s *= ((Standard_Integer *)Max)[i] - ((Standard_Integer *)Min)[i];
-    i++;
+    s *= Max.Min[aI] - Min.Min[aI];
+  }
+  for (Standard_Integer aI = 0; aI < 6; ++aI)
+  {
+    s *= Max.Max[aI] - Min.Max[aI];
   }
   return s;
 }
@@ -172,61 +178,42 @@ Standard_Real HLRAlgo::SizeBox(const Standard_Address Min,
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo::DecodeMinMax (const Standard_Address MM,
-                            const Standard_Address Min,
-                            const Standard_Address Max)
+void HLRAlgo::DecodeMinMax (const HLRAlgo_EdgesBlock::MinMaxIndices& MM,
+                            HLRAlgo_EdgesBlock::MinMaxIndices& Min,
+                            HLRAlgo_EdgesBlock::MinMaxIndices& Max)
 {
-  ((Standard_Integer*)Min)[ 0]=(((Standard_Integer*)MM)[ 0]&0x7fff0000)>>16;
-  ((Standard_Integer*)Max)[ 0]=(((Standard_Integer*)MM)[ 8]&0x7fff0000)>>16;
-  ((Standard_Integer*)Min)[ 1]= ((Standard_Integer*)MM)[ 0]&0x00007fff;
-  ((Standard_Integer*)Max)[ 1]= ((Standard_Integer*)MM)[ 8]&0x00007fff;
-  ((Standard_Integer*)Min)[ 2]=(((Standard_Integer*)MM)[ 1]&0x7fff0000)>>16;
-  ((Standard_Integer*)Max)[ 2]=(((Standard_Integer*)MM)[ 9]&0x7fff0000)>>16;
-  ((Standard_Integer*)Min)[ 3]= ((Standard_Integer*)MM)[ 1]&0x00007fff;
-  ((Standard_Integer*)Max)[ 3]= ((Standard_Integer*)MM)[ 9]&0x00007fff;
-  ((Standard_Integer*)Min)[ 4]=(((Standard_Integer*)MM)[ 2]&0x7fff0000)>>16;
-  ((Standard_Integer*)Max)[ 4]=(((Standard_Integer*)MM)[10]&0x7fff0000)>>16;
-  ((Standard_Integer*)Min)[ 5]= ((Standard_Integer*)MM)[ 2]&0x00007fff;
-  ((Standard_Integer*)Max)[ 5]= ((Standard_Integer*)MM)[10]&0x00007fff;
-  ((Standard_Integer*)Min)[ 6]=(((Standard_Integer*)MM)[ 3]&0x7fff0000)>>16;
-  ((Standard_Integer*)Max)[ 6]=(((Standard_Integer*)MM)[11]&0x7fff0000)>>16;
-  ((Standard_Integer*)Min)[ 7]= ((Standard_Integer*)MM)[ 3]&0x00007fff;
-  ((Standard_Integer*)Max)[ 7]= ((Standard_Integer*)MM)[11]&0x00007fff;
-  ((Standard_Integer*)Min)[ 8]=(((Standard_Integer*)MM)[ 4]&0x7fff0000)>>16;
-  ((Standard_Integer*)Max)[ 8]=(((Standard_Integer*)MM)[12]&0x7fff0000)>>16;
-  ((Standard_Integer*)Min)[ 9]= ((Standard_Integer*)MM)[ 4]&0x00007fff;
-  ((Standard_Integer*)Max)[ 9]= ((Standard_Integer*)MM)[12]&0x00007fff;
-  ((Standard_Integer*)Min)[10]=(((Standard_Integer*)MM)[ 5]&0x7fff0000)>>16;
-  ((Standard_Integer*)Max)[10]=(((Standard_Integer*)MM)[13]&0x7fff0000)>>16;
-  ((Standard_Integer*)Min)[11]= ((Standard_Integer*)MM)[ 5]&0x00007fff;
-  ((Standard_Integer*)Max)[11]= ((Standard_Integer*)MM)[13]&0x00007fff;
-  ((Standard_Integer*)Min)[12]=(((Standard_Integer*)MM)[ 6]&0x7fff0000)>>16;
-  ((Standard_Integer*)Max)[12]=(((Standard_Integer*)MM)[14]&0x7fff0000)>>16;
-  ((Standard_Integer*)Min)[13]= ((Standard_Integer*)MM)[ 6]&0x00007fff;
-  ((Standard_Integer*)Max)[13]= ((Standard_Integer*)MM)[14]&0x00007fff;
-  ((Standard_Integer*)Min)[14]=(((Standard_Integer*)MM)[ 7]&0x7fff0000)>>16;
-  ((Standard_Integer*)Max)[14]=(((Standard_Integer*)MM)[15]&0x7fff0000)>>16;
-  ((Standard_Integer*)Min)[15]= ((Standard_Integer*)MM)[ 7]&0x00007fff;
-  ((Standard_Integer*)Max)[15]= ((Standard_Integer*)MM)[15]&0x00007fff;
-}
-
-//=======================================================================
-//function :CopyMinMax
-//purpose  : 
-//=======================================================================
-
-void HLRAlgo::CopyMinMax (const Standard_Address IMin,
-                          const Standard_Address IMax,
-                          const Standard_Address OMin,
-                          const Standard_Address OMax)
-{
-  Standard_Integer i = 0;
-  while (i < 16)
-  {
-    ((Standard_Integer*)OMin)[i]=((Standard_Integer*)IMin)[i];
-    ((Standard_Integer*)OMax)[i]=((Standard_Integer*)IMax)[i];
-    i++;
-  }
+  Min.Min[0] =(MM.Min[0] & 0x7fff0000)>>16;
+  Max.Min[0] =(MM.Max[0] & 0x7fff0000)>>16;
+  Min.Min[1] = MM.Min[0] & 0x00007fff;
+  Max.Min[1] = MM.Max[0] & 0x00007fff;
+  Min.Min[2] =(MM.Min[1] & 0x7fff0000)>>16;
+  Max.Min[2] =(MM.Max[1] & 0x7fff0000)>>16;
+  Min.Min[3] = MM.Min[1] & 0x00007fff;
+  Max.Min[3] = MM.Max[1] & 0x00007fff;
+  Min.Min[4] =(MM.Min[2] & 0x7fff0000)>>16;
+  Max.Min[4] =(MM.Max[2] & 0x7fff0000)>>16;
+  Min.Min[5] = MM.Min[2] & 0x00007fff;
+  Max.Min[5] = MM.Max[2] & 0x00007fff;
+  Min.Min[6] =(MM.Min[3] & 0x7fff0000)>>16;
+  Max.Min[6] =(MM.Max[3] & 0x7fff0000)>>16;
+  Min.Min[7] = MM.Min[3] & 0x00007fff;
+  Max.Min[7] = MM.Max[3] & 0x00007fff;
+  Min.Max[0] =(MM.Min[4] & 0x7fff0000)>>16;
+  Max.Max[0] =(MM.Max[4] & 0x7fff0000)>>16;
+  Min.Max[1] = MM.Min[4] & 0x00007fff;
+  Max.Max[1] = MM.Max[4] & 0x00007fff;
+  Min.Max[2] =(MM.Min[5] & 0x7fff0000)>>16;
+  Max.Max[2] =(MM.Max[5] & 0x7fff0000)>>16;
+  Min.Max[3] = MM.Min[5] & 0x00007fff;
+  Max.Max[3] = MM.Max[5] & 0x00007fff;
+  Min.Max[4] =(MM.Min[6] & 0x7fff0000)>>16;
+  Max.Max[4] =(MM.Max[6] & 0x7fff0000)>>16;
+  Min.Max[5] = MM.Min[6] & 0x00007fff;
+  Max.Max[5] = MM.Max[6] & 0x00007fff;
+  Min.Max[6] =(MM.Min[7] & 0x7fff0000)>>16;
+  Max.Max[6] =(MM.Max[7] & 0x7fff0000)>>16;
+  Min.Max[7] = MM.Min[7] & 0x00007fff;
+  Max.Max[7] = MM.Max[7] & 0x00007fff;
 }
 
 //=======================================================================
@@ -234,18 +221,11 @@ void HLRAlgo::CopyMinMax (const Standard_Address IMin,
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo::AddMinMax (const Standard_Address IMin,
-                         const Standard_Address IMax,
-                         const Standard_Address OMin,
-                         const Standard_Address OMax)
+void HLRAlgo::AddMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& IMin,
+                         HLRAlgo_EdgesBlock::MinMaxIndices& IMax,
+                         HLRAlgo_EdgesBlock::MinMaxIndices& OMin,
+                         HLRAlgo_EdgesBlock::MinMaxIndices& OMax)
 {
-  Standard_Integer i = 0;
-  while (i < 16)
-  {
-    if (((Standard_Integer*)OMin)[i] > ((Standard_Integer*)IMin)[i])
-      ((Standard_Integer*)OMin)[i]=((Standard_Integer*)IMin)[i];
-    if (((Standard_Integer*)OMax)[i] < ((Standard_Integer*)IMax)[i])
-      ((Standard_Integer*)OMax)[i]=((Standard_Integer*)IMax)[i];
-    i++;
-  }
+  OMin.Minimize(IMin);
+  OMax.Maximize(IMax);
 }
index e71874e..9a21048 100644 (file)
 #ifndef _HLRAlgo_HeaderFile
 #define _HLRAlgo_HeaderFile
 
+#include <HLRAlgo_WiresBlock.hxx>
+
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
 #include <Standard_Real.hxx>
-#include <Standard_Address.hxx>
+
 class HLRAlgo_BiPoint;
 class HLRAlgo_PolyShellData;
 class HLRAlgo_PolyInternalData;
@@ -73,21 +75,25 @@ public:
   
   //! Iterator  on the  visible or  hidden  parts of  an
   //! EdgeStatus.
-  Standard_EXPORT static void UpdateMinMax (const Standard_Real x, const Standard_Real y, const Standard_Real z, const Standard_Address Min, const Standard_Address Max);
+  Standard_EXPORT static void UpdateMinMax (const Standard_Real x, const Standard_Real y, const Standard_Real z, Standard_Real Min[16], Standard_Real Max[16]);
   
-  Standard_EXPORT static void EnlargeMinMax (const Standard_Real tol, const Standard_Address Min, const Standard_Address Max);
+  Standard_EXPORT static void EnlargeMinMax (const Standard_Real tol, Standard_Real Min[16], Standard_Real Max[16]);
   
-  Standard_EXPORT static void InitMinMax (const Standard_Real Big, const Standard_Address Min, const Standard_Address Max);
+  Standard_EXPORT static void InitMinMax (const Standard_Real Big, Standard_Real Min[16], Standard_Real Max[16]);
   
-  Standard_EXPORT static void EncodeMinMax (const Standard_Address Min, const Standard_Address Max, const Standard_Address MinMax);
+  Standard_EXPORT static void EncodeMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& Min, HLRAlgo_EdgesBlock::MinMaxIndices& Max, HLRAlgo_EdgesBlock::MinMaxIndices& MinMax);
   
-  Standard_EXPORT static Standard_Real SizeBox (const Standard_Address Min, const Standard_Address Max);
+  Standard_EXPORT static Standard_Real SizeBox (HLRAlgo_EdgesBlock::MinMaxIndices& Min, HLRAlgo_EdgesBlock::MinMaxIndices& Max);
   
-  Standard_EXPORT static void DecodeMinMax (const Standard_Address MinMax, const Standard_Address Min, const Standard_Address Max);
+  Standard_EXPORT static void DecodeMinMax (const HLRAlgo_EdgesBlock::MinMaxIndices& MinMax, HLRAlgo_EdgesBlock::MinMaxIndices& Min, HLRAlgo_EdgesBlock::MinMaxIndices& Max);
   
-  Standard_EXPORT static void CopyMinMax (const Standard_Address IMin, const Standard_Address IMax, const Standard_Address OMin, const Standard_Address OMax);
+  static void CopyMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& IMin, HLRAlgo_EdgesBlock::MinMaxIndices& IMax, HLRAlgo_EdgesBlock::MinMaxIndices& OMin, HLRAlgo_EdgesBlock::MinMaxIndices& OMax)
+  {
+    OMin = IMin;
+    OMax = IMax;
+  }
   
-  Standard_EXPORT static void AddMinMax (const Standard_Address IMin, const Standard_Address IMax, const Standard_Address OMin, const Standard_Address OMax);
+  Standard_EXPORT static void AddMinMax (HLRAlgo_EdgesBlock::MinMaxIndices& IMin, HLRAlgo_EdgesBlock::MinMaxIndices& IMax, HLRAlgo_EdgesBlock::MinMaxIndices& OMin, HLRAlgo_EdgesBlock::MinMaxIndices& OMax);
 
 
 
index 409e604..127ba04 100644 (file)
 
 #include <HLRAlgo_BiPoint.hxx>
 
-#define PntX1  myCoordinates[ 0]
-#define PntY1  myCoordinates[ 1]
-#define PntZ1  myCoordinates[ 2]
-#define PntX2  myCoordinates[ 3]
-#define PntY2  myCoordinates[ 4]
-#define PntZ2  myCoordinates[ 5]
-#define PntXP1 myCoordinates[ 6]
-#define PntYP1 myCoordinates[ 7]
-#define PntZP1 myCoordinates[ 8]
-#define PntXP2 myCoordinates[ 9]
-#define PntYP2 myCoordinates[10]
-#define PntZP2 myCoordinates[11]
-
-#define ShapeIndex  myIndices[0]
-#define FaceConex1  myIndices[1]
-#define Face1Pt1    myIndices[2]
-#define Face1Pt2    myIndices[3]
-#define FaceConex2  myIndices[4]
-#define Face2Pt1    myIndices[5]
-#define Face2Pt2    myIndices[6]
-#define MinSeg      myIndices[7]
-#define MaxSeg      myIndices[8]
-#define SegFlags    myIndices[9]
-
 //=======================================================================
 //function : HLRAlgo_BiPoint
 //purpose  : 
@@ -68,22 +44,14 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
                                  const Standard_Boolean outl,
                                  const Standard_Boolean intl)
 {
-  PntX1 = X1;
-  PntY1 = Y1;
-  PntZ1 = Z1;
-  PntX2 = X2;
-  PntY2 = Y2;
-  PntZ2 = Z2;
-  PntXP1 = XT1;
-  PntYP1 = YT1;
-  PntZP1 = ZT1;
-  PntXP2 = XT2;
-  PntYP2 = YT2;
-  PntZP2 = ZT2;
-  ShapeIndex = Index;
-  FaceConex1 = Face1Pt1   = Face1Pt2   = 
-    FaceConex2 = Face2Pt1   = Face2Pt2   = 0;
-  SegFlags   = 0;
+  myPoints.Pnt1.SetCoord(X1, Y1, Z1);
+  myPoints.Pnt2.SetCoord(X2, Y2, Z2);
+  myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
+  myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
+  myIndices.ShapeIndex = Index;
+  myIndices.FaceConex1 = myIndices.Face1Pt1 = myIndices.Face1Pt2 =
+    myIndices.FaceConex2 = myIndices.Face2Pt1 = myIndices.Face2Pt2 = 0;
+  myIndices.SegFlags = 0;
   Rg1Line(reg1);
   RgNLine(regn);
   OutLine(outl);
@@ -111,22 +79,14 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
                                  const Standard_Integer Index,
                                  const Standard_Integer flag)
 {
-  PntX1 = X1;
-  PntY1 = Y1;
-  PntZ1 = Z1;
-  PntX2 = X2;
-  PntY2 = Y2;
-  PntZ2 = Z2;
-  PntXP1 = XT1;
-  PntYP1 = YT1;
-  PntZP1 = ZT1;
-  PntXP2 = XT2;
-  PntYP2 = YT2;
-  PntZP2 = ZT2;
-  ShapeIndex = Index;
-  FaceConex1 = Face1Pt1   = Face1Pt2   = 
-    FaceConex2 = Face2Pt1   = Face2Pt2   = 0;
-  SegFlags   = flag;
+  myPoints.Pnt1 = gp_XYZ(X1, Y1, Z1);
+  myPoints.Pnt2 = gp_XYZ(X2, Y2, Z2);
+  myPoints.PntP1 = gp_XYZ(XT1, YT1, ZT1);
+  myPoints.PntP2 = gp_XYZ(XT2, YT2, ZT2);
+  myIndices.ShapeIndex = Index;
+  myIndices.FaceConex1 = myIndices.Face1Pt1 = myIndices.Face1Pt2 =
+    myIndices.FaceConex2 = myIndices.Face2Pt1 = myIndices.Face2Pt2 = 0;
+  myIndices.SegFlags = flag;
   Hidden(Standard_False);
 }
 
@@ -156,24 +116,16 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
                                  const Standard_Boolean outl,
                                  const Standard_Boolean intl)
 {
-  PntX1 = X1;
-  PntY1 = Y1;
-  PntZ1 = Z1;
-  PntX2 = X2;
-  PntY2 = Y2;
-  PntZ2 = Z2;
-  PntXP1 = XT1;
-  PntYP1 = YT1;
-  PntZP1 = ZT1;
-  PntXP2 = XT2;
-  PntYP2 = YT2;
-  PntZP2 = ZT2;
-  ShapeIndex = Index;
-  FaceConex1 = i1;
-  Face1Pt1   = i1p1;
-  Face1Pt2   = i1p2;
-  FaceConex2 = Face2Pt1   = Face2Pt2   = 0;
-  SegFlags   = 0;
+  myPoints.Pnt1.SetCoord(X1, Y1, Z1);
+  myPoints.Pnt2.SetCoord(X2, Y2, Z2);
+  myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
+  myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
+  myIndices.ShapeIndex = Index;
+  myIndices.FaceConex1 = i1;
+  myIndices.Face1Pt1 = i1p1;
+  myIndices.Face1Pt2 = i1p2;
+  myIndices.FaceConex2 = myIndices.Face2Pt1 = myIndices.Face2Pt2 = 0;
+  myIndices.SegFlags = 0;
   Rg1Line(reg1);
   RgNLine(regn);
   OutLine(outl);
@@ -204,24 +156,16 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
                                  const Standard_Integer i1p2,
                                  const Standard_Integer flag)
 {
-  PntX1 = X1;
-  PntY1 = Y1;
-  PntZ1 = Z1;
-  PntX2 = X2;
-  PntY2 = Y2;
-  PntZ2 = Z2;
-  PntXP1 = XT1;
-  PntYP1 = YT1;
-  PntZP1 = ZT1;
-  PntXP2 = XT2;
-  PntYP2 = YT2;
-  PntZP2 = ZT2;
-  ShapeIndex = Index;
-  FaceConex1 = i1;
-  Face1Pt1   = i1p1;
-  Face1Pt2   = i1p2;
-  FaceConex2 = Face2Pt1   = Face2Pt2   = 0;
-  SegFlags   = flag;
+  myPoints.Pnt1.SetCoord(X1, Y1, Z1);
+  myPoints.Pnt2.SetCoord(X2, Y2, Z2);
+  myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
+  myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
+  myIndices.ShapeIndex = Index;
+  myIndices.FaceConex1 = i1;
+  myIndices.Face1Pt1 = i1p1;
+  myIndices.Face1Pt2 = i1p2;
+  myIndices.FaceConex2 = myIndices.Face2Pt1 = myIndices.Face2Pt2 = 0;
+  myIndices.SegFlags = flag;
   Hidden(Standard_False);
 }
 
@@ -254,26 +198,18 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
                                  const Standard_Boolean outl,
                                  const Standard_Boolean intl)
 {
-  PntX1 = X1;
-  PntY1 = Y1;
-  PntZ1 = Z1;
-  PntX2 = X2;
-  PntY2 = Y2;
-  PntZ2 = Z2;
-  PntXP1 = XT1;
-  PntYP1 = YT1;
-  PntZP1 = ZT1;
-  PntXP2 = XT2;
-  PntYP2 = YT2;
-  PntZP2 = ZT2;
-  ShapeIndex = Index;
-  FaceConex1 = i1;
-  Face1Pt1   = i1p1;
-  Face1Pt2   = i1p2;
-  FaceConex2 = i2;
-  Face2Pt1   = i2p1;
-  Face2Pt2   = i2p2;
-  SegFlags   = 0;
+  myPoints.Pnt1.SetCoord(X1, Y1, Z1);
+  myPoints.Pnt2.SetCoord(X2, Y2, Z2);
+  myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
+  myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
+  myIndices.ShapeIndex = Index;
+  myIndices.FaceConex1 = i1;
+  myIndices.Face1Pt1 = i1p1;
+  myIndices.Face1Pt2 = i1p2;
+  myIndices.FaceConex2 = i2;
+  myIndices.Face2Pt1 = i2p1;
+  myIndices.Face2Pt2 = i2p2;
+  myIndices.SegFlags = 0;
   Rg1Line(reg1);
   RgNLine(regn);
   OutLine(outl);
@@ -307,25 +243,17 @@ HLRAlgo_BiPoint::HLRAlgo_BiPoint (const Standard_Real X1,
                                  const Standard_Integer i2p2,
                                  const Standard_Integer flag)
 {
-  PntX1 = X1;
-  PntY1 = Y1;
-  PntZ1 = Z1;
-  PntX2 = X2;
-  PntY2 = Y2;
-  PntZ2 = Z2;
-  PntXP1 = XT1;
-  PntYP1 = YT1;
-  PntZP1 = ZT1;
-  PntXP2 = XT2;
-  PntYP2 = YT2;
-  PntZP2 = ZT2;
-  ShapeIndex = Index;
-  FaceConex1 = i1;
-  Face1Pt1   = i1p1;
-  Face1Pt2   = i1p2;
-  FaceConex2 = i2;
-  Face2Pt1   = i2p1;
-  Face2Pt2   = i2p2;
-  SegFlags   = flag;
+  myPoints.Pnt1.SetCoord(X1, Y1, Z1);
+  myPoints.Pnt2.SetCoord(X2, Y2, Z2);
+  myPoints.PntP1.SetCoord(XT1, YT1, ZT1);
+  myPoints.PntP2.SetCoord(XT2, YT2, ZT2);
+  myIndices.ShapeIndex = Index;
+  myIndices.FaceConex1 = i1;
+  myIndices.Face1Pt1 = i1p1;
+  myIndices.Face1Pt2 = i1p2;
+  myIndices.FaceConex2 = i2;
+  myIndices.Face2Pt1 = i2p1;
+  myIndices.Face2Pt2 = i2p2;
+  myIndices.SegFlags = flag;
   Hidden(Standard_False);
 }
index 3eba51e..223c147 100644 (file)
 #include <Standard_Integer.hxx>
 #include <Standard_Real.hxx>
 #include <Standard_Boolean.hxx>
-#include <Standard_Address.hxx>
+#include <gp_XYZ.hxx>
+#include <gp_XY.hxx>
 
 
 
-class HLRAlgo_BiPoint 
+class HLRAlgo_BiPoint
 {
 public:
+  struct IndicesT
+  {
+    Standard_Integer ShapeIndex;
+    Standard_Integer FaceConex1;
+    Standard_Integer Face1Pt1;
+    Standard_Integer Face1Pt2;
+    Standard_Integer FaceConex2;
+    Standard_Integer Face2Pt1;
+    Standard_Integer Face2Pt2;
+    Standard_Integer MinSeg;
+    Standard_Integer MaxSeg;
+    Standard_Integer SegFlags;
+  };
+
+  struct PointsT
+  {
+    gp_XYZ Pnt1;
+    gp_XYZ Pnt2;
+    gp_XYZ PntP1;
+    gp_XYZ PntP2;
+
+    gp_XY PntP12D() const
+    {
+      return gp_XY(PntP1.X(), PntP1.Y());
+    }
+
+    gp_XY PntP22D() const
+    {
+      return gp_XY(PntP2.X(), PntP2.Y());
+    }
+  };
 
   DEFINE_STANDARD_ALLOC
 
@@ -48,49 +80,70 @@ public:
   
   Standard_EXPORT HLRAlgo_BiPoint(const Standard_Real X1, const Standard_Real Y1, const Standard_Real Z1, const Standard_Real X2, const Standard_Real Y2, const Standard_Real Z2, const Standard_Real XT1, const Standard_Real YT1, const Standard_Real ZT1, const Standard_Real XT2, const Standard_Real YT2, const Standard_Real ZT2, const Standard_Integer Index, const Standard_Integer i1, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i2, const Standard_Integer i2p1, const Standard_Integer i2p2, const Standard_Integer flag);
 
-  Standard_Boolean Rg1Line() const { return (myIndices[9] & EMskRg1Line) != 0; }
+  Standard_Boolean Rg1Line() const
+  {
+    return (myIndices.SegFlags & EMskRg1Line) != 0;
+  }
 
   void Rg1Line (const Standard_Boolean B)
   {
-    if (B) myIndices[9] |=  EMskRg1Line;
-    else   myIndices[9] &= ~EMskRg1Line;
+    if (B) myIndices.SegFlags |=  EMskRg1Line;
+    else   myIndices.SegFlags &= ~EMskRg1Line;
   }
 
-  Standard_Boolean RgNLine() const { return (myIndices[9] & EMskRgNLine) != 0; }
+  Standard_Boolean RgNLine() const
+  {
+    return (myIndices.SegFlags & EMskRgNLine) != 0;
+  }
 
   void RgNLine (const Standard_Boolean B)
   {
-    if (B) myIndices[9] |=  EMskRgNLine;
-    else   myIndices[9] &= ~EMskRgNLine;
+    if (B) myIndices.SegFlags |=  EMskRgNLine;
+    else   myIndices.SegFlags &= ~EMskRgNLine;
   }
 
-  Standard_Boolean OutLine() const { return (myIndices[9] & EMskOutLine) != 0; }
+  Standard_Boolean OutLine() const
+  {
+    return (myIndices.SegFlags & EMskOutLine) != 0;
+  }
 
   void OutLine (const Standard_Boolean B)
   {
-    if (B) myIndices[9] |=  EMskOutLine;
-    else   myIndices[9] &= ~EMskOutLine;
+    if (B) myIndices.SegFlags |=  EMskOutLine;
+    else   myIndices.SegFlags &= ~EMskOutLine;
   }
 
-  Standard_Boolean IntLine() const { return (myIndices[9] & EMskIntLine) != 0; }
+  Standard_Boolean IntLine() const
+  {
+    return (myIndices.SegFlags & EMskIntLine) != 0;
+  }
 
   void IntLine (const Standard_Boolean B)
   {
-    if (B) myIndices[9] |=  EMskIntLine;
-    else   myIndices[9] &= ~EMskIntLine;
+    if (B) myIndices.SegFlags |=  EMskIntLine;
+    else   myIndices.SegFlags &= ~EMskIntLine;
   }
 
-  Standard_Boolean Hidden() const { return (myIndices[9] & EMskHidden) != 0; }
+  Standard_Boolean Hidden() const
+  {
+    return (myIndices.SegFlags & EMskHidden) != 0;
+  }
 
   void Hidden (const Standard_Boolean B)
   {
-    if (B) myIndices[9] |=  EMskHidden;
-    else   myIndices[9] &= ~EMskHidden;
+    if (B) myIndices.SegFlags |=  EMskHidden;
+    else   myIndices.SegFlags &= ~EMskHidden;
   }
 
-  Standard_Address Indices()     const { return const_cast<Standard_Integer* >(myIndices); }
+  IndicesT& Indices()
+  {
+    return myIndices;
+  }
 
-  Standard_Address Coordinates() const { return const_cast<Standard_Real* >(myCoordinates); }
+  PointsT& Points()
+  {
+    return myPoints;
+  }
 
 protected:
 
@@ -104,9 +157,8 @@ protected:
   };
 
 private:
-
-  Standard_Integer myIndices[10];
-  Standard_Real myCoordinates[12];
+  IndicesT myIndices;
+  PointsT myPoints;
 
 };
 
diff --git a/src/HLRAlgo/HLRAlgo_Coincidence.cxx b/src/HLRAlgo/HLRAlgo_Coincidence.cxx
deleted file mode 100644 (file)
index 944d46f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// Created on: 1992-02-19
-// Created by: Christophe MARION
-// 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 <HLRAlgo_Coincidence.hxx>
-
-//=======================================================================
-//function : HLRAlgo_Coincidence
-//purpose  : 
-//=======================================================================
-HLRAlgo_Coincidence::HLRAlgo_Coincidence()
- : myFE(0),
-   myParam(0.),
-   myStBef(TopAbs_IN),
-   myStAft(TopAbs_IN)
-{
-}
index 26d23a8..d53e7b9 100644 (file)
@@ -25,7 +25,6 @@
 #include <Standard_Real.hxx>
 #include <TopAbs_State.hxx>
 
-
 //! The Coincidence class is used in an Inteference to
 //! store informations on the "hiding" edge.
 //!
 //! intersection   with  the face (before  and after).
 //! This is necessary  when the  intersection is  "ON"
 //! the face.
-class HLRAlgo_Coincidence 
+class HLRAlgo_Coincidence
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
-  Standard_EXPORT HLRAlgo_Coincidence();
-  
-    void Set2D (const Standard_Integer FE, const Standard_Real Param);
-  
-    void SetState3D (const TopAbs_State stbef, const TopAbs_State staft);
-  
-    void Value2D (Standard_Integer& FE, Standard_Real& Param) const;
-  
-    void State3D (TopAbs_State& stbef, TopAbs_State& staft) const;
-
-
-
-
-protected:
-
-
-
-
+  Standard_EXPORT HLRAlgo_Coincidence() :
+    myFE(0),
+    myParam(0.),
+    myStBef(TopAbs_IN),
+    myStAft(TopAbs_IN)
+  {
+  }
+
+  void Set2D (const Standard_Integer FE, const Standard_Real Param)
+  {
+    myFE    = FE;
+    myParam = Param;
+  }
+
+  void SetState3D (const TopAbs_State stbef, const TopAbs_State staft)
+  {
+    myStBef = stbef;
+    myStAft = staft;
+  }
+
+  void Value2D (Standard_Integer& FE, Standard_Real& Param) const
+  {
+    FE    = myFE;
+    Param = myParam;
+  }
+
+  void State3D (TopAbs_State& stbef, TopAbs_State& staft) const
+  {
+    stbef = myStBef;
+    staft = myStAft;
+  }
 
 private:
-
-
-
   Standard_Integer myFE;
   Standard_Real myParam;
   TopAbs_State myStBef;
   TopAbs_State myStAft;
-
-
 };
 
-
-#include <HLRAlgo_Coincidence.lxx>
-
-
-
-
-
 #endif // _HLRAlgo_Coincidence_HeaderFile
diff --git a/src/HLRAlgo/HLRAlgo_Coincidence.lxx b/src/HLRAlgo/HLRAlgo_Coincidence.lxx
deleted file mode 100644 (file)
index d4acb5a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-// Created on: 1992-02-19
-// Created by: Christophe MARION
-// 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.
-
-//=======================================================================
-//function : Set2D
-//purpose  : 
-//=======================================================================
-
-inline void  HLRAlgo_Coincidence::Set2D
-  (const Standard_Integer FE,
-   const Standard_Real Param)
-{
-  myFE    = FE;
-  myParam = Param;
-}
-
-//=======================================================================
-//function : SetState3D
-//purpose  : 
-//=======================================================================
-
-inline void  HLRAlgo_Coincidence::SetState3D
-  (const TopAbs_State stbef,const TopAbs_State staft)
-{
-  myStBef = stbef;
-  myStAft = staft;
-}
-
-//=======================================================================
-//function : Value2D
-//purpose  : 
-//=======================================================================
-
-inline void  HLRAlgo_Coincidence::Value2D
-  (Standard_Integer& FE,
-   Standard_Real& Param) const
-{
-  FE    = myFE;
-  Param = myParam;
-}
-
-//=======================================================================
-//function : State3D
-//purpose  : 
-//=======================================================================
-
-inline void  HLRAlgo_Coincidence::State3D
-  (TopAbs_State& stbef,TopAbs_State& staft) const
-{
-  stbef = myStBef;
-  staft = myStAft;
-}
index 0521b94..a03cb48 100644 (file)
@@ -34,9 +34,9 @@ HLRAlgo_EdgeIterator::HLRAlgo_EdgeIterator ()
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo_EdgeIterator::InitHidden (const HLRAlgo_EdgeStatus& status)
+void HLRAlgo_EdgeIterator::InitHidden (HLRAlgo_EdgeStatus& status)
 {
-  EHid = (Standard_Address)&status;
+  EHid = &status;
   iHid = 1;
   if (((HLRAlgo_EdgeStatus*)EHid)->AllHidden()) {
     ((HLRAlgo_EdgeStatus*)EHid)->Bounds
index 24c1bcd..dd32329 100644 (file)
@@ -22,7 +22,6 @@
 #include <Standard_Handle.hxx>
 
 #include <Standard_Integer.hxx>
-#include <Standard_Address.hxx>
 #include <Standard_Real.hxx>
 #include <Standard_ShortReal.hxx>
 #include <Standard_Boolean.hxx>
@@ -41,7 +40,7 @@ public:
   //! edge.
   Standard_EXPORT HLRAlgo_EdgeIterator();
   
-  Standard_EXPORT void InitHidden (const HLRAlgo_EdgeStatus& status);
+  Standard_EXPORT void InitHidden (HLRAlgo_EdgeStatus& status);
   
     Standard_Boolean MoreHidden() const;
   
@@ -51,7 +50,7 @@ public:
   //! of the current Hidden Interval
     void Hidden (Standard_Real& Start, Standard_ShortReal& TolStart, Standard_Real& End, Standard_ShortReal& TolEnd) const;
   
-    void InitVisible (const HLRAlgo_EdgeStatus& status);
+    void InitVisible (HLRAlgo_EdgeStatus& status);
   
     Standard_Boolean MoreVisible() const;
   
@@ -76,8 +75,8 @@ private:
 
   Standard_Integer myNbVis;
   Standard_Integer myNbHid;
-  Standard_Address EVis;
-  Standard_Address EHid;
+  HLRAlgo_EdgeStatus* EVis;
+  HLRAlgo_EdgeStatus* EHid;
   Standard_Integer iVis;
   Standard_Integer iHid;
   Standard_Real myHidStart;
index efda685..df94190 100644 (file)
@@ -47,9 +47,9 @@ HLRAlgo_EdgeIterator::Hidden (Standard_Real& Start,
 //=======================================================================
 
 inline void 
-HLRAlgo_EdgeIterator::InitVisible (const HLRAlgo_EdgeStatus& status)
+HLRAlgo_EdgeIterator::InitVisible(HLRAlgo_EdgeStatus& status)
 {
-  EVis    = (Standard_Address)&status;
+  EVis    = &status;
   iVis    = 1;
   myNbVis = ((HLRAlgo_EdgeStatus*)EVis)->NbVisiblePart();
 }
index 9c1cbe1..1521990 100644 (file)
@@ -31,14 +31,3 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_EdgesBlock,MMgt_TShared)
 HLRAlgo_EdgesBlock::HLRAlgo_EdgesBlock (const Standard_Integer NbEdges) :
   myEdges(1,NbEdges), myFlags(1,NbEdges)
 {}
-
-//=======================================================================
-//function : UpdateMinMax
-//purpose  : 
-//=======================================================================
-
-void HLRAlgo_EdgesBlock::UpdateMinMax (const Standard_Address TotMinMax)
-{
-  for (Standard_Integer i = 0; i <= 15; i++)
-    myMinMax[i] = ((Standard_Integer*)TotMinMax)[i];
-}
index 2b86d8f..3e5d384 100644 (file)
@@ -26,7 +26,6 @@
 #include <MMgt_TShared.hxx>
 #include <TopAbs_Orientation.hxx>
 #include <Standard_Boolean.hxx>
-#include <Standard_Address.hxx>
 
 
 class HLRAlgo_EdgesBlock;
@@ -48,6 +47,42 @@ class HLRAlgo_EdgesBlock : public MMgt_TShared
 {
 
 public:
+  struct MinMaxIndices
+  {
+    Standard_Integer Min[8], Max[8];
+
+    MinMaxIndices& Minimize(const MinMaxIndices& theMinMaxIndices)
+    {
+      for (Standard_Integer aI = 0; aI < 8; ++aI)
+      {
+        if (Min[aI] > theMinMaxIndices.Min[aI])
+        {
+          Min[aI] = theMinMaxIndices.Min[aI];
+        }
+        if (Max[aI] > theMinMaxIndices.Max[aI])
+        {
+          Max[aI] = theMinMaxIndices.Max[aI];
+        }
+      }
+      return *this;
+    }
+
+    MinMaxIndices& Maximize(const MinMaxIndices& theMinMaxIndices)
+    {
+      for (Standard_Integer aI = 0; aI < 8; ++aI)
+      {
+        if (Min[aI] < theMinMaxIndices.Min[aI])
+        {
+          Min[aI] = theMinMaxIndices.Min[aI];
+        }
+        if (Max[aI] < theMinMaxIndices.Max[aI])
+        {
+          Max[aI] = theMinMaxIndices.Max[aI];
+        }
+      }
+      return *this;
+    }
+  };
 
   //! Create a Block of Edges for a wire.
   Standard_EXPORT HLRAlgo_EdgesBlock(const Standard_Integer NbEdges);
@@ -101,9 +136,15 @@ public:
     else   myFlags(I) &= ~EMaskIsoLine;
   }
 
-  Standard_EXPORT void UpdateMinMax (const Standard_Address TotMinMax);
+  void UpdateMinMax(const MinMaxIndices& TotMinMax)
+  {
+    myMinMax = TotMinMax;
+  }
 
-  Standard_Address MinMax() const { return (Standard_Address )&myMinMax; }
+  MinMaxIndices& MinMax()
+  {
+    return myMinMax;
+  }
 
   DEFINE_STANDARD_RTTIEXT(HLRAlgo_EdgesBlock,MMgt_TShared)
 
@@ -122,8 +163,7 @@ private:
 
   TColStd_Array1OfInteger myEdges;
   TColStd_Array1OfInteger myFlags;
-  Standard_Integer myMinMax[16];
-
+  MinMaxIndices myMinMax;
 };
 
 #endif // _HLRAlgo_EdgesBlock_HeaderFile
index c9903a0..0884be8 100644 (file)
 #include <HLRAlgo_EdgeStatus.hxx>
 #include <HLRAlgo_ListOfBPoint.hxx>
 #include <HLRAlgo_PolyAlgo.hxx>
-#include <HLRAlgo_PolyData.hxx>
 #include <HLRAlgo_PolyShellData.hxx>
+#include <HLRAlgo_PolyMask.hxx>
+
 #include <Precision.hxx>
 #include <Standard_Type.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyAlgo,MMgt_TShared)
 
-#define EMskGrALin1  ((Standard_Integer)   8)
-#define EMskGrALin2  ((Standard_Integer)  16)
-#define EMskGrALin3  ((Standard_Integer)  32)
-#define FMskHiding   ((Standard_Integer) 256)
-
-#define TriNode1 ((Standard_Integer*)TriIndices)[0]
-#define TriNode2 ((Standard_Integer*)TriIndices)[1]
-#define TriNode3 ((Standard_Integer*)TriIndices)[2]
-#define TriFlags ((Standard_Integer*)TriIndices)[3]
-
-#define XV1          myRealPtr[0]
-#define XV2          myRealPtr[1]
-#define XV3          myRealPtr[2]
-#define YV1          myRealPtr[3]
-#define YV2          myRealPtr[4]
-#define YV3          myRealPtr[5]
-#define Param        myRealPtr[6]
-#define myTolParam   myRealPtr[7]
-#define myTolAngular myRealPtr[8]
-#define myTolerance  myRealPtr[9]
-
-#define PntX1  ((Standard_Real*)Coordinates)[ 0]
-#define PntY1  ((Standard_Real*)Coordinates)[ 1]
-#define PntZ1  ((Standard_Real*)Coordinates)[ 2]
-#define PntX2  ((Standard_Real*)Coordinates)[ 3]
-#define PntY2  ((Standard_Real*)Coordinates)[ 4]
-#define PntZ2  ((Standard_Real*)Coordinates)[ 5]
-#define PntXP1 ((Standard_Real*)Coordinates)[ 6]
-#define PntYP1 ((Standard_Real*)Coordinates)[ 7]
-#define PntZP1 ((Standard_Real*)Coordinates)[ 8]
-#define PntXP2 ((Standard_Real*)Coordinates)[ 9]
-#define PntYP2 ((Standard_Real*)Coordinates)[10]
-#define PntZP2 ((Standard_Real*)Coordinates)[11]
-
-#define TotXMin    ((Standard_Real*)TotMinMax)[0]
-#define TotYMin    ((Standard_Real*)TotMinMax)[1]
-#define TotZMin    ((Standard_Real*)TotMinMax)[2]
-#define TotXMax    ((Standard_Real*)TotMinMax)[3]
-#define TotYMax    ((Standard_Real*)TotMinMax)[4]
-#define TotZMax    ((Standard_Real*)TotMinMax)[5]
-
-#define ShapeIndex ((Standard_Integer*)IndexPtr)[0]
-#define FaceConex1 ((Standard_Integer*)IndexPtr)[1]
-#define Face1Pt1   ((Standard_Integer*)IndexPtr)[2]
-#define Face1Pt2   ((Standard_Integer*)IndexPtr)[3]
-#define FaceConex2 ((Standard_Integer*)IndexPtr)[4]
-#define Face2Pt1   ((Standard_Integer*)IndexPtr)[5]
-#define Face2Pt2   ((Standard_Integer*)IndexPtr)[6]
-#define MinSeg     ((Standard_Integer*)IndexPtr)[7]
-#define MaxSeg     ((Standard_Integer*)IndexPtr)[8]
-#define SegFlags   ((Standard_Integer*)IndexPtr)[9]
-
-#define MinShell ((Standard_Integer*)ShellIndices)[0]
-#define MaxShell ((Standard_Integer*)ShellIndices)[1]
-
-#define FIndex   ((Standard_Integer*)PolyTIndices)[0]
-#define MinPolyT ((Standard_Integer*)PolyTIndices)[1]
-#define MaxPolyT ((Standard_Integer*)PolyTIndices)[2]
-
 //static Standard_Integer ERROR = Standard_False;
 
 //=======================================================================
@@ -98,8 +40,8 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyAlgo,MMgt_TShared)
 
 HLRAlgo_PolyAlgo::HLRAlgo_PolyAlgo ()
 {
-  myTolParam   = 0.00000001;
-  myTolAngular = 0.0001;
+  myTriangle.TolParam   = 0.00000001;
+  myTriangle.TolAng = 0.0001;
 }
 
 //=======================================================================
@@ -141,45 +83,39 @@ void HLRAlgo_PolyAlgo::Update ()
   Standard_Real xTrianMax,yTrianMax,zTrianMax;
   Standard_Real xSegmnMin,ySegmnMin,zSegmnMin;
   Standard_Real xSegmnMax,ySegmnMax,zSegmnMax;
-  Standard_Real TotMinMax[6];
   Standard_Real Big = Precision::Infinite();
-  TotMinMax[0] =  Big;
-  TotMinMax[1] =  Big;
-  TotMinMax[2] =  Big;
-  TotMinMax[3] = -Big;
-  TotMinMax[4] = -Big;
-  TotMinMax[5] = -Big;
+  HLRAlgo_PolyData::Box aBox(Big, Big, Big, -Big, -Big, -Big);
   TColStd_Array1OfTransient& Shell = myHShell->ChangeArray1();
   myNbrShell = Shell.Upper();
   Handle(HLRAlgo_PolyShellData)* psd1 = 
     (Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1));
 
   for (i = 1; i <= myNbrShell; i++) {
-    (*psd1)->UpdateGlobalMinMax(&TotMinMax);
+    (*psd1)->UpdateGlobalMinMax(aBox);
     psd1++;
   }
 
-  Standard_Real dx = TotMinMax[3] - TotMinMax[0];
-  Standard_Real dy = TotMinMax[4] - TotMinMax[1];
-  Standard_Real dz = TotMinMax[5] - TotMinMax[2];
+  Standard_Real dx = aBox.XMax - aBox.XMin;
+  Standard_Real dy = aBox.YMax - aBox.YMin;
+  Standard_Real dz = aBox.ZMax - aBox.ZMin;
   Standard_Real    precad = dx;
   if (precad < dy) precad = dy;
   if (precad < dz) precad = dz;
-  myTolerance = precad * myTolParam;
+  myTriangle.Tolerance = precad * myTriangle.TolParam;
   precad = precad * 0.01;
   Standard_Real SurDX = 1020 / (dx + precad);
   Standard_Real SurDY = 1020 / (dy + precad);
   Standard_Real SurDZ =  508 / (dz + precad);
   precad = precad * 0.5;
-  Standard_Real DecaX = - TotMinMax[0] + precad;
-  Standard_Real DecaY = - TotMinMax[1] + precad;
-  Standard_Real DecaZ = - TotMinMax[2] + precad;
+  Standard_Real DecaX = - aBox.XMin + precad;
+  Standard_Real DecaY = - aBox.YMin + precad;
+  Standard_Real DecaZ = - aBox.ZMin + precad;
 
   Handle(HLRAlgo_PolyShellData)* psd2 = 
     (Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1));
 
   for (i = 1; i <= myNbrShell; i++) {
-    const Standard_Address ShellIndices = (*psd2)->Indices();
+    HLRAlgo_PolyShellData::ShellIndices& aShellIndices = (*psd2)->Indices();
     xShellMin =  Big;
     yShellMin =  Big;
     zShellMin =  Big;
@@ -191,26 +127,26 @@ void HLRAlgo_PolyAlgo::Update ()
         mySegListIt.More();
         mySegListIt.Next()) {      
       HLRAlgo_BiPoint& BP = mySegListIt.Value();
-      const Standard_Address Coordinates = BP.Coordinates();
-      const Standard_Address IndexPtr    = BP.Indices();
-      if (PntXP1 < PntXP2) { xSegmnMin = PntXP1; xSegmnMax = PntXP2; }
-      else                 { xSegmnMin = PntXP2; xSegmnMax = PntXP1; }
-      if (PntYP1 < PntYP2) { ySegmnMin = PntYP1; ySegmnMax = PntYP2; }
-      else                 { ySegmnMin = PntYP2; ySegmnMax = PntYP1; }
-      if (PntZP1 < PntZP2) { zSegmnMin = PntZP1; zSegmnMax = PntZP2; }
-      else                 { zSegmnMin = PntZP2; zSegmnMax = PntZP1; }
+      HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+      HLRAlgo_BiPoint::IndicesT& theIndices = BP.Indices();
+      if (aPoints.PntP1.X() < aPoints.PntP2.X()) { xSegmnMin = aPoints.PntP1.X(); xSegmnMax = aPoints.PntP2.X(); }
+      else                 { xSegmnMin = aPoints.PntP2.X(); xSegmnMax = aPoints.PntP1.X(); }
+      if (aPoints.PntP1.Y() < aPoints.PntP2.Y()) { ySegmnMin = aPoints.PntP1.Y(); ySegmnMax = aPoints.PntP2.Y(); }
+      else                 { ySegmnMin = aPoints.PntP2.Y(); ySegmnMax = aPoints.PntP1.Y(); }
+      if (aPoints.PntP1.Z() < aPoints.PntP2.Z()) { zSegmnMin = aPoints.PntP1.Z(); zSegmnMax = aPoints.PntP2.Z(); }
+      else                 { zSegmnMin = aPoints.PntP2.Z(); zSegmnMax = aPoints.PntP1.Z(); }
       nxMin = (Standard_Integer)((DecaX + xSegmnMin) * SurDX);
       nyMin = (Standard_Integer)((DecaY + ySegmnMin) * SurDY);
       nzMin = (Standard_Integer)((DecaZ + zSegmnMin) * SurDZ);
       nxMax = (Standard_Integer)((DecaX + xSegmnMax) * SurDX);
       nyMax = (Standard_Integer)((DecaY + ySegmnMax) * SurDY);
       nzMax = (Standard_Integer)((DecaZ + zSegmnMax) * SurDZ);
-      MinSeg = nyMin + (nxMin << 11);
-      MinSeg <<= 10;
-      MinSeg += nzMin;
-      MaxSeg = nyMax + (nxMax << 11);
-      MaxSeg <<= 10;
-      MaxSeg += nzMax + 0x00000200;
+      theIndices.MinSeg = nyMin + (nxMin << 11);
+      theIndices.MinSeg <<= 10;
+      theIndices.MinSeg += nzMin;
+      theIndices.MaxSeg = nyMax + (nxMax << 11);
+      theIndices.MaxSeg <<= 10;
+      theIndices.MaxSeg += nzMax + 0x00000200;
       if (xShellMin > xSegmnMin) xShellMin = xSegmnMin;
       if (xShellMax < xSegmnMax) xShellMax = xSegmnMax;
       if (yShellMin > ySegmnMin) yShellMin = ySegmnMin;
@@ -238,7 +174,7 @@ void HLRAlgo_PolyAlgo::Update ()
        Standard_Real dn,dnx,dny,dnz,dx1,dy1,dz1,dx2,dy2,dz2,dx3,dy3;
        Standard_Real adx1,ady1,adx2,ady2,adx3,ady3;
        Standard_Real a =0.,b =0.,c =0.,d =0.;
-       const Standard_Address PolyTIndices = (*pd)->Indices();
+       HLRAlgo_PolyData::FaceIndices& PolyTIndices = (*pd)->Indices();
        TColgp_Array1OfXYZ   & Nodes        = (*pd)->Nodes();
        HLRAlgo_Array1OfTData& TData        = (*pd)->TData();
        HLRAlgo_Array1OfPHDat& PHDat        = (*pd)->PHDat();
@@ -246,11 +182,10 @@ void HLRAlgo_PolyAlgo::Update ()
        HLRAlgo_TriangleData* TD = &(TData.ChangeValue(1));
        
        for (otheri = 1; otheri <= nbT; otheri++) {
-         const Standard_Address TriIndices = TD->Indices();
-         if (TriFlags & FMskHiding) {
-           const gp_XYZ& P1 = Nodes(TriNode1);
-           const gp_XYZ& P2 = Nodes(TriNode2);
-           const gp_XYZ& P3 = Nodes(TriNode3);
+         if (TD->Flags & HLRAlgo_PolyMask_FMskHiding) {
+           const gp_XYZ& P1 = Nodes(TD->Node1);
+           const gp_XYZ& P2 = Nodes(TD->Node2);
+           const gp_XYZ& P3 = Nodes(TD->Node3);
            X1 = P1.X();
            Y1 = P1.Y();
            Z1 = P1.Z();
@@ -320,12 +255,12 @@ void HLRAlgo_PolyAlgo::Update ()
            ady3 = dy3;
            if (dx3 < 0) adx3 = -dx3;
            if (dy3 < 0) ady3 = -dy3;
-           if (adx1 > ady1) TriFlags |=  EMskGrALin1;
-           else             TriFlags &= ~EMskGrALin1;
-           if (adx2 > ady2) TriFlags |=  EMskGrALin2;
-           else             TriFlags &= ~EMskGrALin2;
-           if (adx3 > ady3) TriFlags |=  EMskGrALin3;
-           else             TriFlags &= ~EMskGrALin3;
+           if (adx1 > ady1) TD->Flags |=  HLRAlgo_PolyMask_EMskGrALin1;
+           else             TD->Flags &= ~HLRAlgo_PolyMask_EMskGrALin1;
+           if (adx2 > ady2) TD->Flags |=  HLRAlgo_PolyMask_EMskGrALin2;
+           else             TD->Flags &= ~HLRAlgo_PolyMask_EMskGrALin2;
+           if (adx3 > ady3) TD->Flags |=  HLRAlgo_PolyMask_EMskGrALin3;
+           else             TD->Flags &= ~HLRAlgo_PolyMask_EMskGrALin3;
            if (xPolyTMin > xTrianMin) xPolyTMin = xTrianMin;
            if (xPolyTMax < xTrianMax) xPolyTMax = xTrianMax;
            if (yPolyTMin > yTrianMin) yPolyTMin = yTrianMin;
@@ -341,12 +276,12 @@ void HLRAlgo_PolyAlgo::Update ()
        nxMax = (Standard_Integer)((DecaX + xPolyTMax) * SurDX);
        nyMax = (Standard_Integer)((DecaY + yPolyTMax) * SurDY);
        nzMax = (Standard_Integer)((DecaZ + zPolyTMax) * SurDZ);
-       MinPolyT   = nyMin + (nxMin << 11);
-       MinPolyT <<= 10;
-       MinPolyT  += nzMin - 0x00000200;
-       MaxPolyT   = nyMax + (nxMax << 11);
-       MaxPolyT <<= 10;
-       MaxPolyT  += nzMax;
+       PolyTIndices.Min = nyMin + (nxMin << 11);
+       PolyTIndices.Min <<= 10;
+       PolyTIndices.Min  += nzMin - 0x00000200;
+       PolyTIndices.Max   = nyMax + (nxMax << 11);
+       PolyTIndices.Max <<= 10;
+       PolyTIndices.Max  += nzMax;
        if (xShellMin > xPolyTMin) xShellMin = xPolyTMin;
        if (xShellMax < xPolyTMax) xShellMax = xPolyTMax;
        if (yShellMin > yPolyTMin) yShellMin = yPolyTMin;
@@ -363,12 +298,12 @@ void HLRAlgo_PolyAlgo::Update ()
       nxMax = (Standard_Integer)((DecaX + xShellMax) * SurDX);
       nyMax = (Standard_Integer)((DecaY + yShellMax) * SurDY);
       nzMax = (Standard_Integer)((DecaZ + zShellMax) * SurDZ);
-      MinShell   = nyMin + (nxMin << 11);
-      MinShell <<= 10;
-      MinShell  += nzMin - 0x00000200;
-      MaxShell   = nyMax + (nxMax << 11);
-      MaxShell <<= 10;
-      MaxShell  += nzMax;
+      aShellIndices.Min = nyMin + (nxMin << 11);
+      aShellIndices.Min <<= 10;
+      aShellIndices.Min += nzMin - 0x00000200;
+      aShellIndices.Max = nyMax + (nxMax << 11);
+      aShellIndices.Max <<= 10;
+      aShellIndices.Max += nzMax;
       (*psd2)->UpdateHiding(nbFaHi);
       TColStd_Array1OfTransient& PolHi = (*psd2)->HidingPolyData();
       pd = (Handle(HLRAlgo_PolyData)*)&(Polyg.ChangeValue(1));
@@ -385,8 +320,8 @@ void HLRAlgo_PolyAlgo::Update ()
     }
     else {
       (*psd2)->UpdateHiding(0);
-      MinShell = 0;
-      MaxShell = 0;
+      aShellIndices.Min = 0;
+      aShellIndices.Max = 0;
     }
     psd2++;
   }
@@ -427,7 +362,7 @@ void HLRAlgo_PolyAlgo::NextHide ()
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
+HLRAlgo_BiPoint::PointsT& HLRAlgo_PolyAlgo::Hide (
                             HLRAlgo_EdgeStatus& status,
                             Standard_Integer& Index,
                             Standard_Boolean& reg1,
@@ -436,10 +371,10 @@ void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
                             Standard_Boolean& intl)
 {
   HLRAlgo_BiPoint& BP             = mySegListIt.Value();
-  Coordinates                     = BP.Coordinates();
-  const Standard_Address IndexPtr = BP.Indices();
-  status = HLRAlgo_EdgeStatus(0.,(Standard_ShortReal)myTolParam,1.,(Standard_ShortReal)myTolParam);
-  Index = ShapeIndex;
+  HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+  HLRAlgo_BiPoint::IndicesT& theIndices = BP.Indices();
+  status = HLRAlgo_EdgeStatus(0.,(Standard_ShortReal)myTriangle.TolParam,1.,(Standard_ShortReal)myTriangle.TolParam);
+  Index = theIndices.ShapeIndex;
   reg1       = BP.Rg1Line();
   regn       = BP.RgNLine();
   outl       = BP.OutLine();
@@ -454,9 +389,9 @@ void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
     
     for (Standard_Integer s = 1; s <= myNbrShell; s++) {
       if ((*psd)->Hiding()) {
-       const Standard_Address ShellIndices = (*psd)->Indices();
-       if (((MaxShell - MinSeg) & 0x80100200) == 0 &&
-           ((MaxSeg - MinShell) & 0x80100000) == 0) {
+       HLRAlgo_PolyShellData::ShellIndices& aShellIndices = (*psd)->Indices();
+       if (((aShellIndices.Max - theIndices.MinSeg) & 0x80100200) == 0 &&
+           ((theIndices.MaxSeg - aShellIndices.Min) & 0x80100000) == 0) {
          HidingShell = (s == myCurShell);
          TColStd_Array1OfTransient& Face = (*psd)->HidingPolyData();
          Standard_Integer nbFace = Face.Upper();
@@ -464,9 +399,9 @@ void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
            (Handle(HLRAlgo_PolyData)*)&(Face.ChangeValue(1));
          
          for (Standard_Integer f = 1; f <= nbFace; f++) {
-           (*pd)->HideByPolyData(Coordinates,
-                                 (Standard_Address)myRealPtr,
-                                 IndexPtr,
+           (*pd)->HideByPolyData(aPoints,
+                                 myTriangle,
+                                 theIndices,
                                  HidingShell,
                                  status);
            pd++;
@@ -476,6 +411,7 @@ void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates,
       psd++;
     }
   }
+  return aPoints;
 }
 
 //=======================================================================
@@ -508,7 +444,7 @@ void HLRAlgo_PolyAlgo::NextShow ()
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo_PolyAlgo::Show (Standard_Address& Coordinates,
+HLRAlgo_BiPoint::PointsT& HLRAlgo_PolyAlgo::Show (
                             Standard_Integer& Index,
                             Standard_Boolean& reg1,
                             Standard_Boolean& regn,
@@ -516,12 +452,13 @@ void HLRAlgo_PolyAlgo::Show (Standard_Address& Coordinates,
                             Standard_Boolean& intl)
 {
   HLRAlgo_BiPoint& BP = mySegListIt.Value();
-  Standard_Address IndexPtr = BP.Indices();
-  Coordinates = BP.Coordinates();
-  Index = ShapeIndex;
+  HLRAlgo_BiPoint::IndicesT& theIndices = BP.Indices();
+  HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+  Index = theIndices.ShapeIndex;
   reg1  = BP.Rg1Line();
   regn  = BP.RgNLine();
   outl  = BP.OutLine();
   intl  = BP.IntLine();
+  return aPoints;
 }
 
index f987a31..4ef2aef 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _HLRAlgo_PolyAlgo_HeaderFile
 #define _HLRAlgo_PolyAlgo_HeaderFile
 
+#include <HLRAlgo_PolyData.hxx>
+
 #include <Standard.hxx>
 #include <Standard_Type.hxx>
 
@@ -27,7 +29,7 @@
 #include <Standard_Boolean.hxx>
 #include <MMgt_TShared.hxx>
 #include <TColStd_Array1OfTransient.hxx>
-#include <Standard_Address.hxx>
+
 class HLRAlgo_EdgeStatus;
 
 
@@ -59,7 +61,7 @@ public:
   Standard_EXPORT void NextHide();
   
   //! process hiding between <Pt1> and <Pt2>.
-  Standard_EXPORT void Hide (Standard_Address& Coordinates, HLRAlgo_EdgeStatus& status, Standard_Integer& Index, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
+  Standard_EXPORT HLRAlgo_BiPoint::PointsT& Hide (HLRAlgo_EdgeStatus& status, Standard_Integer& Index, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
   
     void InitShow();
   
@@ -68,7 +70,7 @@ public:
   Standard_EXPORT void NextShow();
   
   //! process hiding between <Pt1> and <Pt2>.
-  Standard_EXPORT void Show (Standard_Address& Coordinates, Standard_Integer& Index, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
+  Standard_EXPORT HLRAlgo_BiPoint::PointsT& Show (Standard_Integer& Index, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
 
 
 
@@ -84,7 +86,7 @@ private:
 
 
   Handle(TColStd_HArray1OfTransient) myHShell;
-  Standard_Real myRealPtr[10];
+  HLRAlgo_PolyData::Triangle myTriangle;
   HLRAlgo_ListIteratorOfListOfBPoint mySegListIt;
   Standard_Integer myNbrShell;
   Standard_Integer myCurShell;
index 759d60f..b57055b 100644 (file)
 #include <HLRAlgo_PolyData.hxx>
 
 #include <HLRAlgo_EdgeStatus.hxx>
+#include <HLRAlgo_PolyMask.hxx>
 
 #include <Standard_Type.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyData,MMgt_TShared)
 
-#define EMskGrALin1  ((Standard_Integer)   8)
-#define EMskGrALin2  ((Standard_Integer)  16)
-#define EMskGrALin3  ((Standard_Integer)  32)
-#define FMskHiding   ((Standard_Integer) 256)
-
-#define FIndex  myIndices[0]
-#define MinFac  myIndices[1]
-#define MaxFac  myIndices[2]
-
-#define TriNode1   ((Standard_Integer*)TriIndices)[0]
-#define TriNode2   ((Standard_Integer*)TriIndices)[1]
-#define TriNode3   ((Standard_Integer*)TriIndices)[2]
-#define TriFlags   ((Standard_Integer*)TriIndices)[3]
-
-#define PntX1  ((Standard_Real*)Coordinates)[ 0]
-#define PntY1  ((Standard_Real*)Coordinates)[ 1]
-#define PntZ1  ((Standard_Real*)Coordinates)[ 2]
-#define PntX2  ((Standard_Real*)Coordinates)[ 3]
-#define PntY2  ((Standard_Real*)Coordinates)[ 4]
-#define PntZ2  ((Standard_Real*)Coordinates)[ 5]
-#define PntXP1 ((Standard_Real*)Coordinates)[ 6]
-#define PntYP1 ((Standard_Real*)Coordinates)[ 7]
-#define PntZP1 ((Standard_Real*)Coordinates)[ 8]
-#define PntXP2 ((Standard_Real*)Coordinates)[ 9]
-#define PntYP2 ((Standard_Real*)Coordinates)[10]
-#define PntZP2 ((Standard_Real*)Coordinates)[11]
-
-#define XV1        ((Standard_Real*)RealPtr)[0]
-#define XV2        ((Standard_Real*)RealPtr)[1]
-#define XV3        ((Standard_Real*)RealPtr)[2]
-#define YV1        ((Standard_Real*)RealPtr)[3]
-#define YV2        ((Standard_Real*)RealPtr)[4]
-#define YV3        ((Standard_Real*)RealPtr)[5]
-#define Param      ((Standard_Real*)RealPtr)[6]
-#define TolParam   ((Standard_Real*)RealPtr)[7]
-#define TolAng     ((Standard_Real*)RealPtr)[8]
-#define Tolerance  ((Standard_Real*)RealPtr)[9]
-
-#define TotXMin    ((Standard_Real*)TotMinMax)[0]
-#define TotYMin    ((Standard_Real*)TotMinMax)[1]
-#define TotZMin    ((Standard_Real*)TotMinMax)[2]
-#define TotXMax    ((Standard_Real*)TotMinMax)[3]
-#define TotYMax    ((Standard_Real*)TotMinMax)[4]
-#define TotZMax    ((Standard_Real*)TotMinMax)[5]
-
-#define IndexTri   ((Standard_Integer*)MinMaxPtr)[0]
-#define MinTri     ((Standard_Integer*)MinMaxPtr)[1]
-#define MaxTri     ((Standard_Integer*)MinMaxPtr)[2]
-
-#define APlan      ((Standard_Real*)PlanPtr)[0]
-#define BPlan      ((Standard_Real*)PlanPtr)[1]
-#define CPlan      ((Standard_Real*)PlanPtr)[2]
-#define DPlan      ((Standard_Real*)PlanPtr)[3]
-
-#define ShapeIndex  ((Standard_Integer*)Indices)[0]
-#define FaceConex1  ((Standard_Integer*)Indices)[1]
-#define Face1Pt1    ((Standard_Integer*)Indices)[2]
-#define Face1Pt2    ((Standard_Integer*)Indices)[3]
-#define FaceConex2  ((Standard_Integer*)Indices)[4]
-#define Face2Pt1    ((Standard_Integer*)Indices)[5]
-#define Face2Pt2    ((Standard_Integer*)Indices)[6]
-#define MinSeg      ((Standard_Integer*)Indices)[7]
-#define MaxSeg      ((Standard_Integer*)Indices)[8]
-#define SegFlags    ((Standard_Integer*)Indices)[9]
 #ifdef OCCT_DEBUG
 static Standard_Integer ERROR = Standard_False;
 #endif
@@ -127,7 +64,7 @@ void HLRAlgo_PolyData::HPHDat(const Handle(HLRAlgo_HArray1OfPHDat)& HPHDat)
 //=======================================================================
 
 void
-HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
+HLRAlgo_PolyData::UpdateGlobalMinMax (Box& theBox)
 {
   Standard_Integer i;
   Standard_Real X1,X2,X3,Y1,Y2,Y3,Z1,Z2,Z3;
@@ -137,11 +74,10 @@ HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
   HLRAlgo_TriangleData*     TD    = &(TData.ChangeValue(1));
   
   for (i = 1; i <= nbT; i++) {
-    const Standard_Address TriIndices = TD->Indices();
-    if (TriFlags & FMskHiding) {
-      const gp_XYZ& P1 = Nodes(TriNode1);
-      const gp_XYZ& P2 = Nodes(TriNode2);
-      const gp_XYZ& P3 = Nodes(TriNode3);
+    if (TD->Flags & HLRAlgo_PolyMask_FMskHiding) {
+      const gp_XYZ& P1 = Nodes(TD->Node1);
+      const gp_XYZ& P2 = Nodes(TD->Node2);
+      const gp_XYZ& P3 = Nodes(TD->Node3);
       X1 = P1.X();
       Y1 = P1.Y();
       Z1 = P1.Z();
@@ -151,24 +87,24 @@ HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
       X3 = P3.X();
       Y3 = P3.Y();
       Z3 = P3.Z();
-      if      (TotXMin > X1) TotXMin = X1;
-      else if (TotXMax < X1) TotXMax = X1;
-      if      (TotYMin > Y1) TotYMin = Y1;
-      else if (TotYMax < Y1) TotYMax = Y1;
-      if      (TotZMin > Z1) TotZMin = Z1;
-      else if (TotZMax < Z1) TotZMax = Z1;
-      if      (TotXMin > X2) TotXMin = X2;
-      else if (TotXMax < X2) TotXMax = X2;
-      if      (TotYMin > Y2) TotYMin = Y2;
-      else if (TotYMax < Y2) TotYMax = Y2;
-      if      (TotZMin > Z2) TotZMin = Z2;
-      else if (TotZMax < Z2) TotZMax = Z2;
-      if      (TotXMin > X3) TotXMin = X3;
-      else if (TotXMax < X3) TotXMax = X3;
-      if      (TotYMin > Y3) TotYMin = Y3;
-      else if (TotYMax < Y3) TotYMax = Y3;
-      if      (TotZMin > Z3) TotZMin = Z3;
-      else if (TotZMax < Z3) TotZMax = Z3;
+      if      (theBox.XMin > X1) theBox.XMin = X1;
+      else if (theBox.XMax < X1) theBox.XMax = X1;
+      if      (theBox.YMin > Y1) theBox.YMin = Y1;
+      else if (theBox.YMax < Y1) theBox.YMax = Y1;
+      if      (theBox.ZMin > Z1) theBox.ZMin = Z1;
+      else if (theBox.ZMax < Z1) theBox.ZMax = Z1;
+      if      (theBox.XMin > X2) theBox.XMin = X2;
+      else if (theBox.XMax < X2) theBox.XMax = X2;
+      if      (theBox.YMin > Y2) theBox.YMin = Y2;
+      else if (theBox.YMax < Y2) theBox.YMax = Y2;
+      if      (theBox.ZMin > Z2) theBox.ZMin = Z2;
+      else if (theBox.ZMax < Z2) theBox.ZMax = Z2;
+      if      (theBox.XMin > X3) theBox.XMin = X3;
+      else if (theBox.XMax < X3) theBox.XMax = X3;
+      if      (theBox.YMin > Y3) theBox.YMin = Y3;
+      else if (theBox.YMax < Y3) theBox.YMax = Y3;
+      if      (theBox.ZMin > Z3) theBox.ZMin = Z3;
+      else if (theBox.ZMax < Z3) theBox.ZMax = Z3;
     }
     TD++;
   }
@@ -179,14 +115,14 @@ HLRAlgo_PolyData::UpdateGlobalMinMax (const Standard_Address TotMinMax)
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo_PolyData::HideByPolyData (const Standard_Address Coordinates,
-                                      const Standard_Address RealPtr,
-                                      const Standard_Address Indices,
+void HLRAlgo_PolyData::HideByPolyData (const HLRAlgo_BiPoint::PointsT& thePoints,
+                                      Triangle& theTriangle,
+                                      HLRAlgo_BiPoint::IndicesT& theIndices,
                                       const Standard_Boolean HidingShell,
                                       HLRAlgo_EdgeStatus& status)
 {
-  if (((MaxFac - MinSeg) & 0x80100200) == 0 &&
-      ((MaxSeg - MinFac) & 0x80100000) == 0) {
+  if (((myFaceIndices.Max - theIndices.MinSeg) & 0x80100200) == 0 &&
+      ((theIndices.MaxSeg - myFaceIndices.Min) & 0x80100000) == 0) {
     HLRAlgo_Array1OfPHDat& PHDat = myHPHDat->ChangeArray1();
     const HLRAlgo_Array1OfTData& TData = myHTData->Array1();
     Standard_Real d1,d2;
@@ -194,105 +130,92 @@ void HLRAlgo_PolyData::HideByPolyData (const Standard_Address Coordinates,
     Standard_Boolean isCrossing   = Standard_False;
     Standard_Boolean toHideBefore = Standard_False;
     Standard_Integer TFlag = 0;
-    Standard_Address PlanPtr,MinMaxPtr,TriIndices;
     Standard_Integer h,h2 = PHDat.Upper();
     HLRAlgo_PolyHidingData* PH = &(PHDat(1));
     
     for (h = 1; h <= h2; h++) {
-      MinMaxPtr = PH->IndexAndMinMax();
-      if (((MaxTri - MinSeg) & 0x80100200) == 0 &&
-         ((MaxSeg - MinTri) & 0x80100000) == 0) {
-       TriIndices = TData(IndexTri).Indices();
+      HLRAlgo_PolyHidingData::TriangleIndices& aTriangleIndices = PH->Indices();
+      if (((aTriangleIndices.Max - theIndices.MinSeg) & 0x80100200) == 0 &&
+         ((theIndices.MaxSeg - aTriangleIndices.Min) & 0x80100000) == 0) {
+       const HLRAlgo_TriangleData& aTriangle = TData(aTriangleIndices.Index);
        NotConnex = Standard_True;
        if (HidingShell) {
-         if      (FIndex == FaceConex1) {
-           if      (Face1Pt1 == TriNode1)
-             NotConnex = Face1Pt2 != TriNode2 && Face1Pt2 != TriNode3;
-           else if (Face1Pt1 == TriNode2)
-             NotConnex = Face1Pt2 != TriNode3 && Face1Pt2 != TriNode1;
-           else if (Face1Pt1 == TriNode3)
-             NotConnex = Face1Pt2 != TriNode1 && Face1Pt2 != TriNode2;
+         if      (myFaceIndices.Index == theIndices.FaceConex1) {
+           if      (theIndices.Face1Pt1 == aTriangle.Node1)
+             NotConnex = theIndices.Face1Pt2 != aTriangle.Node2 && theIndices.Face1Pt2 != aTriangle.Node3;
+           else if (theIndices.Face1Pt1 == aTriangle.Node2)
+             NotConnex = theIndices.Face1Pt2 != aTriangle.Node3 && theIndices.Face1Pt2 != aTriangle.Node1;
+           else if (theIndices.Face1Pt1 == aTriangle.Node3)
+             NotConnex = theIndices.Face1Pt2 != aTriangle.Node1 && theIndices.Face1Pt2 != aTriangle.Node2;
          }
-         else if (FIndex == FaceConex2) {
-           if      (Face2Pt1 == TriNode1)
-             NotConnex = Face2Pt2 != TriNode2 && Face2Pt2 != TriNode3;
-           else if (Face2Pt1 == TriNode2)
-             NotConnex = Face2Pt2 != TriNode3 && Face2Pt2 != TriNode1;
-           else if (Face2Pt1 == TriNode3)
-             NotConnex = Face2Pt2 != TriNode1 && Face2Pt2 != TriNode2;
+         else if (myFaceIndices.Index == theIndices.FaceConex2) {
+           if      (theIndices.Face2Pt1 == aTriangle.Node1)
+             NotConnex = theIndices.Face2Pt2 != aTriangle.Node2 && theIndices.Face2Pt2 != aTriangle.Node3;
+           else if (theIndices.Face2Pt1 == aTriangle.Node2)
+             NotConnex = theIndices.Face2Pt2 != aTriangle.Node3 && theIndices.Face2Pt2 != aTriangle.Node1;
+           else if (theIndices.Face2Pt1 == aTriangle.Node3)
+             NotConnex = theIndices.Face2Pt2 != aTriangle.Node1 && theIndices.Face2Pt2 != aTriangle.Node2;
          }
        }
        if (NotConnex) {
-         PlanPtr = PH->Plan();
-         d1 = APlan * PntXP1 + BPlan * PntYP1 + CPlan * PntZP1 - DPlan;
-         d2 = APlan * PntXP2 + BPlan * PntYP2 + CPlan * PntZP2 - DPlan;
-         if      (d1 >  Tolerance) {
-           if    (d2 < -Tolerance) {
-             Param = d1 / ( d1 - d2 );
+         HLRAlgo_PolyHidingData::PlaneT& aPlane = PH->Plane();
+         d1 = aPlane.Normal * thePoints.PntP1 - aPlane.D;
+         d2 = aPlane.Normal * thePoints.PntP2 - aPlane.D;
+         if      (d1 > theTriangle.Tolerance) {
+           if    (d2 < -theTriangle.Tolerance) {
+             theTriangle.Param = d1 / ( d1 - d2 );
              toHideBefore = Standard_False;
              isCrossing   = Standard_True;
-             TFlag = TriFlags;
+             TFlag = aTriangle.Flags;
              const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
-             const gp_XYZ            & P1    = Nodes(TriNode1);
-             const gp_XYZ            & P2    = Nodes(TriNode2);
-             const gp_XYZ            & P3    = Nodes(TriNode3);
-             XV1 = P1.X();
-             YV1 = P1.Y();
-             XV2 = P2.X();
-             YV2 = P2.Y();
-             XV3 = P3.X();
-             YV3 = P3.Y();
-             hideByOneTriangle (Coordinates, RealPtr, isCrossing, toHideBefore, TFlag, status);
+             const gp_XYZ            & P1    = Nodes(aTriangle.Node1);
+             const gp_XYZ            & P2    = Nodes(aTriangle.Node2);
+             const gp_XYZ            & P3    = Nodes(aTriangle.Node3);
+        theTriangle.V1 = gp_XY(P1.X(), P1.Y());
+        theTriangle.V2 = gp_XY(P2.X(), P2.Y());
+        theTriangle.V3 = gp_XY(P3.X(), P3.Y());
+             hideByOneTriangle (thePoints, theTriangle, isCrossing, toHideBefore, TFlag, status);
            }
          }
-         else if (d1 < -Tolerance) {
-           if    (d2 >  Tolerance) {
-             Param = d1 / ( d1 - d2 );
+         else if (d1 < -theTriangle.Tolerance) {
+           if    (d2 > theTriangle.Tolerance) {
+             theTriangle.Param = d1 / ( d1 - d2 );
              toHideBefore = Standard_True;
              isCrossing   = Standard_True;
-             TFlag = TriFlags;
+             TFlag = aTriangle.Flags;
              const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
-             const gp_XYZ            & P1    = Nodes(TriNode1);
-             const gp_XYZ            & P2    = Nodes(TriNode2);
-             const gp_XYZ            & P3    = Nodes(TriNode3);
-             XV1 = P1.X();
-             YV1 = P1.Y();
-             XV2 = P2.X();
-             YV2 = P2.Y();
-             XV3 = P3.X();
-             YV3 = P3.Y();
-             hideByOneTriangle (Coordinates, RealPtr, isCrossing, toHideBefore, TFlag, status);
+             const gp_XYZ            & P1    = Nodes(aTriangle.Node1);
+             const gp_XYZ            & P2    = Nodes(aTriangle.Node2);
+             const gp_XYZ            & P3    = Nodes(aTriangle.Node3);
+             theTriangle.V1 = gp_XY(P1.X(), P1.Y());
+             theTriangle.V2 = gp_XY(P2.X(), P2.Y());
+             theTriangle.V3 = gp_XY(P3.X(), P3.Y());
+             hideByOneTriangle (thePoints, theTriangle, isCrossing, toHideBefore, TFlag, status);
            }
            else {
              isCrossing = Standard_False;
-             TFlag = TriFlags;
+             TFlag = aTriangle.Flags;
              const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
-             const gp_XYZ            & P1    = Nodes(TriNode1);
-             const gp_XYZ            & P2    = Nodes(TriNode2);
-             const gp_XYZ            & P3    = Nodes(TriNode3);
-             XV1 = P1.X();
-             YV1 = P1.Y();
-             XV2 = P2.X();
-             YV2 = P2.Y();
-             XV3 = P3.X();
-             YV3 = P3.Y();
-             hideByOneTriangle (Coordinates, RealPtr, isCrossing, toHideBefore, TFlag, status);
+             const gp_XYZ            & P1    = Nodes(aTriangle.Node1);
+             const gp_XYZ            & P2    = Nodes(aTriangle.Node2);
+             const gp_XYZ            & P3    = Nodes(aTriangle.Node3);
+             theTriangle.V1 = gp_XY(P1.X(), P1.Y());
+             theTriangle.V2 = gp_XY(P2.X(), P2.Y());
+             theTriangle.V3 = gp_XY(P3.X(), P3.Y());
+             hideByOneTriangle (thePoints, theTriangle, isCrossing, toHideBefore, TFlag, status);
            }
          }
-         else if (d2 < -Tolerance) {
+         else if (d2 < -theTriangle.Tolerance) {
            isCrossing = Standard_False;
-           TFlag = TriFlags;
+           TFlag = aTriangle.Flags;
            const TColgp_Array1OfXYZ& Nodes = myHNodes->Array1();
-           const gp_XYZ            & P1    = Nodes(TriNode1);
-           const gp_XYZ            & P2    = Nodes(TriNode2);
-           const gp_XYZ            & P3    = Nodes(TriNode3);
-           XV1 = P1.X();
-           YV1 = P1.Y();
-           XV2 = P2.X();
-           YV2 = P2.Y();
-           XV3 = P3.X();
-           YV3 = P3.Y();
-           hideByOneTriangle(Coordinates, RealPtr, isCrossing, toHideBefore, TFlag, status);
+           const gp_XYZ            & P1    = Nodes(aTriangle.Node1);
+           const gp_XYZ            & P2    = Nodes(aTriangle.Node2);
+           const gp_XYZ            & P3    = Nodes(aTriangle.Node3);
+           theTriangle.V1 = gp_XY(P1.X(), P1.Y());
+           theTriangle.V2 = gp_XY(P2.X(), P2.Y());
+           theTriangle.V3 = gp_XY(P3.X(), P3.Y());
+           hideByOneTriangle(thePoints, theTriangle, isCrossing, toHideBefore, TFlag, status);
          }
        }
       }
@@ -306,66 +229,68 @@ void HLRAlgo_PolyData::HideByPolyData (const Standard_Address Coordinates,
 //purpose  :
 //=======================================================================
 
-void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
-                                          const Standard_Address RealPtr,
+void HLRAlgo_PolyData::hideByOneTriangle (const HLRAlgo_BiPoint::PointsT& thePoints,
+                                          Triangle& theTriangle,
                                           const Standard_Boolean Crossing,
                                           const Standard_Boolean HideBefore,
                                           const Standard_Integer TrFlags,
                                           HLRAlgo_EdgeStatus& status)
 {
-  Standard_Boolean o[2],m[2];
-  Standard_Integer l,n1=0,nn1,nn2,npi=-1,npiRej=0;
-  Standard_Real a,b,c,da,db,d1,d2,p[2]={0.,0.},pd1,pd2,pdp,pp,psta=0.,pend=1.;
-  Standard_Boolean CrosSeg;
-
-  da = XV2 - XV1;
-  db = YV2 - YV1;
-  a = -db;
-  b =  da;
-  c = sqrt( a * a + b * b);
-  a /= c;
-  b /= c;
-  c  = a * XV1  + b * YV1;
-  d1 = a * PntXP1 + b * PntYP1 - c;
-  d2 = a * PntXP2 + b * PntYP2 - c;
-  if      (d1 >  Tolerance) {
-    if (d2 < -Tolerance) {
+  Standard_Boolean CrosSeg = Standard_False;
+  Standard_Integer n1 = 0;
+  Standard_Real pd1 = 0., pd2 = 0.;
+  Standard_Integer nn1 = 0, nn2 = 0;
+  Standard_Real pend = 1., psta = 0., pp = 0., pdp = 0.;
+  Standard_Integer npi = -1;
+  Standard_Boolean o[] = {Standard_False, Standard_False};
+  Standard_Boolean  m[] = {Standard_False, Standard_False};
+  Standard_Real p[] = {0., 0.};
+  Standard_Integer npiRej = 0;
+
+  {
+  const gp_XY aD = theTriangle.V2 - theTriangle.V1;
+  const gp_XY aA = (1 / aD.Modulus()) * gp_XY(-aD.Y(), aD.X());
+  const Standard_Real aDot = aA * theTriangle.V1;
+  const Standard_Real d1 = aA * thePoints.PntP12D() - aDot;
+  const Standard_Real d2 = aA * thePoints.PntP22D() - aDot;
+  if      (d1 > theTriangle.Tolerance) {
+    if (d2 < -theTriangle.Tolerance) {
       n1 =  2;
       CrosSeg = Standard_True;
     }
     else
       CrosSeg = Standard_False;
   }
-  else if (d1 < -Tolerance) {
-    if (d2 >  Tolerance) {
+  else if (d1 < -theTriangle.Tolerance) {
+    if (d2 > theTriangle.Tolerance) {
       n1 = -1;
       CrosSeg = Standard_True;
     }
     else return;
   }
   else {
-    if      (d2 >  Tolerance)
+    if      (d2 > theTriangle.Tolerance)
       CrosSeg = Standard_False;
-    else if (d2 < -Tolerance) return;
+    else if (d2 < -theTriangle.Tolerance) return;
     else {
       CrosSeg = Standard_False;
-      if (TrFlags & EMskGrALin1) {
-       pd1 = (PntXP1 - XV1) / da;
-       pd2 = (PntXP2 - XV1) / da;
+      if (TrFlags & HLRAlgo_PolyMask_EMskGrALin1) {
+       pd1 = (thePoints.PntP1.X() - theTriangle.V1.X()) / aD.X();
+       pd2 = (thePoints.PntP2.X() - theTriangle.V1.X()) / aD.X();
       }
       else {
-       pd1 = (PntYP1 - YV1) / db;
-       pd2 = (PntYP2 - YV1) / db;
+       pd1 = (thePoints.PntP1.Y() - theTriangle.V1.Y()) / aD.Y();
+       pd2 = (thePoints.PntP2.Y() - theTriangle.V1.Y()) / aD.Y();
       }
-      if      (pd1      < -TolParam) nn1 = 1;
-      else if (pd1      <  TolParam) nn1 = 2;
-      else if (pd1 - 1. < -TolParam) nn1 = 3;
-      else if (pd1 - 1. <  TolParam) nn1 = 4;
+      if      (pd1      < -theTriangle.TolParam) nn1 = 1;
+      else if (pd1      < theTriangle.TolParam) nn1 = 2;
+      else if (pd1 - 1. < -theTriangle.TolParam) nn1 = 3;
+      else if (pd1 - 1. < theTriangle.TolParam) nn1 = 4;
       else                           nn1 = 5;
-      if      (pd2      < -TolParam) nn2 = 1;
-      else if (pd2      <  TolParam) nn2 = 2;
-      else if (pd2 - 1. < -TolParam) nn2 = 3;
-      else if (pd2 - 1. <  TolParam) nn2 = 4;
+      if      (pd2      < -theTriangle.TolParam) nn2 = 1;
+      else if (pd2      < theTriangle.TolParam) nn2 = 2;
+      else if (pd2 - 1. < -theTriangle.TolParam) nn2 = 3;
+      else if (pd2 - 1. < theTriangle.TolParam) nn2 = 4;
       else                           nn2 = 5;
       if      (nn1 == 3) {
        if      (nn2 == 1) pend = pd1 / (pd1 - pd2);
@@ -401,17 +326,17 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
     Standard_Real ad2 = d2;
     if (d2 < 0) ad2 = -d2;
     pp = ad1 / ( ad1 + ad2 );
-    if (TrFlags & EMskGrALin1)
-      pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV1) / da;
+    if (TrFlags & HLRAlgo_PolyMask_EMskGrALin1)
+      pdp = (thePoints.PntP1.X() + (thePoints.PntP2.X() - thePoints.PntP1.X()) * pp - theTriangle.V1.X()) / aD.X();
     else
-      pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV1) / db;
+      pdp = (thePoints.PntP1.Y() + (thePoints.PntP2.Y() - thePoints.PntP1.Y()) * pp - theTriangle.V1.Y()) / aD.Y();
     Standard_Boolean OutSideP = Standard_False;
     Standard_Boolean Multiple = Standard_False;
-    if      (pdp      < -TolParam) OutSideP = Standard_True;
-    else if (pdp      <  TolParam) {
+    if      (pdp      < -theTriangle.TolParam) OutSideP = Standard_True;
+    else if (pdp      < theTriangle.TolParam) {
       Multiple = Standard_True;
 
-      for (l = 0; l <= npi; l++) {
+      for (Standard_Integer l = 0; l <= npi; l++) {
        if (m[l]) {
          OutSideP = Standard_True;
 
@@ -427,11 +352,11 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
        }
       }
     }
-    else if (pdp - 1. < -TolParam) {}
-    else if (pdp - 1. <  TolParam) {
+    else if (pdp - 1. < -theTriangle.TolParam) {}
+    else if (pdp - 1. < theTriangle.TolParam) {
       Multiple = Standard_True;
 
-      for (l = 0; l <= npi; l++) {
+      for (Standard_Integer l = 0; l <= npi; l++) {
        if (m[l]) {
          OutSideP = Standard_True;
          if (o[l] != (n1 == -1)) {
@@ -463,55 +388,52 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
 #endif
     }
   }
+  }
 
-  da = XV3 - XV2;
-  db = YV3 - YV2;
-  a = -db;
-  b =  da;
-  c = sqrt(a * a + b * b);
-  a /= c;
-  b /= c;
-  c  = a * XV2  + b * YV2;
-  d1 = a * PntXP1 + b * PntYP1 - c;
-  d2 = a * PntXP2 + b * PntYP2 - c;
-  if      (d1 >  Tolerance) {
-    if (d2 < -Tolerance) {
+  {
+  const gp_XY aD = theTriangle.V3 - theTriangle.V2;
+  const gp_XY aA = (1 / aD.Modulus()) * gp_XY(-aD.Y(), aD.X());
+  const Standard_Real aDot = aA * theTriangle.V2;
+  const Standard_Real d1 = aA * thePoints.PntP12D() - aDot;
+  const Standard_Real d2 = aA * thePoints.PntP22D() - aDot;
+  if      (d1 > theTriangle.Tolerance) {
+    if (d2 < -theTriangle.Tolerance) {
       n1 =  2;
       CrosSeg = Standard_True;
     }
     else
       CrosSeg = Standard_False;
   }
-  else if (d1 < -Tolerance) {
-    if (d2 >  Tolerance) {
+  else if (d1 < -theTriangle.Tolerance) {
+    if (d2 > theTriangle.Tolerance) {
       n1 = -1;
       CrosSeg = Standard_True;
     }
     else return;
   }
   else {
-    if      (d2 >  Tolerance)
+    if      (d2 > theTriangle.Tolerance)
       CrosSeg = Standard_False;
-    else if (d2 < -Tolerance) return;
+    else if (d2 < -theTriangle.Tolerance) return;
     else {
       CrosSeg = Standard_False;
-      if (TrFlags & EMskGrALin2) {
-       pd1 = (PntXP1 - XV2) / da;
-       pd2 = (PntXP2 - XV2) / da;
+      if (TrFlags & HLRAlgo_PolyMask_EMskGrALin2) {
+       pd1 = (thePoints.PntP1.X() - theTriangle.V2.X()) / aD.X();
+       pd2 = (thePoints.PntP2.X() - theTriangle.V2.X()) / aD.X();
       }
       else {
-       pd1 = (PntYP1 - YV2) / db;
-       pd2 = (PntYP2 - YV2) / db;
+       pd1 = (thePoints.PntP1.Y() - theTriangle.V2.Y()) / aD.Y();
+       pd2 = (thePoints.PntP2.Y() - theTriangle.V2.Y()) / aD.Y();
       }
-      if      (pd1      < -TolParam) nn1 = 1;
-      else if (pd1      <  TolParam) nn1 = 2;
-      else if (pd1 - 1. < -TolParam) nn1 = 3;
-      else if (pd1 - 1. <  TolParam) nn1 = 4;
+      if      (pd1      < -theTriangle.TolParam) nn1 = 1;
+      else if (pd1      < theTriangle.TolParam) nn1 = 2;
+      else if (pd1 - 1. < -theTriangle.TolParam) nn1 = 3;
+      else if (pd1 - 1. < theTriangle.TolParam) nn1 = 4;
       else                           nn1 = 5;
-      if      (pd2      < -TolParam) nn2 = 1;
-      else if (pd2      <  TolParam) nn2 = 2;
-      else if (pd2 - 1. < -TolParam) nn2 = 3;
-      else if (pd2 - 1. <  TolParam) nn2 = 4;
+      if      (pd2      < -theTriangle.TolParam) nn2 = 1;
+      else if (pd2      < theTriangle.TolParam) nn2 = 2;
+      else if (pd2 - 1. < -theTriangle.TolParam) nn2 = 3;
+      else if (pd2 - 1. < theTriangle.TolParam) nn2 = 4;
       else                           nn2 = 5;
       if      (nn1 == 3) {
        if      (nn2 == 1) pend = pd1 / (pd1 - pd2);
@@ -547,17 +469,17 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
     Standard_Real ad2 = d2;
     if (d2 < 0) ad2 = -d2;
     pp = ad1 / ( ad1 + ad2 );
-    if (TrFlags & EMskGrALin2)
-      pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV2) / da;
+    if (TrFlags & HLRAlgo_PolyMask_EMskGrALin2)
+      pdp = (thePoints.PntP1.X() + (thePoints.Pnt2.X() - thePoints.PntP1.X()) * pp - theTriangle.V2.X()) / aD.X();
     else
-      pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV2) / db;
+      pdp = (thePoints.PntP1.Y() + (thePoints.PntP2.Y() - thePoints.PntP1.Y()) * pp - theTriangle.V2.Y()) / aD.Y();
     Standard_Boolean OutSideP = Standard_False;
     Standard_Boolean Multiple = Standard_False;
-    if      (pdp      < -TolParam) OutSideP = Standard_True;
-    else if (pdp      <  TolParam) {
+    if      (pdp      < -theTriangle.TolParam) OutSideP = Standard_True;
+    else if (pdp      < theTriangle.TolParam) {
       Multiple = Standard_True;
 
-      for (l = 0; l <= npi; l++) {
+      for (Standard_Integer l = 0; l <= npi; l++) {
        if (m[l]) {
          OutSideP = Standard_True;
          if (o[l] != (n1 == -1)) {
@@ -572,11 +494,11 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
        }
       }
     }
-    else if (pdp - 1. < -TolParam) {}
-    else if (pdp - 1. <  TolParam) {
+    else if (pdp - 1. < -theTriangle.TolParam) {}
+    else if (pdp - 1. < theTriangle.TolParam) {
       Multiple = Standard_True;
 
-      for (l = 0; l <= npi; l++) {
+      for (Standard_Integer l = 0; l <= npi; l++) {
        if (m[l]) {
          OutSideP = Standard_True;
          if (o[l] != (n1 == -1)) {
@@ -608,55 +530,52 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
 #endif
     }
   }
+  }
 
-  da = XV1 - XV3;
-  db = YV1 - YV3;
-  a = -db;
-  b =  da;
-  c = sqrt(a * a + b * b);
-  a /= c;
-  b /= c;
-  c  = a * XV3  + b * YV3;
-  d1 = a * PntXP1 + b * PntYP1 - c;
-  d2 = a * PntXP2 + b * PntYP2 - c;
-  if      (d1 >  Tolerance) {
-    if (d2 < -Tolerance) {
+  {
+  const gp_XY aD = theTriangle.V1 - theTriangle.V3;
+  const gp_XY aA = (1 / aD.Modulus()) * gp_XY(-aD.Y(), aD.X());
+  const Standard_Real aDot = aA * theTriangle.V3;
+  const Standard_Real d1 = aA * thePoints.PntP12D() - aDot;
+  const Standard_Real d2 = aA * thePoints.PntP22D() - aDot;
+  if      (d1 > theTriangle.Tolerance) {
+    if (d2 < -theTriangle.Tolerance) {
       n1 =  2;
       CrosSeg = Standard_True;
     }
     else
       CrosSeg = Standard_False;
   }
-  else if (d1 < -Tolerance) {
-    if (d2 >  Tolerance) {
+  else if (d1 < -theTriangle.Tolerance) {
+    if (d2 > theTriangle.Tolerance) {
       n1 = -1;
       CrosSeg = Standard_True;
     }
     else return;
   }
   else {
-    if      (d2 >  Tolerance)
+    if      (d2 > theTriangle.Tolerance)
       CrosSeg = Standard_False;
-    else if (d2 < -Tolerance) return;
+    else if (d2 < -theTriangle.Tolerance) return;
     else {
       CrosSeg = Standard_False;
-      if (TrFlags & EMskGrALin3) {
-       pd1 = (PntXP1 - XV3) / da;
-       pd2 = (PntXP2 - XV3) / da;
+      if (TrFlags & HLRAlgo_PolyMask_EMskGrALin3) {
+       pd1 = (thePoints.PntP1.X() - theTriangle.V3.X()) / aD.X();
+       pd2 = (thePoints.PntP2.X() - theTriangle.V3.X()) / aD.X();
       }
       else {
-       pd1 = (PntYP1 - YV3) / db;
-       pd2 = (PntYP2 - YV3) / db;
+       pd1 = (thePoints.PntP1.Y() - theTriangle.V3.Y()) / aD.Y();
+       pd2 = (thePoints.PntP2.Y() - theTriangle.V3.Y()) / aD.Y();
       }
-      if      (pd1      < -TolParam) nn1 = 1;
-      else if (pd1      <  TolParam) nn1 = 2;
-      else if (pd1 - 1. < -TolParam) nn1 = 3;
-      else if (pd1 - 1. <  TolParam) nn1 = 4;
+      if      (pd1      < -theTriangle.TolParam) nn1 = 1;
+      else if (pd1      < theTriangle.TolParam) nn1 = 2;
+      else if (pd1 - 1. < -theTriangle.TolParam) nn1 = 3;
+      else if (pd1 - 1. < theTriangle.TolParam) nn1 = 4;
       else                           nn1 = 5;
-      if      (pd2      < -TolParam) nn2 = 1;
-      else if (pd2      <  TolParam) nn2 = 2;
-      else if (pd2 - 1. < -TolParam) nn2 = 3;
-      else if (pd2 - 1. <  TolParam) nn2 = 4;
+      if      (pd2      < -theTriangle.TolParam) nn2 = 1;
+      else if (pd2      < theTriangle.TolParam) nn2 = 2;
+      else if (pd2 - 1. < -theTriangle.TolParam) nn2 = 3;
+      else if (pd2 - 1. < theTriangle.TolParam) nn2 = 4;
       else                           nn2 = 5;
       if      (nn1 == 3) {
        if      (nn2 == 1) pend = pd1 / (pd1 - pd2);
@@ -692,17 +611,17 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
     Standard_Real ad2 = d2;
     if (d2 < 0) ad2 = -d2;
     pp = ad1 / ( ad1 + ad2 );
-    if (TrFlags & EMskGrALin3)
-      pdp = (PntXP1 + (PntXP2 - PntXP1) * pp - XV3) / da;
+    if (TrFlags & HLRAlgo_PolyMask_EMskGrALin3)
+      pdp = (thePoints.PntP1.X() + (thePoints.PntP2.X() - thePoints.PntP1.X()) * pp - theTriangle.V3.X()) / aD.X();
     else
-      pdp = (PntYP1 + (PntYP2 - PntYP1) * pp - YV3) / db;
+      pdp = (thePoints.PntP1.Y() + (thePoints.PntP2.Y() - thePoints.PntP1.Y()) * pp - theTriangle.V3.Y()) / aD.Y();
     Standard_Boolean OutSideP = Standard_False;
     Standard_Boolean Multiple = Standard_False;
-    if      (pdp      < -TolParam) OutSideP = Standard_True;
-    else if (pdp      <  TolParam) {
+    if      (pdp      < -theTriangle.TolParam) OutSideP = Standard_True;
+    else if (pdp      < theTriangle.TolParam) {
       Multiple = Standard_True;
 
-      for (l = 0; l <= npi; l++) {
+      for (Standard_Integer l = 0; l <= npi; l++) {
        if (m[l]) {
          OutSideP = Standard_True;
          if (o[l] != (n1 == -1)) {
@@ -717,11 +636,11 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
        }
       }
     }
-    else if (pdp - 1. < -TolParam) {}
-    else if (pdp - 1. <  TolParam) {
+    else if (pdp - 1. < -theTriangle.TolParam) {}
+    else if (pdp - 1. < theTriangle.TolParam) {
       Multiple = Standard_True;
 
-      for (l = 0; l <= npi; l++) {
+      for (Standard_Integer l = 0; l <= npi; l++) {
        if (m[l]) {
          OutSideP = Standard_True;
          if (o[l] != (n1 == -1)) {
@@ -753,7 +672,8 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
 #endif
     }
   }
-  
+  }
+
   if (npi == -1) {
     if (npiRej >= 2) return;
   }
@@ -780,24 +700,24 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
 
   if (Crossing) {
     if (HideBefore) {
-      if      (Param-psta < TolParam) return;
-      else if (Param < pend)          pend   = Param;
+      if      (theTriangle.Param - psta < theTriangle.TolParam) return;
+      else if (theTriangle.Param < pend)          pend   = theTriangle.Param;
     }
     else {
-      if      (pend-Param < TolParam) return;
-      else if (psta < Param)          psta   = Param;
+      if      (pend - theTriangle.Param < theTriangle.TolParam) return;
+      else if (psta < theTriangle.Param)          psta   = theTriangle.Param;
     }
   }
 
   Standard_Boolean total;
-  if (psta > 0) total = psta <  TolParam;
-  else          total = psta > -TolParam;
+  if (psta > 0) total = psta < theTriangle.TolParam;
+  else          total = psta > -theTriangle.TolParam;
   if (total) {
     Standard_Real pfin = pend - 1.;
-    if (pfin > 0) total = pfin <  TolParam;
-    else          total = pfin > -TolParam;
+    if (pfin > 0) total = pfin < theTriangle.TolParam;
+    else          total = pfin > -theTriangle.TolParam;
   }
   if (total) status.HideAll();
-  else       status.Hide(psta,(Standard_ShortReal)TolParam,pend,(Standard_ShortReal)TolParam,
+  else       status.Hide(psta,(Standard_ShortReal)theTriangle.TolParam,pend,(Standard_ShortReal)theTriangle.TolParam,
                         Standard_False,Standard_False);
 }
index 5924fa5..e7a580e 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef _HLRAlgo_PolyData_HeaderFile
 #define _HLRAlgo_PolyData_HeaderFile
 
+#include <HLRAlgo_BiPoint.hxx>
 #include <Standard.hxx>
 #include <Standard_Type.hxx>
 
 #include <TColgp_Array1OfXYZ.hxx>
 #include <HLRAlgo_Array1OfTData.hxx>
 #include <HLRAlgo_Array1OfPHDat.hxx>
-#include <Standard_Address.hxx>
 #include <Standard_Boolean.hxx>
-class HLRAlgo_EdgeStatus;
 
+class HLRAlgo_EdgeStatus;
 
 class HLRAlgo_PolyData;
 DEFINE_STANDARD_HANDLE(HLRAlgo_PolyData, MMgt_TShared)
@@ -41,8 +41,44 @@ class HLRAlgo_PolyData : public MMgt_TShared
 {
 
 public:
+  struct FaceIndices
+  {
+    Standard_Integer Index, Min, Max;
+  };
+
+  struct Triangle
+  {
+    gp_XY V1, V2, V3;
+    Standard_Real Param, TolParam, TolAng, Tolerance;
+  };
+
+  struct Box
+  {
+    Standard_Real XMin, YMin, ZMin, XMax, YMax, ZMax;
+
+    //! The default constructor.
+    Box()
+    {
+    }
+
+    //! The initializing constructor.
+    Box(
+        const Standard_Real& theXMin,
+        const Standard_Real& theYMin,
+        const Standard_Real& theZMin,
+        const Standard_Real& theXMax,
+        const Standard_Real& theYMax,
+        const Standard_Real& theZMax) :
+      XMin(theXMin),
+      YMin(theYMin),
+      ZMin(theZMin),
+      XMax(theXMax),
+      YMax(theYMax),
+      ZMax(theZMax)
+    {
+    }
+  };
 
-  
   Standard_EXPORT HLRAlgo_PolyData();
   
   Standard_EXPORT void HNodes (const Handle(TColgp_HArray1OfXYZ)& HNodes);
@@ -61,28 +97,31 @@ public:
   
     HLRAlgo_Array1OfPHDat& PHDat() const;
   
-  Standard_EXPORT void UpdateGlobalMinMax (const Standard_Address ToTMinMax);
+  Standard_EXPORT void UpdateGlobalMinMax (Box& theBox);
   
     Standard_Boolean Hiding() const;
   
   //! process hiding between <Pt1> and <Pt2>.
-  Standard_EXPORT void HideByPolyData (const Standard_Address Coordinates, const Standard_Address RealPtr, const Standard_Address Indices, const Standard_Boolean HidingShell, HLRAlgo_EdgeStatus& status);
+  Standard_EXPORT void HideByPolyData (const HLRAlgo_BiPoint::PointsT& thePoints, Triangle& theTriangle, HLRAlgo_BiPoint::IndicesT& theIndices, const Standard_Boolean HidingShell, HLRAlgo_EdgeStatus& status);
   
-    Standard_Address Indices();
+  FaceIndices& Indices()
+  {
+    return myFaceIndices;
+  }
 
   DEFINE_STANDARD_RTTIEXT(HLRAlgo_PolyData,MMgt_TShared)
 
 private:
 
   //! evident.
-  void hideByOneTriangle (const Standard_Address Coordinates,
-                          const Standard_Address RealPtr,
+  void hideByOneTriangle (const HLRAlgo_BiPoint::PointsT& thePoints,
+                          Triangle& theTriangle,
                           const Standard_Boolean Crossing,
                           const Standard_Boolean HideBefore,
                           const Standard_Integer TrFlags,
                           HLRAlgo_EdgeStatus& status);
 
-  Standard_Integer myIndices[3];
+  FaceIndices myFaceIndices;
   Handle(TColgp_HArray1OfXYZ) myHNodes;
   Handle(HLRAlgo_HArray1OfTData) myHTData;
   Handle(HLRAlgo_HArray1OfPHDat) myHPHDat;
index c95eec3..9b127cb 100644 (file)
@@ -25,7 +25,9 @@
 
 inline void
 HLRAlgo_PolyData::FaceIndex (const Standard_Integer I)
-{ myIndices[0] = I; }
+{
+  myFaceIndices.Index = I;
+}
 
 //=======================================================================
 //function : FaceIndex
@@ -34,7 +36,9 @@ HLRAlgo_PolyData::FaceIndex (const Standard_Integer I)
 
 inline Standard_Integer
 HLRAlgo_PolyData::FaceIndex () const
-{ return myIndices[0]; }
+{
+  return myFaceIndices.Index;
+}
 
 //=======================================================================
 //function : Nodes
@@ -70,11 +74,3 @@ HLRAlgo_PolyData::PHDat () const
 
 inline Standard_Boolean HLRAlgo_PolyData::Hiding () const
 { return !myHPHDat.IsNull(); }
-
-//=======================================================================
-//function : Indices
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRAlgo_PolyData::Indices ()
-{ return (Standard_Address)myIndices; }
index 90b686d..e1e3e5f 100644 (file)
 
 #include <Standard_Integer.hxx>
 #include <Standard_Real.hxx>
-#include <Standard_Address.hxx>
 
 
 //! Data structure of a set of Hiding Triangles.
-class HLRAlgo_PolyHidingData 
+class HLRAlgo_PolyHidingData
 {
 public:
-
   DEFINE_STANDARD_ALLOC
 
-  
-    HLRAlgo_PolyHidingData();
-  
-    void Set (const Standard_Integer Index, const Standard_Integer Minim, const Standard_Integer Maxim, const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D);
-  
-    Standard_Address IndexAndMinMax() const;
-  
-    Standard_Address Plan() const;
-
-
-
-
-protected:
-
-
-
-
+  struct TriangleIndices
+  {
+    Standard_Integer Index, Min, Max;
+  };
+
+  struct PlaneT
+  {
+    gp_XYZ Normal;
+    Standard_Real D;
+  };
+
+  HLRAlgo_PolyHidingData()
+  {
+  }
+
+  void Set (
+    const Standard_Integer Index,
+    const Standard_Integer Minim,
+    const Standard_Integer Maxim,
+    const Standard_Real A,
+    const Standard_Real B,
+    const Standard_Real C,
+    const Standard_Real D)
+  {
+    myIndices.Index = Index;
+    myIndices.Min = Minim;
+    myIndices.Max = Maxim;
+    myPlane.Normal = gp_XYZ(A, B, C);
+    myPlane.D = D;
+  }
+
+  TriangleIndices& Indices()
+  {
+    return myIndices;
+  }
+
+  PlaneT& Plane()
+  {
+    return myPlane;
+  }
 
 private:
-
-
-
-  Standard_Integer myMinMax[3];
-  Standard_Real myPlan[4];
-
-
+  TriangleIndices myIndices;
+  PlaneT myPlane;
 };
 
-
-#include <HLRAlgo_PolyHidingData.lxx>
-
-
-
-
-
 #endif // _HLRAlgo_PolyHidingData_HeaderFile
diff --git a/src/HLRAlgo/HLRAlgo_PolyHidingData.lxx b/src/HLRAlgo/HLRAlgo_PolyHidingData.lxx
deleted file mode 100644 (file)
index 351e727..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// Created on: 1995-06-21
-// Created by: Christophe MARION
-// 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.
-
-//=======================================================================
-//function : PolyHidingData
-//purpose  : 
-//=======================================================================
-
-inline HLRAlgo_PolyHidingData::HLRAlgo_PolyHidingData ()
-{}
-
-//=======================================================================
-//function : Set
-//purpose  : 
-//=======================================================================
-
-inline void
-HLRAlgo_PolyHidingData::Set (const Standard_Integer Index,
-                            const Standard_Integer Minim,
-                            const Standard_Integer Maxim,
-                            const Standard_Real A,
-                            const Standard_Real B,
-                            const Standard_Real C,
-                            const Standard_Real D)
-{
-  myMinMax[0] = Index;
-  myMinMax[1] = Minim;
-  myMinMax[2] = Maxim;
-  myPlan[0]  = A;
-  myPlan[1]  = B;
-  myPlan[2]  = C;
-  myPlan[3]  = D;
-}
-
-//=======================================================================
-//function : IndexAndMinMax
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address
-HLRAlgo_PolyHidingData::IndexAndMinMax() const
-{ return (Standard_Address)myMinMax; }
-
-//=======================================================================
-//function : Plan
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address
-HLRAlgo_PolyHidingData::Plan() const
-{ return (Standard_Address)myPlan; }
index 69c26a2..2d96ebb 100644 (file)
 
 IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyInternalData,MMgt_TShared)
 
-#define Tri1Node1 ((Standard_Integer*)Tri1Indices)[0]
-#define Tri1Node2 ((Standard_Integer*)Tri1Indices)[1]
-#define Tri1Node3 ((Standard_Integer*)Tri1Indices)[2]
-#define Tri1Flags ((Standard_Integer*)Tri1Indices)[3]
-
-#define Tri2Node1 ((Standard_Integer*)Tri2Indices)[0]
-#define Tri2Node2 ((Standard_Integer*)Tri2Indices)[1]
-#define Tri2Node3 ((Standard_Integer*)Tri2Indices)[2]
-#define Tri2Flags ((Standard_Integer*)Tri2Indices)[3]
-
-#define Seg1LstSg1 ((Standard_Integer*)Seg1Indices)[0]
-#define Seg1LstSg2 ((Standard_Integer*)Seg1Indices)[1]
-#define Seg1NxtSg1 ((Standard_Integer*)Seg1Indices)[2]
-#define Seg1NxtSg2 ((Standard_Integer*)Seg1Indices)[3]
-#define Seg1Conex1 ((Standard_Integer*)Seg1Indices)[4]
-#define Seg1Conex2 ((Standard_Integer*)Seg1Indices)[5]
-
-#define Seg2LstSg1 ((Standard_Integer*)Seg2Indices)[0]
-#define Seg2LstSg2 ((Standard_Integer*)Seg2Indices)[1]
-#define Seg2NxtSg1 ((Standard_Integer*)Seg2Indices)[2]
-#define Seg2NxtSg2 ((Standard_Integer*)Seg2Indices)[3]
-#define Seg2Conex1 ((Standard_Integer*)Seg2Indices)[4]
-#define Seg2Conex2 ((Standard_Integer*)Seg2Indices)[5]
-
-#define Nod1NdSg ((Standard_Integer*)Nod1Indices)[0]
-#define Nod1Flag ((Standard_Integer*)Nod1Indices)[1]
-#define Nod1Edg1 ((Standard_Integer*)Nod1Indices)[2]
-#define Nod1Edg2 ((Standard_Integer*)Nod1Indices)[3]
-
-#define Nod1PntX ((Standard_Real*)Nod1RValues)[ 0]
-#define Nod1PntY ((Standard_Real*)Nod1RValues)[ 1]
-#define Nod1PntZ ((Standard_Real*)Nod1RValues)[ 2]
-#define Nod1PntU ((Standard_Real*)Nod1RValues)[ 3]
-#define Nod1PntV ((Standard_Real*)Nod1RValues)[ 4]
-#define Nod1NrmX ((Standard_Real*)Nod1RValues)[ 5]
-#define Nod1NrmY ((Standard_Real*)Nod1RValues)[ 6]
-#define Nod1NrmZ ((Standard_Real*)Nod1RValues)[ 7]
-#define Nod1PCu1 ((Standard_Real*)Nod1RValues)[ 8]
-#define Nod1PCu2 ((Standard_Real*)Nod1RValues)[ 9]
-#define Nod1Scal ((Standard_Real*)Nod1RValues)[10]
-
-#define Nod2NdSg ((Standard_Integer*)Nod2Indices)[0]
-#define Nod2Flag ((Standard_Integer*)Nod2Indices)[1]
-#define Nod2Edg1 ((Standard_Integer*)Nod2Indices)[2]
-#define Nod2Edg2 ((Standard_Integer*)Nod2Indices)[3]
-
-#define Nod2PntX ((Standard_Real*)Nod2RValues)[ 0]
-#define Nod2PntY ((Standard_Real*)Nod2RValues)[ 1]
-#define Nod2PntZ ((Standard_Real*)Nod2RValues)[ 2]
-#define Nod2PntU ((Standard_Real*)Nod2RValues)[ 3]
-#define Nod2PntV ((Standard_Real*)Nod2RValues)[ 4]
-#define Nod2NrmX ((Standard_Real*)Nod2RValues)[ 5]
-#define Nod2NrmY ((Standard_Real*)Nod2RValues)[ 6]
-#define Nod2NrmZ ((Standard_Real*)Nod2RValues)[ 7]
-#define Nod2PCu1 ((Standard_Real*)Nod2RValues)[ 8]
-#define Nod2PCu2 ((Standard_Real*)Nod2RValues)[ 9]
-#define Nod2Scal ((Standard_Real*)Nod2RValues)[10]
-
-#define Nod3NdSg ((Standard_Integer*)Nod3Indices)[0]
-#define Nod3Flag ((Standard_Integer*)Nod3Indices)[1]
-#define Nod3Edg1 ((Standard_Integer*)Nod3Indices)[2]
-#define Nod3Edg2 ((Standard_Integer*)Nod3Indices)[3]
-
-#define Nod3PntX ((Standard_Real*)Nod3RValues)[ 0]
-#define Nod3PntY ((Standard_Real*)Nod3RValues)[ 1]
-#define Nod3PntZ ((Standard_Real*)Nod3RValues)[ 2]
-#define Nod3PntU ((Standard_Real*)Nod3RValues)[ 3]
-#define Nod3PntV ((Standard_Real*)Nod3RValues)[ 4]
-#define Nod3NrmX ((Standard_Real*)Nod3RValues)[ 5]
-#define Nod3NrmY ((Standard_Real*)Nod3RValues)[ 6]
-#define Nod3NrmZ ((Standard_Real*)Nod3RValues)[ 7]
-#define Nod3PCu1 ((Standard_Real*)Nod3RValues)[ 8]
-#define Nod3PCu2 ((Standard_Real*)Nod3RValues)[ 9]
-#define Nod3Scal ((Standard_Real*)Nod3RValues)[10]
-
-#define Nod4NdSg ((Standard_Integer*)Nod4Indices)[0]
-#define Nod4Flag ((Standard_Integer*)Nod4Indices)[1]
-#define Nod4Edg1 ((Standard_Integer*)Nod4Indices)[2]
-#define Nod4Edg2 ((Standard_Integer*)Nod4Indices)[3]
-
-#define Nod4PntX ((Standard_Real*)Nod4RValues)[ 0]
-#define Nod4PntY ((Standard_Real*)Nod4RValues)[ 1]
-#define Nod4PntZ ((Standard_Real*)Nod4RValues)[ 2]
-#define Nod4PntU ((Standard_Real*)Nod4RValues)[ 3]
-#define Nod4PntV ((Standard_Real*)Nod4RValues)[ 4]
-#define Nod4NrmX ((Standard_Real*)Nod4RValues)[ 5]
-#define Nod4NrmY ((Standard_Real*)Nod4RValues)[ 6]
-#define Nod4NrmZ ((Standard_Real*)Nod4RValues)[ 7]
-#define Nod4PCu1 ((Standard_Real*)Nod4RValues)[ 8]
-#define Nod4PCu2 ((Standard_Real*)Nod4RValues)[ 9]
-#define Nod4Scal ((Standard_Real*)Nod4RValues)[10]
 #ifdef OCCT_DEBUG
 static Standard_Integer TRACE = Standard_False;
 static Standard_Integer ERROR = Standard_False;
@@ -141,8 +50,7 @@ HLRAlgo_PolyInternalData::HLRAlgo_PolyInternalData
   
   HLRAlgo_Array1OfPINod& PINod = myPINod->ChangeArray1();
   Handle(HLRAlgo_PolyInternalNode)* NN = &(PINod.ChangeValue(1));
-//  Standard_Address Nod1Indices;
-  
+
   for (i = 1; i <= myMxPINod; i++) {
     *NN = new HLRAlgo_PolyInternalNode();
     NN++;
@@ -155,230 +63,225 @@ HLRAlgo_PolyInternalData::HLRAlgo_PolyInternalData
 //=======================================================================
 
 void HLRAlgo_PolyInternalData::UpdateLinks
-(Standard_Address& TData,
Standard_Address& PISeg,
Standard_Address& PINod)
+(HLRAlgo_Array1OfTData*& TData,
HLRAlgo_Array1OfPISeg*& PISeg,
HLRAlgo_Array1OfPINod*& PINod)
 {
   Standard_Integer i,n1,n2;
   Standard_Integer find,iiii,icsv = 0;
-  Standard_Address A1,A2,A3,Nod1Indices,Nod2Indices,Seg2Indices = NULL,Tri2Indices;
+  HLRAlgo_PolyInternalSegment* aSegIndices = NULL;
+
   Standard_Boolean newSeg = Standard_False;
   HLRAlgo_TriangleData* TD =
     &(((HLRAlgo_Array1OfTData*)TData)->ChangeValue(1));
   
   for (i = 1; i <= myNbTData; i++) {
-    Tri2Indices = TD->Indices();
-    A1 = ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node1)->Indices();
-    A2 = ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node2)->Indices();
-    A3 = ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node3)->Indices();
-    n1 = Tri2Node1;
-    n2 = Tri2Node2;
-    Nod1Indices = A1;
-    Nod2Indices = A2;
+    HLRAlgo_PolyInternalNode::NodeIndices& A1 =
+      PINod->ChangeValue(TD->Node1)->Indices();
+    HLRAlgo_PolyInternalNode::NodeIndices& A2 =
+      PINod->ChangeValue(TD->Node2)->Indices();
+    HLRAlgo_PolyInternalNode::NodeIndices& A3 =
+      PINod->ChangeValue(TD->Node3)->Indices();
+
+    {
+    n1 = TD->Node1;
+    n2 = TD->Node2;
     newSeg = Standard_False;
-    if (Nod1NdSg == 0 && Nod2NdSg == 0) {
+    if (A1.NdSg == 0 && A2.NdSg == 0) {
       newSeg = Standard_True;
       myNbPISeg++;
-      Nod1NdSg = myNbPISeg;
-      Nod2NdSg = myNbPISeg;
+      A1.NdSg = myNbPISeg;
+      A2.NdSg = myNbPISeg;
     }
     else {
-      iiii = Nod1NdSg;
+      iiii = A1.NdSg;
       if (iiii != 0) {
        find = 0;
        
        while (iiii != 0 && find == 0) {
-         Seg2Indices =
-           ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-         if (Seg2LstSg1 == n1) {
-           if (Seg2LstSg2 == n2) find = iiii;
-           else                  iiii = Seg2NxtSg1;
+         aSegIndices = &PISeg->ChangeValue(iiii);
+         if (aSegIndices->LstSg1 == n1) {
+           if (aSegIndices->LstSg2 == n2) find = iiii;
+           else                  iiii = aSegIndices->NxtSg1;
            icsv = 1;
          }
          else {
-           if (Seg2LstSg1 == n2) find = iiii;
-           else                  iiii = Seg2NxtSg2;
+           if (aSegIndices->LstSg1 == n2) find = iiii;
+           else                  iiii = aSegIndices->NxtSg2;
            icsv = 2;
          }
        }
        if (find == 0) {
          newSeg = Standard_True;
          myNbPISeg++;
-         if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
-         else           Seg2NxtSg2 = myNbPISeg;
+         if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
+         else           aSegIndices->NxtSg2 = myNbPISeg;
        }
-       else Seg2Conex2 = i;
+       else aSegIndices->Conex2 = i;
       }
       else {
        newSeg = Standard_True;
        myNbPISeg++;
-       Nod1NdSg = myNbPISeg;
+       A1.NdSg = myNbPISeg;
       }
       if (newSeg) {
-       iiii = Nod2NdSg;
+       iiii = A2.NdSg;
        if (iiii != 0) {
          
          while (iiii != 0) {
-           Seg2Indices =
-             ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-           if (Seg2LstSg1 == n2) { icsv = 1; iiii = Seg2NxtSg1; }
-           else                  { icsv = 2; iiii = Seg2NxtSg2; }
+           aSegIndices = &PISeg->ChangeValue(iiii);
+           if (aSegIndices->LstSg1 == n2) { icsv = 1; iiii = aSegIndices->NxtSg1; }
+           else                  { icsv = 2; iiii = aSegIndices->NxtSg2; }
          }
-         if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
-         else           Seg2NxtSg2 = myNbPISeg;
+         if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
+         else           aSegIndices->NxtSg2 = myNbPISeg;
        }
-       else Nod2NdSg = myNbPISeg;
+       else A2.NdSg = myNbPISeg;
       }
     }
     if (newSeg) {
-      Seg2Indices =
-       ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
-      Seg2LstSg1 = n1;
-      Seg2LstSg2 = n2;
-      Seg2Conex1 = i;
-      Seg2Conex2 = 0;
-      Seg2NxtSg1 = 0;
-      Seg2NxtSg2 = 0;
+      aSegIndices = &PISeg->ChangeValue(myNbPISeg);
+      aSegIndices->LstSg1 = n1;
+      aSegIndices->LstSg2 = n2;
+      aSegIndices->Conex1 = i;
+      aSegIndices->Conex2 = 0;
+      aSegIndices->NxtSg1 = 0;
+      aSegIndices->NxtSg2 = 0;
     }
-    
-    n1 = Tri2Node2;
-    n2 = Tri2Node3;
-    Nod1Indices = A2;
-    Nod2Indices = A3;
+    }
+
+    {
+    n1 = TD->Node2;
+    n2 = TD->Node3;
     newSeg = Standard_False;
-    if (Nod1NdSg == 0 && Nod2NdSg == 0) {
+    if (A2.NdSg == 0 && A3.NdSg == 0) {
       newSeg = Standard_True;
       myNbPISeg++;
-      Nod1NdSg = myNbPISeg;
-      Nod2NdSg = myNbPISeg;
+      A2.NdSg = myNbPISeg;
+      A3.NdSg = myNbPISeg;
     }
     else {
-      iiii = Nod1NdSg;
+      iiii = A2.NdSg;
       if (iiii != 0) {
        find = 0;
        
        while (iiii != 0 && find == 0) {
-         Seg2Indices =
-           ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-         if (Seg2LstSg1 == n1) {
-           if (Seg2LstSg2 == n2) find = iiii;
-           else                  iiii = Seg2NxtSg1;
+    aSegIndices = &PISeg->ChangeValue(iiii);
+         if (aSegIndices->LstSg1 == n1) {
+           if (aSegIndices->LstSg2 == n2) find = iiii;
+           else                  iiii = aSegIndices->NxtSg1;
            icsv = 1;
          }
          else {
-           if (Seg2LstSg1 == n2) find = iiii;
-           else                  iiii = Seg2NxtSg2;
+           if (aSegIndices->LstSg1 == n2) find = iiii;
+           else                  iiii = aSegIndices->NxtSg2;
            icsv = 2;
          }
        }
        if (find == 0) {
          newSeg = Standard_True;
          myNbPISeg++;
-         if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
-         else           Seg2NxtSg2 = myNbPISeg;
+         if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
+         else           aSegIndices->NxtSg2 = myNbPISeg;
        }
-       else Seg2Conex2 = i;
+       else aSegIndices->Conex2 = i;
       }
       else {
        newSeg = Standard_True;
        myNbPISeg++;
-       Nod1NdSg = myNbPISeg;
+       A2.NdSg = myNbPISeg;
       }
       if (newSeg) {
-       iiii = Nod2NdSg;
+       iiii = A3.NdSg;
        if (iiii != 0) {
          
          while (iiii != 0) {
-           Seg2Indices =
-             ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-           if (Seg2LstSg1 == n2) { icsv = 1; iiii = Seg2NxtSg1; }
-           else                  { icsv = 2; iiii = Seg2NxtSg2; }
+      aSegIndices = &PISeg->ChangeValue(iiii);
+           if (aSegIndices->LstSg1 == n2) { icsv = 1; iiii = aSegIndices->NxtSg1; }
+           else                  { icsv = 2; iiii = aSegIndices->NxtSg2; }
          }
-         if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
-         else           Seg2NxtSg2 = myNbPISeg;
+         if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
+         else           aSegIndices->NxtSg2 = myNbPISeg;
        }
-       else Nod2NdSg = myNbPISeg;
+       else A3.NdSg = myNbPISeg;
       }
     }
     if (newSeg) {
-      Seg2Indices =
-       ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
-      Seg2LstSg1 = n1;
-      Seg2LstSg2 = n2;
-      Seg2Conex1 = i;
-      Seg2Conex2 = 0;
-      Seg2NxtSg1 = 0;
-      Seg2NxtSg2 = 0;
+      aSegIndices = &PISeg->ChangeValue(myNbPISeg);
+      aSegIndices->LstSg1 = n1;
+      aSegIndices->LstSg2 = n2;
+      aSegIndices->Conex1 = i;
+      aSegIndices->Conex2 = 0;
+      aSegIndices->NxtSg1 = 0;
+      aSegIndices->NxtSg2 = 0;
     }
-    
-    n1 = Tri2Node3;
-    n2 = Tri2Node1;
-    Nod1Indices = A3;
-    Nod2Indices = A1;
+    }
+
+    {
+    n1 = TD->Node3;
+    n2 = TD->Node1;
     newSeg = Standard_False;
-    if (Nod1NdSg == 0 && Nod2NdSg == 0) {
+    if (A3.NdSg == 0 && A1.NdSg == 0) {
       newSeg = Standard_True;
       myNbPISeg++;
-      Nod1NdSg = myNbPISeg;
-      Nod2NdSg = myNbPISeg;
+      A3.NdSg = myNbPISeg;
+      A1.NdSg = myNbPISeg;
     }
     else {
-      iiii = Nod1NdSg;
+      iiii = A3.NdSg;
       if (iiii != 0) {
        find = 0;
        
        while (iiii != 0 && find == 0) {
-         Seg2Indices =
-           ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-         if (Seg2LstSg1 == n1) {
-           if (Seg2LstSg2 == n2) find = iiii;
-           else                  iiii = Seg2NxtSg1;
+    aSegIndices = &PISeg->ChangeValue(iiii);
+         if (aSegIndices->LstSg1 == n1) {
+           if (aSegIndices->LstSg2 == n2) find = iiii;
+           else                  iiii = aSegIndices->NxtSg1;
            icsv = 1;
          }
          else {
-           if (Seg2LstSg1 == n2) find = iiii;
-           else                  iiii = Seg2NxtSg2;
+           if (aSegIndices->LstSg1 == n2) find = iiii;
+           else                  iiii = aSegIndices->NxtSg2;
            icsv = 2;
          }
        }
        if (find == 0) {
          newSeg = Standard_True;
          myNbPISeg++;
-         if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
-         else           Seg2NxtSg2 = myNbPISeg;
+         if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
+         else           aSegIndices->NxtSg2 = myNbPISeg;
        }
-       else Seg2Conex2 = i;
+       else aSegIndices->Conex2 = i;
       }
       else {
        newSeg = Standard_True;
        myNbPISeg++;
-       Nod1NdSg = myNbPISeg;
+       A3.NdSg = myNbPISeg;
       }
       if (newSeg) {
-       iiii = Nod2NdSg;
+       iiii = A1.NdSg;
        if (iiii != 0) {
          
          while (iiii != 0) {
-           Seg2Indices =
-             ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-           if (Seg2LstSg1 == n2) { icsv = 1; iiii = Seg2NxtSg1; }
-           else                  { icsv = 2; iiii = Seg2NxtSg2; }
+      aSegIndices = &PISeg->ChangeValue(iiii);
+           if (aSegIndices->LstSg1 == n2) { icsv = 1; iiii = aSegIndices->NxtSg1; }
+           else                  { icsv = 2; iiii = aSegIndices->NxtSg2; }
          }
-         if (icsv == 1) Seg2NxtSg1 = myNbPISeg;
-         else           Seg2NxtSg2 = myNbPISeg;
+         if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
+         else           aSegIndices->NxtSg2 = myNbPISeg;
        }
-       else Nod2NdSg = myNbPISeg;
+       else A1.NdSg = myNbPISeg;
       }
     }
     if (newSeg) {
-      Seg2Indices =
-       ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(myNbPISeg).Indices();
-      Seg2LstSg1 = n1;
-      Seg2LstSg2 = n2;
-      Seg2Conex1 = i;
-      Seg2Conex2 = 0;
-      Seg2NxtSg1 = 0;
-      Seg2NxtSg2 = 0;
+      aSegIndices = &PISeg->ChangeValue(myNbPISeg);
+      aSegIndices->LstSg1 = n1;
+      aSegIndices->LstSg2 = n2;
+      aSegIndices->Conex1 = i;
+      aSegIndices->Conex2 = 0;
+      aSegIndices->NxtSg1 = 0;
+      aSegIndices->NxtSg2 = 0;
+    }
     }
     TD++;
   }
@@ -390,14 +293,15 @@ void HLRAlgo_PolyInternalData::UpdateLinks
 //=======================================================================
 
 Standard_Integer
-HLRAlgo_PolyInternalData::AddNode (const Standard_Address Nod1RValues,
-                                  const Standard_Address Nod2RValues,
-                                  Standard_Address& PINod1,
-                                  Standard_Address& PINod2,
-                                  const Standard_Real coef1,
-                                  const Standard_Real X3,
-                                  const Standard_Real Y3,
-                                  const Standard_Real Z3)
+HLRAlgo_PolyInternalData::AddNode (
+  HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
+  HLRAlgo_PolyInternalNode::NodeData& Nod2RValues,
+  HLRAlgo_Array1OfPINod*& PINod1,
+  HLRAlgo_Array1OfPINod*& PINod2,
+  const Standard_Real coef1,
+  const Standard_Real X3,
+  const Standard_Real Y3,
+  const Standard_Real Z3)
 {
   Standard_Real coef2 = 1 - coef1;
   IncPINod(PINod1,PINod2);
@@ -405,30 +309,21 @@ HLRAlgo_PolyInternalData::AddNode (const Standard_Address Nod1RValues,
   Handle(HLRAlgo_PolyInternalNode)* pip3 = 
     &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip3));
   *pip3 = new HLRAlgo_PolyInternalNode();
-  const Standard_Address Nod3RValues = (*pip3)->RValues();
-  const Standard_Address Nod3Indices = (*pip3)->Indices();
-  Nod3NdSg = 0;
-  Nod3Flag = 0;
-  Nod3PntX = X3;
-  Nod3PntY = Y3;
-  Nod3PntZ = Z3;
-  Nod3PntU = Nod1PntU * coef2 + Nod2PntU * coef1;
-  Nod3PntV = Nod1PntV * coef2 + Nod2PntV * coef1; 
-  Nod3Scal = Nod1Scal * coef2 + Nod2Scal * coef1;
-  Standard_Real x = Nod1NrmX * coef2 + Nod2NrmX * coef1;
-  Standard_Real y = Nod1NrmY * coef2 + Nod2NrmY * coef1;
-  Standard_Real z = Nod1NrmZ * coef2 + Nod2NrmZ * coef1;
-  Standard_Real d = sqrt(x * x + y * y + z * z);
-
-  if (d > 0) {
-    Nod3NrmX = x / d;
-    Nod3NrmY = y / d;
-    Nod3NrmZ = z / d;
+  HLRAlgo_PolyInternalNode::NodeData& Nod3RValues = (*pip3)->Data();
+  HLRAlgo_PolyInternalNode::NodeIndices& aNodeIndices = (*pip3)->Indices();
+  aNodeIndices.NdSg = 0;
+  aNodeIndices.Flag = 0;
+  Nod3RValues.Point = gp_XYZ(X3, Y3, Z3);
+  Nod3RValues.UV = coef2 * Nod1RValues.UV + coef1 * Nod2RValues.UV;
+  Nod3RValues.Scal = Nod1RValues.Scal * coef2 + Nod2RValues.Scal * coef1;
+  const gp_XYZ aXYZ = coef2 * Nod1RValues.Normal + coef1 * Nod2RValues.Normal;
+  const Standard_Real aNorm = aXYZ.Modulus();
+
+  if (aNorm > 0) {
+    Nod3RValues.Normal = (1 / aNorm) * aXYZ;
   }
   else {
-    Nod3NrmX = 1;
-    Nod3NrmY = 0;
-    Nod3NrmZ = 0;
+    Nod3RValues.Normal = gp_XYZ(1., 0., 0.);
 #ifdef OCCT_DEBUG
     if (ERROR)
       cout << "HLRAlgo_PolyInternalData::AddNode" << endl;
@@ -446,16 +341,16 @@ void
 HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
                                       const Standard_Integer ip2,
                                       const Standard_Integer ip3,
-                                      Standard_Address& TData1,
-                                      Standard_Address& TData2,
-                                      Standard_Address& PISeg1,
-                                      Standard_Address& PISeg2,
-                                      Standard_Address& PINod1,
-                                      Standard_Address& )
+                                      HLRAlgo_Array1OfTData*& TData1,
+                                      HLRAlgo_Array1OfTData*& TData2,
+                                      HLRAlgo_Array1OfPISeg*& PISeg1,
+                                      HLRAlgo_Array1OfPISeg*& PISeg2,
+                                      HLRAlgo_Array1OfPINod*& PINod1,
+                                      HLRAlgo_Array1OfPINod*& )
 {
   Standard_Integer find,iiii,iisv,icsv,iip2 =0,cnx1 =0,cnx2 =0;
-  Standard_Address Seg1Indices,Seg2Indices = NULL;
-  Seg1Indices = 0;
+  HLRAlgo_PolyInternalSegment* aSegIndices = NULL;
+  HLRAlgo_PolyInternalSegment* aSegIndices2 = NULL;
   find = 0;
   iisv = 0;
   icsv = 0;
@@ -468,54 +363,53 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
   IncTData(TData1,TData2);
   myNbTData--;
   myNbTData--;
-  Standard_Address Nod1Indices =
-    ((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip1)->Indices();
-  Standard_Address Nod2Indices =
-    ((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip2)->Indices();
-  Standard_Address Nod3Indices =
-    ((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip3)->Indices();
-  iiii = Nod2NdSg;
+  HLRAlgo_PolyInternalNode::NodeIndices* aNodIndices1 =
+    &PINod1->ChangeValue(ip1)->Indices();
+  HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices2 =
+    PINod1->ChangeValue(ip2)->Indices();
+  HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices3 =
+    PINod1->ChangeValue(ip3)->Indices();
+  iiii = aNodIndices2.NdSg;
   
   while (iiii != 0 && find == 0) {
-    Seg2Indices =
-      ((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
-    if (Seg2LstSg1 == ip2) {
-      if (Seg2LstSg2 == ip1) {
+    aSegIndices2 = &PISeg1->ChangeValue(iiii);
+    if (aSegIndices2->LstSg1 == ip2) {
+      if (aSegIndices2->LstSg2 == ip1) {
        find = iiii;
-       cnx1 = Seg2Conex1;
-       cnx2 = Seg2Conex2;
-       Seg2LstSg1 = ip3;
-       iip2 = Seg2NxtSg1;
-       Seg2NxtSg1 = myNbPISeg;
-       if      (iisv == 0) Nod2NdSg   = myNbPISeg;
-       else if (icsv == 1) Seg1NxtSg1 = myNbPISeg;
-       else                Seg1NxtSg2 = myNbPISeg;
+       cnx1 = aSegIndices2->Conex1;
+       cnx2 = aSegIndices2->Conex2;
+       aSegIndices2->LstSg1 = ip3;
+       iip2 = aSegIndices2->NxtSg1;
+       aSegIndices2->NxtSg1 = myNbPISeg;
+       if      (iisv == 0) aNodIndices2.NdSg   = myNbPISeg;
+       else if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
+       else                aSegIndices->NxtSg2 = myNbPISeg;
       }
       else { 
        iisv = iiii;
        icsv = 1;
       }
-      iiii = Seg2NxtSg1;
+      iiii = aSegIndices2->NxtSg1;
     }
     else {
-      if (Seg2LstSg1 == ip1) {
+      if (aSegIndices2->LstSg1 == ip1) {
        find = iiii;
-       cnx1 = Seg2Conex1;
-       cnx2 = Seg2Conex2;
-       Seg2LstSg2 = ip3;
-       iip2 = Seg2NxtSg2;
-       Seg2NxtSg2 = myNbPISeg;
-       if      (iisv == 0) Nod2NdSg   = myNbPISeg;
-       else if (icsv == 1) Seg1NxtSg1 = myNbPISeg;
-       else                Seg1NxtSg2 = myNbPISeg;
+       cnx1 = aSegIndices2->Conex1;
+       cnx2 = aSegIndices2->Conex2;
+       aSegIndices2->LstSg2 = ip3;
+       iip2 = aSegIndices2->NxtSg2;
+       aSegIndices2->NxtSg2 = myNbPISeg;
+       if      (iisv == 0) aNodIndices2.NdSg   = myNbPISeg;
+       else if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
+       else                aSegIndices->NxtSg2 = myNbPISeg;
       }
       else { 
        iisv = iiii;
        icsv = 2;
       }
-      iiii = Seg2NxtSg2;
+      iiii = aSegIndices2->NxtSg2;
     }
-    Seg1Indices = Seg2Indices;
+    aSegIndices = aSegIndices2;
   }
   if (find == 0) {
     myNbPISeg--;
@@ -527,15 +421,14 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
 #endif
   }
   else {
-    Seg2Indices =
-      ((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(myNbPISeg).Indices();
-    Seg2NxtSg1 = 0;
-    Seg2NxtSg2 = iip2;
-    Seg2LstSg1 = ip3;
-    Seg2LstSg2 = ip2;
-    Seg2Conex1 = cnx1;
-    Seg2Conex2 = cnx2;
-    Nod3NdSg   = find;
+    aSegIndices2 = &PISeg1->ChangeValue(myNbPISeg);
+    aSegIndices2->NxtSg1 = 0;
+    aSegIndices2->NxtSg2 = iip2;
+    aSegIndices2->LstSg1 = ip3;
+    aSegIndices2->LstSg2 = ip2;
+    aSegIndices2->Conex1 = cnx1;
+    aSegIndices2->Conex2 = cnx2;
+    aNodIndices3.NdSg   = find;
 
     Standard_Integer iOld,iNew,iTr,skip,ip4,itpk[2];
     Standard_Integer n1,n2,n3,nOld[3],nNew[3],New[4];
@@ -554,13 +447,11 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
       iOld = New[skip];
       iNew = New[skip + 2];
       if (iOld != 0) {
-       Standard_Address Tri1Indices =
-         ((HLRAlgo_Array1OfTData*)TData1)->ChangeValue(iOld).Indices();
-       Standard_Address Tri2Indices =
-         ((HLRAlgo_Array1OfTData*)TData1)->ChangeValue(iNew).Indices();
-       n1 = Tri1Node1;
-       n2 = Tri1Node2;
-       n3 = Tri1Node3;
+  HLRAlgo_TriangleData& aTriangle = TData1->ChangeValue(iOld);
+  HLRAlgo_TriangleData& aTriangle2 = TData1->ChangeValue(iNew);
+       n1 = aTriangle.Node1;
+       n2 = aTriangle.Node2;
+       n3 = aTriangle.Node3;
        nOld[0] = n1;
         nOld[1] = n2;
         nOld[2] = n3;
@@ -607,26 +498,25 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
        if (found) {
          myNbTData++;
          ip4 = itpk[skip];
-         Standard_Address Nod4Indices =
-           ((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip4)->Indices();
-         Tri1Node1 = nOld[0];
-         Tri1Node2 = nOld[1];
-         Tri1Node3 = nOld[2];
-         Tri2Node1 = nNew[0];
-         Tri2Node2 = nNew[1];
-         Tri2Node3 = nNew[2];
-         Tri2Flags = Tri1Flags;
+         HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices4 =
+      PINod1->ChangeValue(ip4)->Indices();
+         aTriangle.Node1 = nOld[0];
+         aTriangle.Node2 = nOld[1];
+         aTriangle.Node3 = nOld[2];
+         aTriangle2.Node1 = nNew[0];
+         aTriangle2.Node2 = nNew[1];
+         aTriangle2.Node3 = nNew[2];
+         aTriangle2.Flags = aTriangle.Flags;
          myNbPISeg++;
-         Seg2Indices =
-           ((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(myNbPISeg).Indices();
-         Seg2LstSg1 = ip3;
-         Seg2LstSg2 = ip4;
-         Seg2NxtSg1 = Nod3NdSg;
-         Seg2NxtSg2 = Nod4NdSg;
-         Seg2Conex1 = iOld;
-         Seg2Conex2 = iNew;
-         Nod3NdSg   = myNbPISeg;
-         Nod4NdSg   = myNbPISeg;
+    aSegIndices2 = &PISeg1->ChangeValue(myNbPISeg);
+         aSegIndices2->LstSg1 = ip3;
+         aSegIndices2->LstSg2 = ip4;
+         aSegIndices2->NxtSg1 = aNodIndices3.NdSg;
+         aSegIndices2->NxtSg2 = aNodIndices4.NdSg;
+         aSegIndices2->Conex1 = iOld;
+         aSegIndices2->Conex2 = iNew;
+         aNodIndices3.NdSg   = myNbPISeg;
+         aNodIndices4.NdSg   = myNbPISeg;
        }
 #ifdef OCCT_DEBUG
        else if (ERROR) {
@@ -644,37 +534,34 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
       iOld = New [skip];
       ip4  = itpk[skip];
       if (iNew != 0) {
-       Standard_Address Tri2Indices =
-         ((HLRAlgo_Array1OfTData*)TData1)->ChangeValue(iNew).Indices();
-       n1 = Tri2Node1;
-       n2 = Tri2Node2;
-       n3 = Tri2Node3; 
+  HLRAlgo_TriangleData& aTriangle2 = TData1->ChangeValue(iNew);
+       n1 = aTriangle2.Node1;
+       n2 = aTriangle2.Node2;
+       n3 = aTriangle2.Node3;
        
        if (!((n1 == ip3 && n2 == ip4) ||
              (n2 == ip3 && n1 == ip4))) {
          Standard_Boolean found = Standard_False;
-         Nod1Indices =
-           ((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n1)->Indices();
-         iiii = Nod1NdSg;
+    aNodIndices1 = &PINod1->ChangeValue(n1)->Indices();
+         iiii = aNodIndices1->NdSg;
          
          while (iiii != 0 && !found) {
-           Seg2Indices =
-             ((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
-           if (Seg2LstSg1 == n1) {
-             if (Seg2LstSg2 == n2) {
+      aSegIndices2 = &PISeg1->ChangeValue(iiii);
+           if (aSegIndices2->LstSg1 == n1) {
+             if (aSegIndices2->LstSg2 == n2) {
                found = Standard_True;
-               if      (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
-               else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
+               if      (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
+               else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
              }
-             else iiii = Seg2NxtSg1;
+             else iiii = aSegIndices2->NxtSg1;
            }
            else {
-             if (Seg2LstSg1 == n2) {
+             if (aSegIndices2->LstSg1 == n2) {
                found = Standard_True;
-               if      (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
-               else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
+               if      (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
+               else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
              }
-             else iiii = Seg2NxtSg2;
+             else iiii = aSegIndices2->NxtSg2;
            }
          }
        }
@@ -682,28 +569,26 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
        if (!((n2 == ip3 && n3 == ip4) ||
              (n3 == ip3 && n2 == ip4))) {
          Standard_Boolean found = Standard_False;
-         Nod1Indices =
-           ((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n2)->Indices();
-         iiii = Nod1NdSg;
+    aNodIndices1 = &PINod1->ChangeValue(n2)->Indices();
+         iiii = aNodIndices1->NdSg;
          
          while (iiii != 0 && !found) {
-           Seg2Indices =
-             ((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
-           if (Seg2LstSg1 == n2) {
-             if (Seg2LstSg2 == n3) {
+      aSegIndices2 = &PISeg1->ChangeValue(iiii);
+           if (aSegIndices2->LstSg1 == n2) {
+             if (aSegIndices2->LstSg2 == n3) {
                found = Standard_True;
-               if      (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
-               else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
+               if      (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
+               else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
              }
-             else iiii = Seg2NxtSg1;
+             else iiii = aSegIndices2->NxtSg1;
            }
            else {
-             if (Seg2LstSg1 == n3) {
+             if (aSegIndices2->LstSg1 == n3) {
                found = Standard_True;
-               if      (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
-               else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
+               if      (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
+               else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
              }
-             else iiii = Seg2NxtSg2;
+             else iiii = aSegIndices2->NxtSg2;
            }
          }
        }
@@ -711,28 +596,26 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
        if (!((n3 == ip3 && n1 == ip4) ||
              (n1 == ip3 && n3 == ip4))) {
          Standard_Boolean found = Standard_False;
-         Nod1Indices =
-           ((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(n3)->Indices();
-         iiii = Nod1NdSg;
+    aNodIndices1 = &PINod1->ChangeValue(n3)->Indices();
+         iiii = aNodIndices1->NdSg;
          
          while (iiii != 0 && !found) {
-           Seg2Indices =
-             ((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iiii).Indices();
-           if (Seg2LstSg1 == n3) {
-             if (Seg2LstSg2 == n1) {
+      aSegIndices2 = &PISeg1->ChangeValue(iiii);
+           if (aSegIndices2->LstSg1 == n3) {
+             if (aSegIndices2->LstSg2 == n1) {
                found = Standard_True;
-               if      (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
-               else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
+               if      (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
+               else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
              }
-             else iiii = Seg2NxtSg1;
+             else iiii = aSegIndices2->NxtSg1;
            }
            else {
-             if (Seg2LstSg1 == n1) {
+             if (aSegIndices2->LstSg1 == n1) {
                found = Standard_True;
-               if      (Seg2Conex1 == iOld) Seg2Conex1 = iNew;
-               else if (Seg2Conex2 == iOld) Seg2Conex2 = iNew;
+               if      (aSegIndices2->Conex1 == iOld) aSegIndices2->Conex1 = iNew;
+               else if (aSegIndices2->Conex2 == iOld) aSegIndices2->Conex2 = iNew;
              }
-             else iiii = Seg2NxtSg2;
+             else iiii = aSegIndices2->NxtSg2;
            }
          }
        }
@@ -749,44 +632,40 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
 void HLRAlgo_PolyInternalData::Dump () const
 {
   Standard_Integer i;//,i1,i2,i3;
-  Standard_Address Seg2Indices;
-  Standard_Address TData = &myTData->ChangeArray1();
-  Standard_Address PISeg = &myPISeg->ChangeArray1();
-  Standard_Address PINod = &myPINod->ChangeArray1();
+  HLRAlgo_Array1OfTData* TData = &myTData->ChangeArray1();
+  HLRAlgo_Array1OfPISeg* PISeg = &myPISeg->ChangeArray1();
+  HLRAlgo_Array1OfPINod* PINod = &myPINod->ChangeArray1();
   
   for (i = 1; i <= myNbPINod; i++) {
-    const Handle(HLRAlgo_PolyInternalNode)* pi =
-      &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(i));
-    Standard_Address Nod1Indices = (*pi)->Indices();
-    Standard_Address Nod1RValues = (*pi)->RValues();
+    const Handle(HLRAlgo_PolyInternalNode)* pi = &PINod->ChangeValue(i);
+    HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices1 = (*pi)->Indices();
+    HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*pi)->Data();
     cout << "Node " << setw(6) << i << " : ";
-    cout << setw(6) << Nod1NdSg;
-    cout << setw(20)<< Nod1PntX;
-    cout << setw(20)<< Nod1PntY;
-    cout << setw(20)<< Nod1PntZ;
+    cout << setw(6) << aNodIndices1.NdSg;
+    cout << setw(20)<< Nod1RValues.Point.X();
+    cout << setw(20)<< Nod1RValues.Point.Y();
+    cout << setw(20)<< Nod1RValues.Point.Z();
     cout << endl;
   }
 
   for (i = 1; i <= myNbPISeg; i++) {
-    Seg2Indices =
-      ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(i).Indices();
+    HLRAlgo_PolyInternalSegment* aSegIndices = &PISeg->ChangeValue(i);
     cout << "Segment " << setw(6) << i << " : ";
-    cout << setw(6) << Seg2LstSg1;
-    cout << setw(6) << Seg2LstSg2;
-    cout << setw(6) << Seg2NxtSg1;
-    cout << setw(6) << Seg2NxtSg2;
-    cout << setw(6) << Seg2Conex1;
-    cout << setw(6) << Seg2Conex2;
+    cout << setw(6) << aSegIndices->LstSg1;
+    cout << setw(6) << aSegIndices->LstSg2;
+    cout << setw(6) << aSegIndices->NxtSg1;
+    cout << setw(6) << aSegIndices->NxtSg2;
+    cout << setw(6) << aSegIndices->Conex1;
+    cout << setw(6) << aSegIndices->Conex2;
     cout << endl;
   }
 
   for (i = 1; i <= myNbTData; i++) {
-    Standard_Address Tri2Indices =
-      ((HLRAlgo_Array1OfTData*)TData)->ChangeValue(i).Indices();
+    HLRAlgo_TriangleData& aTriangle = TData->ChangeValue(i);
     cout << "Triangle " << setw(6) << i << " : ";
-    cout << setw(6) << Tri2Node1;
-    cout << setw(6) << Tri2Node2;
-    cout << setw(6) << Tri2Node3;
+    cout << setw(6) << aTriangle.Node1;
+    cout << setw(6) << aTriangle.Node2;
+    cout << setw(6) << aTriangle.Node3;
     cout << endl;
   }
 }
@@ -796,9 +675,8 @@ void HLRAlgo_PolyInternalData::Dump () const
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo_PolyInternalData::
-IncTData (Standard_Address& TData1,
-         Standard_Address& TData2)
+void HLRAlgo_PolyInternalData::IncTData(
+  HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfTData*& TData2)
 {
   if (myNbTData >= myMxTData) {
 #ifdef OCCT_DEBUG
@@ -813,19 +691,10 @@ IncTData (Standard_Address& TData1,
       new HLRAlgo_HArray1OfTData(0,k);
     HLRAlgo_Array1OfTData& oTData = myTData->ChangeArray1();
     HLRAlgo_Array1OfTData& nTData = NwTData->ChangeArray1();
-    HLRAlgo_TriangleData* OT = &(oTData.ChangeValue(1));
-    HLRAlgo_TriangleData* NT = &(nTData.ChangeValue(1));
-    Standard_Address Tri1Indices,Tri2Indices;
 
-    for (i = 1; i <= j; i++) {
-      Tri1Indices = OT->Indices();
-      Tri2Indices = NT->Indices();
-      Tri2Node1 = Tri1Node1;
-      Tri2Node2 = Tri1Node2;
-      Tri2Node3 = Tri1Node3;
-      Tri2Flags = Tri1Flags;
-      OT++;
-      NT++;
+    for (i = 1; i <= j; i++)
+    {
+      nTData.ChangeValue(i) = oTData.Value(i);
     }
     myMxTData = k;
     myTData  = NwTData;
@@ -845,9 +714,8 @@ IncTData (Standard_Address& TData1,
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo_PolyInternalData::
-IncPISeg (Standard_Address& PISeg1,
-         Standard_Address& PISeg2)
+void HLRAlgo_PolyInternalData::IncPISeg(
+  HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPISeg*& PISeg2)
 { 
   if (myNbPISeg >= myMxPISeg) {
 #ifdef OCCT_DEBUG
@@ -861,21 +729,10 @@ IncPISeg (Standard_Address& PISeg1,
       new HLRAlgo_HArray1OfPISeg(0,k);
     HLRAlgo_Array1OfPISeg& oPISeg = myPISeg->ChangeArray1();
     HLRAlgo_Array1OfPISeg& nPISeg = NwPISeg->ChangeArray1();
-    HLRAlgo_PolyInternalSegment* OS = &(oPISeg.ChangeValue(1));
-    HLRAlgo_PolyInternalSegment* NS = &(nPISeg.ChangeValue(1));
-    Standard_Address Seg1Indices,Seg2Indices;
 
-    for (i = 1; i <= j; i++) {
-      Seg1Indices = OS->Indices();
-      Seg2Indices = NS->Indices();
-      Seg2LstSg1 = Seg1LstSg1;
-      Seg2LstSg2 = Seg1LstSg2;
-      Seg2NxtSg1 = Seg1NxtSg1;
-      Seg2NxtSg2 = Seg1NxtSg2;
-      Seg2Conex1 = Seg1Conex1;
-      Seg2Conex2 = Seg1Conex2;
-      OS++;
-      NS++;
+    for (i = 1; i <= j; i++)
+    {
+      nPISeg.ChangeValue(i) = oPISeg.Value(i);
     }
     myMxPISeg = k;
     myPISeg = NwPISeg;
@@ -895,9 +752,8 @@ IncPISeg (Standard_Address& PISeg1,
 //purpose  : 
 //=======================================================================
 
-void HLRAlgo_PolyInternalData::
-IncPINod (Standard_Address& PINod1,
-         Standard_Address& PINod2)
+void HLRAlgo_PolyInternalData::IncPINod(
+  HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_Array1OfPINod*& PINod2)
 {
   if (myNbPINod >= myMxPINod) {
 #ifdef OCCT_DEBUG
@@ -905,7 +761,6 @@ IncPINod (Standard_Address& PINod1,
       cout << "HLRAlgo_PolyInternalData::IncPINod : " << myMxPINod << endl;
 #endif
     Standard_Integer i,j,k;
-//    Standard_Address Nod1Indices;
     j = myMxPINod;
     k = 2 * j;
     Handle(HLRAlgo_HArray1OfPINod) NwPINod =
index 599d1cb..d79828b 100644 (file)
@@ -26,7 +26,6 @@
 #include <HLRAlgo_HArray1OfPISeg.hxx>
 #include <HLRAlgo_HArray1OfPINod.hxx>
 #include <MMgt_TShared.hxx>
-#include <Standard_Address.hxx>
 #include <Standard_Real.hxx>
 #include <HLRAlgo_Array1OfTData.hxx>
 #include <HLRAlgo_Array1OfPISeg.hxx>
@@ -45,19 +44,19 @@ public:
   
   Standard_EXPORT HLRAlgo_PolyInternalData(const Standard_Integer nbNod, const Standard_Integer nbTri);
   
-  Standard_EXPORT void UpdateLinks (Standard_Address& TData, Standard_Address& PISeg, Standard_Address& PINod);
+  Standard_EXPORT void UpdateLinks (HLRAlgo_Array1OfTData*& TData, HLRAlgo_Array1OfPISeg*& PISeg, HLRAlgo_Array1OfPINod*& PINod);
   
-  Standard_EXPORT Standard_Integer AddNode (const Standard_Address Nod1RValues, const Standard_Address Nod2RValues, Standard_Address& PINod1, Standard_Address& PINod2, const Standard_Real coef1, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3);
+  Standard_EXPORT Standard_Integer AddNode (HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_PolyInternalNode::NodeData& Nod2RValues, HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_Array1OfPINod*& PINod2, const Standard_Real coef1, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3);
   
-  Standard_EXPORT void UpdateLinks (const Standard_Integer ip1, const Standard_Integer ip2, const Standard_Integer ip3, Standard_Address& TData1, Standard_Address& TData2, Standard_Address& PISeg1, Standard_Address& PISeg2, Standard_Address& PINod1, Standard_Address& PINod2);
+  Standard_EXPORT void UpdateLinks (const Standard_Integer ip1, const Standard_Integer ip2, const Standard_Integer ip3, HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfTData*& TData2, HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPISeg*& PISeg2, HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_Array1OfPINod*& PINod2);
   
   Standard_EXPORT void Dump() const;
   
-  Standard_EXPORT void IncTData (Standard_Address& TData1, Standard_Address& TData2);
+  Standard_EXPORT void IncTData (HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfTData*& TData2);
   
-  Standard_EXPORT void IncPISeg (Standard_Address& PISeg1, Standard_Address& PISeg2);
+  Standard_EXPORT void IncPISeg (HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPISeg*& PISeg2);
   
-  Standard_EXPORT void IncPINod (Standard_Address& PINod1, Standard_Address& PINod2);
+  Standard_EXPORT void IncPINod (HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_Array1OfPINod*& PINod2);
   
     void DecTData();
   
index cb09fd9..d7c677f 100644 (file)
@@ -23,7 +23,8 @@
 #include <Standard_Integer.hxx>
 #include <Standard_Real.hxx>
 #include <MMgt_TShared.hxx>
-#include <Standard_Address.hxx>
+#include <gp_XYZ.hxx>
+#include <gp_XY.hxx>
 
 
 class HLRAlgo_PolyInternalNode;
@@ -32,40 +33,42 @@ DEFINE_STANDARD_HANDLE(HLRAlgo_PolyInternalNode, MMgt_TShared)
 //! to Update OutLines.
 class HLRAlgo_PolyInternalNode : public MMgt_TShared
 {
-
 public:
-
-  
-    HLRAlgo_PolyInternalNode();
-  
-    Standard_Address Indices() const;
-  
-    Standard_Address RValues() const;
-
-
-
+  struct NodeIndices
+  {
+    Standard_Integer NdSg, Flag, Edg1, Edg2;
+  };
+
+  struct NodeData
+  {
+    gp_XYZ Point, Normal;
+    gp_XY UV;
+    Standard_Real PCu1, PCu2, Scal;
+  };
+
+  HLRAlgo_PolyInternalNode()
+  {
+    myIndices.NdSg = 0;
+    myIndices.Flag = 0;
+    myIndices.Edg1 = 0;
+    myIndices.Edg2 = 0;
+  }
+
+  NodeIndices& Indices()
+  {
+    return myIndices;
+  }
+
+  NodeData& Data()
+  {
+    return myData;
+  }
 
   DEFINE_STANDARD_RTTIEXT(HLRAlgo_PolyInternalNode,MMgt_TShared)
 
-protected:
-
-
-
-
 private:
-
-
-  Standard_Integer myIndices[4];
-  Standard_Real myRValues[11];
-
-
+  NodeIndices myIndices;
+  NodeData myData;
 };
 
-
-#include <HLRAlgo_PolyInternalNode.lxx>
-
-
-
-
-
 #endif // _HLRAlgo_PolyInternalNode_HeaderFile
diff --git a/src/HLRAlgo/HLRAlgo_PolyInternalNode.lxx b/src/HLRAlgo/HLRAlgo_PolyInternalNode.lxx
deleted file mode 100644 (file)
index 748e408..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// Created on: 1997-01-10
-// Created by: Christophe MARION
-// Copyright (c) 1997-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.
-
-//=======================================================================
-//function : HLRAlgo_PolyInternalNode
-//purpose  : 
-//=======================================================================
-
-inline HLRAlgo_PolyInternalNode::HLRAlgo_PolyInternalNode ()
-{
-  myIndices[0] = 0;
-  myIndices[1] = 0;
-  myIndices[2] = 0;
-  myIndices[3] = 0;
-}
-
-//=======================================================================
-//function : Indices
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRAlgo_PolyInternalNode::Indices () const
-{ return (Standard_Address)myIndices; }
-
-//=======================================================================
-//function : RValues
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRAlgo_PolyInternalNode::RValues () const
-{ return (Standard_Address)myRValues; }
index 53c8cca..1e648fa 100644 (file)
 #include <Standard_Handle.hxx>
 
 #include <Standard_Integer.hxx>
-#include <Standard_Address.hxx>
-
 
 //! to Update OutLines.
-class HLRAlgo_PolyInternalSegment 
+struct HLRAlgo_PolyInternalSegment
 {
-public:
-
   DEFINE_STANDARD_ALLOC
 
-  
-    HLRAlgo_PolyInternalSegment();
-  
-    Standard_Address Indices() const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-  Standard_Integer myIndices[6];
-
-
+  Standard_Integer LstSg1, LstSg2, NxtSg1, NxtSg2, Conex1, Conex2;
 };
 
-
-#include <HLRAlgo_PolyInternalSegment.lxx>
-
-
-
-
-
 #endif // _HLRAlgo_PolyInternalSegment_HeaderFile
diff --git a/src/HLRAlgo/HLRAlgo_PolyInternalSegment.lxx b/src/HLRAlgo/HLRAlgo_PolyInternalSegment.lxx
deleted file mode 100644 (file)
index d418a45..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Created on: 1996-12-03
-// Created by: Christophe MARION
-// Copyright (c) 1996-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.
-
-//=======================================================================
-//function : HLRAlgo_PolyInternalSegment
-//purpose  : 
-//=======================================================================
-
-inline HLRAlgo_PolyInternalSegment::HLRAlgo_PolyInternalSegment ()
-{}
-
-//=======================================================================
-//function : Indices
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRAlgo_PolyInternalSegment::Indices () const
-{ return (Standard_Address)myIndices; }
diff --git a/src/HLRAlgo/HLRAlgo_PolyMask.hxx b/src/HLRAlgo/HLRAlgo_PolyMask.hxx
new file mode 100644 (file)
index 0000000..7bbb6c8
--- /dev/null
@@ -0,0 +1,37 @@
+// Created on: 2016-10-14
+// Created by: Aleksandr Bobkov
+// 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.
+
+#ifndef _HLRAlgo_PolyMask_HeaderFile
+#define _HLRAlgo_PolyMask_HeaderFile
+
+enum HLRAlgo_PolyMask
+{
+  HLRAlgo_PolyMask_EMskOutLin1 =    1,
+  HLRAlgo_PolyMask_EMskOutLin2 =    2,
+  HLRAlgo_PolyMask_EMskOutLin3 =    4,
+  HLRAlgo_PolyMask_EMskGrALin1 =    8,
+  HLRAlgo_PolyMask_EMskGrALin2 =   16,
+  HLRAlgo_PolyMask_EMskGrALin3 =   32,
+  HLRAlgo_PolyMask_FMskBack    =   64,
+  HLRAlgo_PolyMask_FMskSide    =  128,
+  HLRAlgo_PolyMask_FMskHiding  =  256,
+  HLRAlgo_PolyMask_FMskFlat    =  512,
+  HLRAlgo_PolyMask_FMskOnOutL  = 1024,
+  HLRAlgo_PolyMask_FMskOrBack  = 2048,
+  HLRAlgo_PolyMask_FMskFrBack  = 4096
+};
+
+#endif // _HLRAlgo_PolyData_HeaderFile
index 924a9a7..796bca1 100644 (file)
 
 IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyShellData,MMgt_TShared)
 
-#define PntX1  ((Standard_Real*)Coordinates)[ 0]
-#define PntY1  ((Standard_Real*)Coordinates)[ 1]
-#define PntZ1  ((Standard_Real*)Coordinates)[ 2]
-#define PntX2  ((Standard_Real*)Coordinates)[ 3]
-#define PntY2  ((Standard_Real*)Coordinates)[ 4]
-#define PntZ2  ((Standard_Real*)Coordinates)[ 5]
-#define PntXP1 ((Standard_Real*)Coordinates)[ 6]
-#define PntYP1 ((Standard_Real*)Coordinates)[ 7]
-#define PntZP1 ((Standard_Real*)Coordinates)[ 8]
-#define PntXP2 ((Standard_Real*)Coordinates)[ 9]
-#define PntYP2 ((Standard_Real*)Coordinates)[10]
-#define PntZP2 ((Standard_Real*)Coordinates)[11]
-
-#define TotXMin ((Standard_Real*)TotMinMax)[0]
-#define TotYMin ((Standard_Real*)TotMinMax)[1]
-#define TotZMin ((Standard_Real*)TotMinMax)[2]
-#define TotXMax ((Standard_Real*)TotMinMax)[3]
-#define TotYMax ((Standard_Real*)TotMinMax)[4]
-#define TotZMax ((Standard_Real*)TotMinMax)[5]
-
 //=======================================================================
 //function : HLRAlgo_PolyShellData
 //purpose  : 
@@ -63,37 +43,36 @@ HLRAlgo_PolyShellData (const Standard_Integer nbFace)
 //=======================================================================
 
 void 
-HLRAlgo_PolyShellData::
-UpdateGlobalMinMax(const Standard_Address TotMinMax)
+HLRAlgo_PolyShellData::UpdateGlobalMinMax(HLRAlgo_PolyData::Box& theBox)
 {
   HLRAlgo_ListIteratorOfListOfBPoint it;
   
   for (it.Initialize(mySegList); it.More(); it.Next()) {      
     HLRAlgo_BiPoint& BP = it.Value();
-    const Standard_Address Coordinates = BP.Coordinates();
-    if (PntXP1 < PntXP2) {
-      if      (TotXMin > PntXP1) TotXMin = PntXP1;
-      else if (TotXMax < PntXP2) TotXMax = PntXP2;
+    HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+    if (aPoints.PntP1.X() < aPoints.PntP2.X()) {
+      if      (theBox.XMin > aPoints.PntP1.X()) theBox.XMin = aPoints.PntP1.X();
+      else if (theBox.XMax < aPoints.PntP2.X()) theBox.XMax = aPoints.PntP2.X();
     }
     else             {
-      if      (TotXMin > PntXP2) TotXMin = PntXP2;
-      else if (TotXMax < PntXP1) TotXMax = PntXP1;
+      if      (theBox.XMin > aPoints.PntP2.X()) theBox.XMin = aPoints.PntP2.X();
+      else if (theBox.XMax < aPoints.PntP1.X()) theBox.XMax = aPoints.PntP1.X();
     }
-    if (PntYP1 < PntYP2) {
-      if      (TotYMin > PntYP1) TotYMin = PntYP1;
-      else if (TotYMax < PntYP2) TotYMax = PntYP2;
+    if (aPoints.PntP1.Y() < aPoints.PntP2.Y()) {
+      if      (theBox.YMin > aPoints.PntP1.Y()) theBox.YMin = aPoints.PntP1.Y();
+      else if (theBox.YMax < aPoints.PntP2.Y()) theBox.YMax = aPoints.PntP2.Y();
     }
     else             {
-      if      (TotYMin > PntYP2) TotYMin = PntYP2;
-      else if (TotYMax < PntYP1) TotYMax = PntYP1;
+      if      (theBox.YMin > aPoints.PntP2.Y()) theBox.YMin = aPoints.PntP2.Y();
+      else if (theBox.YMax < aPoints.PntP1.Y()) theBox.YMax = aPoints.PntP1.Y();
     }
-    if (PntZP1 < PntZP2) {
-      if      (TotZMin > PntZP1) TotZMin = PntZP1;
-      else if (TotZMax < PntZP2) TotZMax = PntZP2;
+    if (aPoints.PntP1.Z() < aPoints.PntP2.Z()) {
+      if      (theBox.ZMin > aPoints.PntP1.Z()) theBox.ZMin = aPoints.PntP1.Z();
+      else if (theBox.ZMax < aPoints.PntP2.Z()) theBox.ZMax = aPoints.PntP2.Z();
     }
     else             {
-      if      (TotZMin > PntZP2) TotZMin = PntZP2;
-      else if (TotZMax < PntZP1) TotZMax = PntZP1;
+      if      (theBox.ZMin > aPoints.PntP2.Z()) theBox.ZMin = aPoints.PntP2.Z();
+      else if (theBox.ZMax < aPoints.PntP1.Z()) theBox.ZMax = aPoints.PntP1.Z();
     }
   }
   Standard_Integer nbFace      = myPolyg.Upper();
@@ -101,7 +80,7 @@ UpdateGlobalMinMax(const Standard_Address TotMinMax)
   if(nbFace > 0) pd =  (Handle(HLRAlgo_PolyData)*)&(myPolyg.ChangeValue(1));
   
   for (Standard_Integer i = 1; i <= nbFace; i++) {
-    (*pd)->UpdateGlobalMinMax(TotMinMax);
+    (*pd)->UpdateGlobalMinMax(theBox);
     pd++;
   }
 }
index c458fb5..9322faf 100644 (file)
@@ -25,7 +25,6 @@
 #include <TColStd_HArray1OfTransient.hxx>
 #include <HLRAlgo_ListOfBPoint.hxx>
 #include <MMgt_TShared.hxx>
-#include <Standard_Address.hxx>
 #include <Standard_Boolean.hxx>
 
 
@@ -37,11 +36,15 @@ class HLRAlgo_PolyShellData : public MMgt_TShared
 {
 
 public:
+  struct ShellIndices
+  {
+    Standard_Integer Min, Max;
+  };
 
   
   Standard_EXPORT HLRAlgo_PolyShellData(const Standard_Integer nbFace);
   
-  Standard_EXPORT void UpdateGlobalMinMax (const Standard_Address TotMinMax);
+  Standard_EXPORT void UpdateGlobalMinMax (HLRAlgo_PolyData::Box& theBox);
   
   Standard_EXPORT void UpdateHiding (const Standard_Integer nbHiding);
   
@@ -53,7 +56,10 @@ public:
   
     HLRAlgo_ListOfBPoint& Edges();
   
-    Standard_Address Indices();
+    ShellIndices& Indices()
+    {
+      return myIndices;
+    }
 
 
 
@@ -68,7 +74,7 @@ protected:
 private:
 
 
-  Standard_Integer myMinMax[2];
+  ShellIndices myIndices;
   TColStd_Array1OfTransient myPolyg;
   Handle(TColStd_HArray1OfTransient) myHPolHi;
   HLRAlgo_ListOfBPoint mySegList;
index fe0f386..1752e6c 100644 (file)
@@ -51,11 +51,3 @@ HLRAlgo_PolyShellData::HidingPolyData ()
 inline HLRAlgo_ListOfBPoint &
 HLRAlgo_PolyShellData::Edges ()
 { return mySegList; }
-
-//=======================================================================
-//function : Indices
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRAlgo_PolyShellData::Indices ()
-{ return (Standard_Address)myMinMax; }
index 2113132..d2e88ae 100644 (file)
 #include <Standard_Handle.hxx>
 
 #include <Standard_Integer.hxx>
-#include <Standard_Address.hxx>
-
 
 //! Data structure of a triangle.
-class HLRAlgo_TriangleData 
+struct HLRAlgo_TriangleData
 {
-public:
-
   DEFINE_STANDARD_ALLOC
 
-  
-    HLRAlgo_TriangleData();
-  
-    Standard_Address Indices() const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-  Standard_Integer myIndices[4];
-
-
+  Standard_Integer Node1, Node2, Node3, Flags;
 };
 
-
-#include <HLRAlgo_TriangleData.lxx>
-
-
-
-
-
 #endif // _HLRAlgo_TriangleData_HeaderFile
diff --git a/src/HLRAlgo/HLRAlgo_TriangleData.lxx b/src/HLRAlgo/HLRAlgo_TriangleData.lxx
deleted file mode 100644 (file)
index 577dc69..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Created on: 1993-01-11
-// Created by: Christophe MARION
-// 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.
-
-//=======================================================================
-//function : TriangleData
-//purpose  : 
-//=======================================================================
-
-inline HLRAlgo_TriangleData::HLRAlgo_TriangleData ()
-{}
-
-//=======================================================================
-//function : Indices
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRAlgo_TriangleData::Indices () const
-{ return (Standard_Address)myIndices; }
index ee2a661..6d1a152 100644 (file)
 #define No_Exception
 #endif
 
-
-#include <HLRAlgo_EdgesBlock.hxx>
 #include <HLRAlgo_WiresBlock.hxx>
 #include <Standard_Type.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_WiresBlock,MMgt_TShared)
-
-//=======================================================================
-//function : HLRAlgo_WiresBlock
-//purpose  : 
-//=======================================================================
-HLRAlgo_WiresBlock::HLRAlgo_WiresBlock (const Standard_Integer NbWires) :
-myWires(1,NbWires)
-{}
-
-//=======================================================================
-//function : NbWires
-//purpose  : 
-//=======================================================================
-
-Standard_Integer HLRAlgo_WiresBlock::NbWires () const
-{ return myWires.Upper(); }
-
-//=======================================================================
-//function : Set
-//purpose  : 
-//=======================================================================
-
-void HLRAlgo_WiresBlock::Set (const Standard_Integer I,
-                             const Handle(HLRAlgo_EdgesBlock)& W)
-{ myWires (I) = W; }
-
-//=======================================================================
-//function : Wire
-//purpose  : 
-//=======================================================================
-
-Handle(HLRAlgo_EdgesBlock) &
-HLRAlgo_WiresBlock::Wire (const Standard_Integer I)
-{ return *((Handle(HLRAlgo_EdgesBlock)*) &myWires(I)); }
-
-//=======================================================================
-//function : UpdateMinMax
-//purpose  : 
-//=======================================================================
-
-void HLRAlgo_WiresBlock::UpdateMinMax (const Standard_Address TotMinMax)
-{
-  for (Standard_Integer i = 0; i <= 15; i++)
-    myMinMax[i] = ((Standard_Integer*)TotMinMax)[i];
-}
index 4f91bde..a114570 100644 (file)
 #ifndef _HLRAlgo_WiresBlock_HeaderFile
 #define _HLRAlgo_WiresBlock_HeaderFile
 
+#include <HLRAlgo_EdgesBlock.hxx>
+
 #include <Standard.hxx>
 #include <Standard_Type.hxx>
 
 #include <TColStd_Array1OfTransient.hxx>
 #include <Standard_Integer.hxx>
 #include <MMgt_TShared.hxx>
-#include <Standard_Address.hxx>
-class HLRAlgo_EdgesBlock;
 
 
 class HLRAlgo_WiresBlock;
@@ -38,47 +38,41 @@ DEFINE_STANDARD_HANDLE(HLRAlgo_WiresBlock, MMgt_TShared)
 //! * An Array  of Blocks.
 class HLRAlgo_WiresBlock : public MMgt_TShared
 {
-
 public:
-
-  
   //! Create a Block of Blocks.
-  Standard_EXPORT HLRAlgo_WiresBlock(const Standard_Integer NbWires);
-  
-  Standard_EXPORT Standard_Integer NbWires() const;
+  HLRAlgo_WiresBlock(const Standard_Integer NbWires) :
+    myWires(1,NbWires)
+  {
+  }
   
-  Standard_EXPORT void Set (const Standard_Integer I, const Handle(HLRAlgo_EdgesBlock)& W);
+  Standard_Integer NbWires() const
+  {
+    return myWires.Upper();
+  }
   
-  Standard_EXPORT Handle(HLRAlgo_EdgesBlock)& Wire (const Standard_Integer I);
+  void Set (const Standard_Integer I, const Handle(HLRAlgo_EdgesBlock)& W)
+  {
+    myWires (I) = W;
+  }
   
-  Standard_EXPORT void UpdateMinMax (const Standard_Address TotMinMax);
+  Handle(HLRAlgo_EdgesBlock)& Wire (const Standard_Integer I)
+  {
+    return *((Handle(HLRAlgo_EdgesBlock)*) &myWires(I));
+  }
   
-    Standard_Address MinMax() const;
-
-
+  void UpdateMinMax (const HLRAlgo_EdgesBlock::MinMaxIndices& theMinMaxes)
+  {myMinMax = theMinMaxes;}
 
+  HLRAlgo_EdgesBlock::MinMaxIndices& MinMax()
+  {
+    return myMinMax;
+  }
 
   DEFINE_STANDARD_RTTIEXT(HLRAlgo_WiresBlock,MMgt_TShared)
 
-protected:
-
-
-
-
 private:
-
-
   TColStd_Array1OfTransient myWires;
-  Standard_Integer myMinMax[16];
-
-
+  HLRAlgo_EdgesBlock::MinMaxIndices myMinMax;
 };
 
-
-#include <HLRAlgo_WiresBlock.lxx>
-
-
-
-
-
 #endif // _HLRAlgo_WiresBlock_HeaderFile
diff --git a/src/HLRAlgo/HLRAlgo_WiresBlock.lxx b/src/HLRAlgo/HLRAlgo_WiresBlock.lxx
deleted file mode 100644 (file)
index f49c78a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Created on: 1995-09-05
-// Created by: Christophe MARION
-// 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.
-
-//=======================================================================
-//function : MinMax
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRAlgo_WiresBlock::MinMax () const
-{ return (Standard_Address)&myMinMax; }
index 6b1fc43..502265c 100644 (file)
@@ -37,7 +37,9 @@ public:
   : myRg1Line (false),
     myRgNLine (false),
     myOutLine (false),
-    myIntLine (false) {}
+    myIntLine (false)
+  {
+  }
 
   HLRBRep_BiPnt2D(const Standard_Real x1, const Standard_Real y1, const Standard_Real x2, const Standard_Real y2, const TopoDS_Shape& S, const Standard_Boolean reg1, const Standard_Boolean regn, const Standard_Boolean outl, const Standard_Boolean intl)
   : myP1(x1,y1),
@@ -46,7 +48,27 @@ public:
     myRg1Line (reg1),
     myRgNLine (regn),
     myOutLine (outl),
-    myIntLine (intl) {}
+    myIntLine (intl)
+  {
+  }
+
+  HLRBRep_BiPnt2D(
+      const gp_XY& thePoint1,
+      const gp_XY& thePoint2,
+      const TopoDS_Shape& S,
+      const Standard_Boolean reg1,
+      const Standard_Boolean regn,
+      const Standard_Boolean outl,
+      const Standard_Boolean intl) :
+    myP1(thePoint1),
+    myP2(thePoint2),
+    myShape(S),
+    myRg1Line (reg1),
+    myRgNLine (regn),
+    myOutLine (outl),
+    myIntLine (intl)
+  {
+  }
 
   const gp_Pnt2d& P1() const { return myP1; }
 
index 422d681..f2d2725 100644 (file)
@@ -21,7 +21,6 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Standard_Address.hxx>
 #include <Standard_Real.hxx>
 #include <Standard_Integer.hxx>
 #include <gp_Pnt2d.hxx>
@@ -37,6 +36,7 @@ class gp_Vec2d;
 class gp_Pnt2d;
 class gp_Dir2d;
 class HLRBRep_CLPropsATool;
+class HLRBRep_Curve;
 
 
 
@@ -56,12 +56,12 @@ public:
   //! only the tangent, N should be equal to 1.
   //! <Resolution> is the linear tolerance (it is used to test
   //! if a vector is null).
-  Standard_EXPORT HLRBRep_CLProps(const Standard_Address& C, const Standard_Integer N, const Standard_Real Resolution);
+  Standard_EXPORT HLRBRep_CLProps(const HLRBRep_Curve*& C, const Standard_Integer N, const Standard_Real Resolution);
   
   //! Same as previous constructor but here the parameter is
   //! set to the value <U>.
   //! All the computations done will be related to <C> and <U>.
-  Standard_EXPORT HLRBRep_CLProps(const Standard_Address& C, const Standard_Real U, const Standard_Integer N, const Standard_Real Resolution);
+  Standard_EXPORT HLRBRep_CLProps(const HLRBRep_Curve*& C, const Standard_Real U, const Standard_Integer N, const Standard_Real Resolution);
   
   //! Same as previous constructor but here the parameter is
   //! set to the value <U> and the curve is set
@@ -77,7 +77,7 @@ public:
   
   //! Initializes the local properties of the curve
   //! for the new curve.
-  Standard_EXPORT void SetCurve (const Standard_Address& C);
+  Standard_EXPORT void SetCurve (const HLRBRep_Curve*& C);
   
   //! Returns the Point.
   Standard_EXPORT const gp_Pnt2d& Value() const;
@@ -124,7 +124,7 @@ private:
 
 
 
-  Standard_Address myCurve;
+  const HLRBRep_Curve* myCurve;
   Standard_Real myU;
   Standard_Integer myDerOrder;
   Standard_Real myCN;
index aec759b..979eb71 100644 (file)
@@ -21,7 +21,6 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Standard_Address.hxx>
 #include <Standard_Real.hxx>
 #include <Standard_Integer.hxx>
 class gp_Pnt2d;
@@ -38,35 +37,35 @@ public:
   
   //! Computes the  point <P> of  parameter <U>   on the
   //! Curve from HLRBRep <C>.
-    static void Value (const Standard_Address A, const Standard_Real U, gp_Pnt2d& P);
+    static void Value (const HLRBRep_Curve* A, const Standard_Real U, gp_Pnt2d& P);
   
   //! Computes the point <P>  and  first derivative <V1>
   //! of parameter <U> on the curve <C>.
-    static void D1 (const Standard_Address A, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1);
+    static void D1 (const HLRBRep_Curve* A, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1);
   
   //! Computes the point <P>,  the first derivative <V1>
   //! and second derivative <V2> of parameter <U> on the
   //! curve <C>.
-    static void D2 (const Standard_Address A, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
+    static void D2 (const HLRBRep_Curve* A, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
   
   //! Computes the point <P>, the first derivative <V1>,
   //! the second derivative  <V2>   and third derivative
   //! <V3> of parameter <U> on the curve <C>.
-    static void D3 (const Standard_Address A, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
+    static void D3 (const HLRBRep_Curve* A, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
   
   //! returns the order  of continuity of the curve <C>.
   //! returns 1 :  first  derivative only is  computable
   //! returns 2  : first and  second derivative only are
   //! computable.  returns  3 : first,  second and third
   //! are computable.
-    static Standard_Integer Continuity (const Standard_Address A);
+    static Standard_Integer Continuity (const HLRBRep_Curve* A);
   
   //! returns the first parameter bound of the curve.
-    static Standard_Real FirstParameter (const Standard_Address A);
+    static Standard_Real FirstParameter (const HLRBRep_Curve* A);
   
   //! returns the  last  parameter bound  of  the curve.
   //! FirstParameter must be less than LastParamenter.
-    static Standard_Real LastParameter (const Standard_Address A);
+    static Standard_Real LastParameter (const HLRBRep_Curve* A);
 
 
 
index cdd556c..a443906 100644 (file)
 //=======================================================================
 
 inline void  HLRBRep_CLPropsATool::Value
-  (const Standard_Address A, 
+  (const HLRBRep_Curve* A, 
    const Standard_Real U,
    gp_Pnt2d& P)
-{ P = ((HLRBRep_Curve*)A)->Value(U); }
+{ P = A->Value(U); }
 
 //=======================================================================
 //function : D1
@@ -35,11 +35,11 @@ inline void  HLRBRep_CLPropsATool::Value
 //=======================================================================
 
 inline void  HLRBRep_CLPropsATool::D1
-  (const Standard_Address A, 
+  (const HLRBRep_Curve* A, 
    const Standard_Real U,
    gp_Pnt2d& P,
    gp_Vec2d& V1)
-{ ((HLRBRep_Curve*)A)->D1(U,P,V1); }
+{ A->D1(U,P,V1); }
 
 //=======================================================================
 //function : D2
@@ -47,12 +47,12 @@ inline void  HLRBRep_CLPropsATool::D1
 //=======================================================================
 
 inline void  HLRBRep_CLPropsATool::D2
-  (const Standard_Address A, 
+  (const HLRBRep_Curve* A, 
    const Standard_Real U,
    gp_Pnt2d& P,
    gp_Vec2d& V1,
    gp_Vec2d& V2)
-{ ((HLRBRep_Curve*)A)->D2(U, P, V1, V2); }
+{ A->D2(U, P, V1, V2); }
 
 //=======================================================================
 //function : D3
@@ -60,13 +60,13 @@ inline void  HLRBRep_CLPropsATool::D2
 //=======================================================================
 
 inline void  HLRBRep_CLPropsATool::D3
-  (const Standard_Address A, 
+  (const HLRBRep_Curve* A, 
    const Standard_Real U,
    gp_Pnt2d& P,
    gp_Vec2d& V1,
    gp_Vec2d& V2,
    gp_Vec2d& V3)
-{ ((HLRBRep_Curve*)A)->D3(U, P, V1, V2, V3); }
+{ A->D3(U, P, V1, V2, V3); }
 
 //=======================================================================
 //function : Continuity
@@ -74,7 +74,7 @@ inline void  HLRBRep_CLPropsATool::D3
 //=======================================================================
 
 inline Standard_Integer  HLRBRep_CLPropsATool::Continuity
-  (const Standard_Address)
+  (const HLRBRep_Curve*)
 { return GeomAbs_C2; }
 
 //=======================================================================
@@ -83,8 +83,8 @@ inline Standard_Integer  HLRBRep_CLPropsATool::Continuity
 //=======================================================================
 
 inline Standard_Real  HLRBRep_CLPropsATool::FirstParameter
-  (const Standard_Address A)
-{ return ((HLRBRep_Curve*)A)->FirstParameter(); }
+  (const HLRBRep_Curve* A)
+{ return A->FirstParameter(); }
 
 //=======================================================================
 //function : LastParameter
@@ -92,5 +92,5 @@ inline Standard_Real  HLRBRep_CLPropsATool::FirstParameter
 //=======================================================================
 
 inline Standard_Real  HLRBRep_CLPropsATool::LastParameter
-  (const Standard_Address A)
-{ return ((HLRBRep_Curve*)A)->LastParameter(); }
+  (const HLRBRep_Curve* A)
+{ return A->LastParameter(); }
index b2eb449..0e04665 100644 (file)
@@ -26,8 +26,8 @@
 #include <HLRBRep_CLPropsATool.hxx>
  
 
-#define Curve Standard_Address
-#define Curve_hxx <Standard_Address.hxx>
+#define Curve HLRBRep_Curve*
+#define Curve_hxx <HLRBRep_Curve.hxx>
 #define Vec gp_Vec2d
 #define Vec_hxx <gp_Vec2d.hxx>
 #define Pnt gp_Pnt2d
index cf23bd9..b4d827b 100644 (file)
@@ -127,8 +127,8 @@ HLRBRep_Curve::Parameter3d (const Standard_Real P2d) const
 //purpose  : 
 //=======================================================================
 
-Standard_Real  HLRBRep_Curve::Update (const Standard_Address TotMin,
-                                      const Standard_Address TotMax)
+Standard_Real HLRBRep_Curve::Update(
+  Standard_Real TotMin[16], Standard_Real TotMax[16])
 {
   GeomAbs_CurveType typ = HLRBRep_BCurveTool::GetType(myCurve);
   myType = GeomAbs_OtherCurve;
@@ -229,9 +229,8 @@ Standard_Real  HLRBRep_Curve::Update (const Standard_Address TotMin,
 //purpose  : 
 //=======================================================================
 
-Standard_Real 
-HLRBRep_Curve::UpdateMinMax (const Standard_Address TotMin,
-                            const Standard_Address TotMax)
+Standard_Real HLRBRep_Curve::UpdateMinMax(
+  Standard_Real TotMin[16], Standard_Real TotMax[16])
 {
   Standard_Real a = HLRBRep_BCurveTool::FirstParameter(myCurve);
   Standard_Real b = HLRBRep_BCurveTool::LastParameter(myCurve);
@@ -302,8 +301,8 @@ void HLRBRep_Curve::Tangent (const Standard_Boolean AtStart,
 
   D0(U,P);
   HLRBRep_CLProps CLP(2,Epsilon(1.));
-  const Standard_Address crv = (const Standard_Address)this;
-  CLP.SetCurve(crv);
+  const HLRBRep_Curve* aCurve = this;
+  CLP.SetCurve(aCurve);
   CLP.SetParameter(U);
   StdFail_UndefinedDerivative_Raise_if
     (!CLP.IsTangentDefined(), "HLRBRep_Curve::Tangent");
@@ -463,7 +462,7 @@ gp_Lin2d HLRBRep_Curve::Line () const
 gp_Circ2d HLRBRep_Curve::Circle () const
 {
   gp_Circ C = HLRBRep_BCurveTool::Circle(myCurve);
-  C.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
+  C.Transform(myProj->Transformation());
   return ProjLib::Project(gp_Pln(gp::XOY()),C);
 }
 
@@ -476,12 +475,12 @@ gp_Elips2d HLRBRep_Curve::Ellipse () const
 {
   if (HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_Ellipse) {
     gp_Elips E = HLRBRep_BCurveTool::Ellipse(myCurve);
-    E.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
+    E.Transform(myProj->Transformation());
     return ProjLib::Project(gp_Pln(gp::XOY()),E);
   }
   // this is a circle
   gp_Circ C = HLRBRep_BCurveTool::Circle(myCurve);
-  C.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
+  C.Transform(myProj->Transformation());
   const gp_Dir& D1 = C.Axis().Direction();
   const gp_Dir& D3 = D1.Crossed(gp::DZ());
   const gp_Dir& D2 = D1.Crossed(D3);
@@ -526,7 +525,7 @@ void  HLRBRep_Curve::Poles (TColgp_Array1OfPnt2d& TP) const
     (HLRBRep_BCurveTool::Bezier(myCurve))->Poles(TP3);
   }
   for (Standard_Integer i = i1; i <= i2; i++) {
-    ((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
+    myProj->Transform(TP3(i));
     TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
   }
 }
index f8fed9d..b457dfd 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <BRepAdaptor_Curve.hxx>
 #include <GeomAbs_CurveType.hxx>
-#include <Standard_Address.hxx>
 #include <Standard_Real.hxx>
 #include <gp_Pnt.hxx>
 #include <Standard_Boolean.hxx>
@@ -50,6 +49,7 @@ class gp_Elips2d;
 class gp_Hypr2d;
 class gp_Parab2d;
 class Geom_BSplineCurve;
+class HLRAlgo_Projector;
 
 
 //! Defines a 2d curve by projection of  a 3D curve on
@@ -65,7 +65,8 @@ public:
   //! Creates an undefined Curve.
   Standard_EXPORT HLRBRep_Curve();
   
-    void Projector (const Standard_Address Proj);
+    void Projector (const HLRAlgo_Projector* Proj)
+    {myProj = Proj;}
   
   //! Returns the 3D curve.
     BRepAdaptor_Curve& Curve();
@@ -85,10 +86,10 @@ public:
   Standard_EXPORT Standard_Real Parameter3d (const Standard_Real P2d) const;
   
   //! Update the minmax and the internal data
-  Standard_EXPORT Standard_Real Update (const Standard_Address TotMin, const Standard_Address TotMax);
+  Standard_EXPORT Standard_Real Update (Standard_Real TotMin[16], Standard_Real TotMax[16]);
   
   //! Update the minmax returns tol for enlarge;
-  Standard_EXPORT Standard_Real UpdateMinMax (const Standard_Address TotMin, const Standard_Address TotMax);
+  Standard_EXPORT Standard_Real UpdateMinMax (Standard_Real TotMin[16], Standard_Real TotMax[16]);
   
   //! Computes the Z    coordinate  of the  point  of
   //! parameter U on the curve in the viewing coordinate system
@@ -221,7 +222,7 @@ private:
 
   BRepAdaptor_Curve myCurve;
   GeomAbs_CurveType myType;
-  Standard_Address myProj;
+  const HLRAlgo_Projector* myProj;
   Standard_Real myOX;
   Standard_Real myOZ;
   Standard_Real myVX;
index 0fa562a..dd20e20 100644 (file)
 #include <gp_Parab2d.hxx>
 #include <HLRBRep_BCurveTool.hxx>
 
-//=======================================================================
-//function : Projector
-//purpose  : 
-//=======================================================================
-
-inline void HLRBRep_Curve::Projector(const Standard_Address Proj)
-{ myProj = Proj; }
-
 //=======================================================================
 //function : Curve
 //purpose  : 
index 1a98f52..6071d76 100644 (file)
@@ -57,114 +57,7 @@ static const Standard_Real CutBig = 1.e-1;
 
 //-- voir HLRAlgo.cxx 
 
-#define MinShap1 ((Standard_Integer*)MinMaxShap)[ 0]
-#define MinShap2 ((Standard_Integer*)MinMaxShap)[ 1]
-#define MinShap3 ((Standard_Integer*)MinMaxShap)[ 2]
-#define MinShap4 ((Standard_Integer*)MinMaxShap)[ 3]
-#define MinShap5 ((Standard_Integer*)MinMaxShap)[ 4]
-#define MinShap6 ((Standard_Integer*)MinMaxShap)[ 5]
-#define MinShap7 ((Standard_Integer*)MinMaxShap)[ 6]
-#define MinShap8 ((Standard_Integer*)MinMaxShap)[ 7]
-
-#define MaxShap1 ((Standard_Integer*)MinMaxShap)[ 8]
-#define MaxShap2 ((Standard_Integer*)MinMaxShap)[ 9]
-#define MaxShap3 ((Standard_Integer*)MinMaxShap)[10]
-#define MaxShap4 ((Standard_Integer*)MinMaxShap)[11]
-#define MaxShap5 ((Standard_Integer*)MinMaxShap)[12]
-#define MaxShap6 ((Standard_Integer*)MinMaxShap)[13]
-#define MaxShap7 ((Standard_Integer*)MinMaxShap)[14]
-#define MaxShap8 ((Standard_Integer*)MinMaxShap)[15]
-
-#define MinFace1 ((Standard_Integer*)iFaceMinMax)[ 0]
-#define MinFace2 ((Standard_Integer*)iFaceMinMax)[ 1]
-#define MinFace3 ((Standard_Integer*)iFaceMinMax)[ 2]
-#define MinFace4 ((Standard_Integer*)iFaceMinMax)[ 3]
-#define MinFace5 ((Standard_Integer*)iFaceMinMax)[ 4]
-#define MinFace6 ((Standard_Integer*)iFaceMinMax)[ 5]
-#define MinFace7 ((Standard_Integer*)iFaceMinMax)[ 6]
-#define MinFace8 ((Standard_Integer*)iFaceMinMax)[ 7]
-
-#define MaxFace1 ((Standard_Integer*)iFaceMinMax)[ 8]
-#define MaxFace2 ((Standard_Integer*)iFaceMinMax)[ 9]
-#define MaxFace3 ((Standard_Integer*)iFaceMinMax)[10]
-#define MaxFace4 ((Standard_Integer*)iFaceMinMax)[11]
-#define MaxFace5 ((Standard_Integer*)iFaceMinMax)[12]
-#define MaxFace6 ((Standard_Integer*)iFaceMinMax)[13]
-#define MaxFace7 ((Standard_Integer*)iFaceMinMax)[14]
-#define MaxFace8 ((Standard_Integer*)iFaceMinMax)[15]
-
-#define MinWire1 ((Standard_Integer*)MinMaxWire)[ 0]
-#define MinWire2 ((Standard_Integer*)MinMaxWire)[ 1]
-#define MinWire3 ((Standard_Integer*)MinMaxWire)[ 2]
-#define MinWire4 ((Standard_Integer*)MinMaxWire)[ 3]
-#define MinWire5 ((Standard_Integer*)MinMaxWire)[ 4]
-#define MinWire6 ((Standard_Integer*)MinMaxWire)[ 5]
-#define MinWire7 ((Standard_Integer*)MinMaxWire)[ 6]
-#define MinWire8 ((Standard_Integer*)MinMaxWire)[ 7]
-
-#define MaxWire1 ((Standard_Integer*)MinMaxWire)[ 8]
-#define MaxWire2 ((Standard_Integer*)MinMaxWire)[ 9]
-#define MaxWire3 ((Standard_Integer*)MinMaxWire)[10]
-#define MaxWire4 ((Standard_Integer*)MinMaxWire)[11]
-#define MaxWire5 ((Standard_Integer*)MinMaxWire)[12]
-#define MaxWire6 ((Standard_Integer*)MinMaxWire)[13]
-#define MaxWire7 ((Standard_Integer*)MinMaxWire)[14]
-#define MaxWire8 ((Standard_Integer*)MinMaxWire)[15]
-
-#define MinLEdg1 ((Standard_Integer*)myLEMinMax)[ 0]
-#define MinLEdg2 ((Standard_Integer*)myLEMinMax)[ 1]
-#define MinLEdg3 ((Standard_Integer*)myLEMinMax)[ 2]
-#define MinLEdg4 ((Standard_Integer*)myLEMinMax)[ 3]
-#define MinLEdg5 ((Standard_Integer*)myLEMinMax)[ 4]
-#define MinLEdg6 ((Standard_Integer*)myLEMinMax)[ 5]
-#define MinLEdg7 ((Standard_Integer*)myLEMinMax)[ 6]
-#define MinLEdg8 ((Standard_Integer*)myLEMinMax)[ 7]
-
-#define MaxLEdg1 ((Standard_Integer*)myLEMinMax)[ 8]
-#define MaxLEdg2 ((Standard_Integer*)myLEMinMax)[ 9]
-#define MaxLEdg3 ((Standard_Integer*)myLEMinMax)[10]
-#define MaxLEdg4 ((Standard_Integer*)myLEMinMax)[11]
-#define MaxLEdg5 ((Standard_Integer*)myLEMinMax)[12]
-#define MaxLEdg6 ((Standard_Integer*)myLEMinMax)[13]
-#define MaxLEdg7 ((Standard_Integer*)myLEMinMax)[14]
-#define MaxLEdg8 ((Standard_Integer*)myLEMinMax)[15]
-
-#define MinFEdg1 ((Standard_Integer*)MinMaxFEdg)[ 0]
-#define MinFEdg2 ((Standard_Integer*)MinMaxFEdg)[ 1]
-#define MinFEdg3 ((Standard_Integer*)MinMaxFEdg)[ 2]
-#define MinFEdg4 ((Standard_Integer*)MinMaxFEdg)[ 3]
-#define MinFEdg5 ((Standard_Integer*)MinMaxFEdg)[ 4]
-#define MinFEdg6 ((Standard_Integer*)MinMaxFEdg)[ 5]
-#define MinFEdg7 ((Standard_Integer*)MinMaxFEdg)[ 6]
-#define MinFEdg8 ((Standard_Integer*)MinMaxFEdg)[ 7]
-
-#define MaxFEdg1 ((Standard_Integer*)MinMaxFEdg)[ 8]
-#define MaxFEdg2 ((Standard_Integer*)MinMaxFEdg)[ 9]
-#define MaxFEdg3 ((Standard_Integer*)MinMaxFEdg)[10]
-#define MaxFEdg4 ((Standard_Integer*)MinMaxFEdg)[11]
-#define MaxFEdg5 ((Standard_Integer*)MinMaxFEdg)[12]
-#define MaxFEdg6 ((Standard_Integer*)MinMaxFEdg)[13]
-#define MaxFEdg7 ((Standard_Integer*)MinMaxFEdg)[14]
-#define MaxFEdg8 ((Standard_Integer*)MinMaxFEdg)[15]
-
-#define MinVert1 MinMaxVert[ 0]
-#define MinVert2 MinMaxVert[ 1]
-#define MinVert3 MinMaxVert[ 2]
-#define MinVert4 MinMaxVert[ 3]
-#define MinVert5 MinMaxVert[ 4]
-#define MinVert6 MinMaxVert[ 5]
-#define MinVert7 MinMaxVert[ 6]
-#define MinVert8 MinMaxVert[ 7]
-#define MaxVert1 MinMaxVert[ 8]
-#define MaxVert2 MinMaxVert[ 9]
-#define MaxVert3 MinMaxVert[10]
-#define MaxVert4 MinMaxVert[11]
-#define MaxVert5 MinMaxVert[12]
-#define MaxVert6 MinMaxVert[13]
-#define MaxVert7 MinMaxVert[14]
-#define MaxVert8 MinMaxVert[15]
-
-#define DERIVEE_PREMIERE_NULLE  0.000000000001
+static const Standard_Real DERIVEE_PREMIERE_NULLE = 0.000000000001;
 
 //-- ======================================================================
 //--  
@@ -181,7 +74,7 @@ static long unsigned Mask32[32] = { 1,2,4,8,  16,32,64,128,  256,512,1024,2048,
                                 16777216,33554432,67108864,134217728,
                                 268435456,536870912,1073741824,2147483648U};
 
-#define SIZEUV 8
+static const Standard_Integer SIZEUV = 8;
 
 class TableauRejection { 
 public:
@@ -520,7 +413,7 @@ HLRBRep_Data::HLRBRep_Data (const Standard_Integer NV,
                            mySLProps(2,Epsilon(1.)),
                            myHideCount(0)
 {
-  myReject=(void *)(new TableauRejection());
+  myReject = new TableauRejection();
   ((TableauRejection *)myReject)->SetDim(myNbEdges);
 }
 
@@ -601,13 +494,13 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P)
   Standard_Integer i;
   Standard_Real tolMinMax = 0;
 
-  Standard_Integer FaceMin[16],FaceMax[16],MinMaxFace[16];
-  Standard_Integer WireMin[16],WireMax[16],MinMaxWire[16];
-  Standard_Integer EdgeMin[16],EdgeMax[16],MinMaxEdge[16];
+  HLRAlgo_EdgesBlock::MinMaxIndices FaceMin, FaceMax;
+  HLRAlgo_EdgesBlock::MinMaxIndices MinMaxFace;
+  HLRAlgo_EdgesBlock::MinMaxIndices WireMin, WireMax, MinMaxWire;
+  HLRAlgo_EdgesBlock::MinMaxIndices EdgeMin, EdgeMax;
+  HLRAlgo_EdgesBlock::MinMaxIndices MinMaxEdge;
   Standard_Real TotMin[16],TotMax[16];
-  HLRAlgo::InitMinMax(Precision::Infinite(),
-                     (Standard_Address)TotMin,
-                     (Standard_Address)TotMax);
+  HLRAlgo::InitMinMax(Precision::Infinite(), TotMin, TotMax);
 
   // compute the global MinMax
   // *************************
@@ -617,13 +510,10 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P)
     HLRBRep_EdgeData& ed = myEData.ChangeValue(edge);
     HLRBRep_Curve& EC = ed.ChangeGeometry();
     EC.Projector(&myProj);
-    Standard_Real enl =EC.Update((Standard_Address)TotMin,
-                                (Standard_Address)TotMax);
+    Standard_Real enl =EC.Update(TotMin, TotMax);
     if (enl > tolMinMax) tolMinMax = enl;
   }
-  HLRAlgo::EnlargeMinMax(tolMinMax,
-                        (Standard_Address)TotMin,
-                        (Standard_Address)TotMax);
+  HLRAlgo::EnlargeMinMax(tolMinMax, TotMin, TotMax);
   Standard_Real d[16];
   Standard_Real precad = -Precision::Infinite();
 
@@ -651,11 +541,8 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P)
 
     HLRBRep_EdgeData& ed = myEData.ChangeValue(edge);
     HLRBRep_Curve& EC = ed.ChangeGeometry();
-    HLRAlgo::InitMinMax(Precision::Infinite(),
-                       (Standard_Address)TotMin,
-                       (Standard_Address)TotMax);
-    tolMinMax = EC.UpdateMinMax((Standard_Address)TotMin,
-                               (Standard_Address)TotMax);
+    HLRAlgo::InitMinMax(Precision::Infinite(), TotMin, TotMax);
+    tolMinMax = EC.UpdateMinMax(TotMin, TotMax);
     tol = (Standard_Real)(ed.Tolerance());
     ed.Vertical(TotMax[0] - TotMin[0] < tol &&
                 TotMax[1] - TotMin[1] < tol &&
@@ -664,47 +551,43 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P)
                 TotMax[4] - TotMin[4] < tol &&
                 TotMax[5] - TotMin[5] < tol &&
                 TotMax[6] - TotMin[6] < tol );
-    HLRAlgo::EnlargeMinMax(tolMinMax,
-                          (Standard_Address)TotMin,
-                          (Standard_Address)TotMax);
+    HLRAlgo::EnlargeMinMax(tolMinMax, TotMin, TotMax);
 // Linux warning :  assignment to `int' from `double'. Cast has been added.
-    EdgeMin[ 0] = (Standard_Integer)( (myDeca[ 0] + TotMin[ 0]) * mySurD[ 0]);
-    EdgeMax[ 0] = (Standard_Integer)( (myDeca[ 0] + TotMax[ 0]) * mySurD[ 0]);
-    EdgeMin[ 1] = (Standard_Integer)( (myDeca[ 1] + TotMin[ 1]) * mySurD[ 1]);
-    EdgeMax[ 1] = (Standard_Integer)( (myDeca[ 1] + TotMax[ 1]) * mySurD[ 1]);
-    EdgeMin[ 2] = (Standard_Integer)( (myDeca[ 2] + TotMin[ 2]) * mySurD[ 2]);
-    EdgeMax[ 2] = (Standard_Integer)( (myDeca[ 2] + TotMax[ 2]) * mySurD[ 2]);
-    EdgeMin[ 3] = (Standard_Integer)( (myDeca[ 3] + TotMin[ 3]) * mySurD[ 3]);
-    EdgeMax[ 3] = (Standard_Integer)( (myDeca[ 3] + TotMax[ 3]) * mySurD[ 3]);
-    EdgeMin[ 4] = (Standard_Integer)( (myDeca[ 4] + TotMin[ 4]) * mySurD[ 4]);
-    EdgeMax[ 4] = (Standard_Integer)( (myDeca[ 4] + TotMax[ 4]) * mySurD[ 4]);
-    EdgeMin[ 5] = (Standard_Integer)( (myDeca[ 5] + TotMin[ 5]) * mySurD[ 5]);
-    EdgeMax[ 5] = (Standard_Integer)( (myDeca[ 5] + TotMax[ 5]) * mySurD[ 5]);
-    EdgeMin[ 6] = (Standard_Integer)( (myDeca[ 6] + TotMin[ 6]) * mySurD[ 6]);
-    EdgeMax[ 6] = (Standard_Integer)( (myDeca[ 6] + TotMax[ 6]) * mySurD[ 6]);
-    EdgeMin[ 7] = (Standard_Integer)( (myDeca[ 7] + TotMin[ 7]) * mySurD[ 7]);
-    EdgeMax[ 7] = (Standard_Integer)( (myDeca[ 7] + TotMax[ 7]) * mySurD[ 7]);
-    EdgeMin[ 8] = (Standard_Integer)( (myDeca[ 8] + TotMin[ 8]) * mySurD[ 8]);
-    EdgeMax[ 8] = (Standard_Integer)( (myDeca[ 8] + TotMax[ 8]) * mySurD[ 8]);
-    EdgeMin[ 9] = (Standard_Integer)( (myDeca[ 9] + TotMin[ 9]) * mySurD[ 9]);
-    EdgeMax[ 9] = (Standard_Integer)( (myDeca[ 9] + TotMax[ 9]) * mySurD[ 9]);
-    EdgeMin[10] = (Standard_Integer)( (myDeca[10] + TotMin[10]) * mySurD[10]);
-    EdgeMax[10] = (Standard_Integer)( (myDeca[10] + TotMax[10]) * mySurD[10]);
-    EdgeMin[11] = (Standard_Integer)( (myDeca[11] + TotMin[11]) * mySurD[11]);
-    EdgeMax[11] = (Standard_Integer)( (myDeca[11] + TotMax[11]) * mySurD[11]);
-    EdgeMin[12] = (Standard_Integer)( (myDeca[12] + TotMin[12]) * mySurD[12]);
-    EdgeMax[12] = (Standard_Integer)( (myDeca[12] + TotMax[12]) * mySurD[12]);
-    EdgeMin[13] = (Standard_Integer)( (myDeca[13] + TotMin[13]) * mySurD[13]);
-    EdgeMax[13] = (Standard_Integer)( (myDeca[13] + TotMax[13]) * mySurD[13]);
-    EdgeMin[14] = (Standard_Integer)( (myDeca[14] + TotMin[14]) * mySurD[14]);
-    EdgeMax[14] = (Standard_Integer)( (myDeca[14] + TotMax[14]) * mySurD[14]);
-    EdgeMin[15] = (Standard_Integer)( (myDeca[15] + TotMin[15]) * mySurD[15]);
-    EdgeMax[15] = (Standard_Integer)( (myDeca[15] + TotMax[15]) * mySurD[15]);
-
-    HLRAlgo::EncodeMinMax((Standard_Address)EdgeMin,
-                         (Standard_Address)EdgeMax,
-                         (Standard_Address)MinMaxEdge);
-    ed.UpdateMinMax((Standard_Address)MinMaxEdge);
+    EdgeMin.Min[0] = (Standard_Integer)( (myDeca[ 0] + TotMin[ 0]) * mySurD[ 0]);
+    EdgeMax.Min[0] = (Standard_Integer)( (myDeca[ 0] + TotMax[ 0]) * mySurD[ 0]);
+    EdgeMin.Min[1] = (Standard_Integer)( (myDeca[ 1] + TotMin[ 1]) * mySurD[ 1]);
+    EdgeMax.Min[1] = (Standard_Integer)( (myDeca[ 1] + TotMax[ 1]) * mySurD[ 1]);
+    EdgeMin.Min[2] = (Standard_Integer)( (myDeca[ 2] + TotMin[ 2]) * mySurD[ 2]);
+    EdgeMax.Min[2] = (Standard_Integer)( (myDeca[ 2] + TotMax[ 2]) * mySurD[ 2]);
+    EdgeMin.Min[3] = (Standard_Integer)( (myDeca[ 3] + TotMin[ 3]) * mySurD[ 3]);
+    EdgeMax.Min[3] = (Standard_Integer)( (myDeca[ 3] + TotMax[ 3]) * mySurD[ 3]);
+    EdgeMin.Min[4] = (Standard_Integer)( (myDeca[ 4] + TotMin[ 4]) * mySurD[ 4]);
+    EdgeMax.Min[4] = (Standard_Integer)( (myDeca[ 4] + TotMax[ 4]) * mySurD[ 4]);
+    EdgeMin.Min[5] = (Standard_Integer)( (myDeca[ 5] + TotMin[ 5]) * mySurD[ 5]);
+    EdgeMax.Min[5] = (Standard_Integer)( (myDeca[ 5] + TotMax[ 5]) * mySurD[ 5]);
+    EdgeMin.Min[6] = (Standard_Integer)( (myDeca[ 6] + TotMin[ 6]) * mySurD[ 6]);
+    EdgeMax.Min[6] = (Standard_Integer)( (myDeca[ 6] + TotMax[ 6]) * mySurD[ 6]);
+    EdgeMin.Min[7] = (Standard_Integer)( (myDeca[ 7] + TotMin[ 7]) * mySurD[ 7]);
+    EdgeMax.Min[7] = (Standard_Integer)( (myDeca[ 7] + TotMax[ 7]) * mySurD[ 7]);
+    EdgeMin.Max[0] = (Standard_Integer)( (myDeca[ 8] + TotMin[ 8]) * mySurD[ 8]);
+    EdgeMax.Max[0] = (Standard_Integer)( (myDeca[ 8] + TotMax[ 8]) * mySurD[ 8]);
+    EdgeMin.Max[1] = (Standard_Integer)( (myDeca[ 9] + TotMin[ 9]) * mySurD[ 9]);
+    EdgeMax.Max[1] = (Standard_Integer)( (myDeca[ 9] + TotMax[ 9]) * mySurD[ 9]);
+    EdgeMin.Max[2] = (Standard_Integer)( (myDeca[10] + TotMin[10]) * mySurD[10]);
+    EdgeMax.Max[2] = (Standard_Integer)( (myDeca[10] + TotMax[10]) * mySurD[10]);
+    EdgeMin.Max[3] = (Standard_Integer)( (myDeca[11] + TotMin[11]) * mySurD[11]);
+    EdgeMax.Max[3] = (Standard_Integer)( (myDeca[11] + TotMax[11]) * mySurD[11]);
+    EdgeMin.Max[4] = (Standard_Integer)( (myDeca[12] + TotMin[12]) * mySurD[12]);
+    EdgeMax.Max[4] = (Standard_Integer)( (myDeca[12] + TotMax[12]) * mySurD[12]);
+    EdgeMin.Max[5] = (Standard_Integer)( (myDeca[13] + TotMin[13]) * mySurD[13]);
+    EdgeMax.Max[5] = (Standard_Integer)( (myDeca[13] + TotMax[13]) * mySurD[13]);
+    EdgeMin.Max[6] = (Standard_Integer)( (myDeca[14] + TotMin[14]) * mySurD[14]);
+    EdgeMax.Max[6] = (Standard_Integer)( (myDeca[14] + TotMax[14]) * mySurD[14]);
+    EdgeMin.Max[7] = (Standard_Integer)( (myDeca[15] + TotMin[15]) * mySurD[15]);
+    EdgeMax.Max[7] = (Standard_Integer)( (myDeca[15] + TotMax[15]) * mySurD[15]);
+
+    HLRAlgo::EncodeMinMax(EdgeMin, EdgeMax, MinMaxEdge);
+    ed.UpdateMinMax(MinMaxEdge);
     if (ed.Vertical()) {
       ver1 = Standard_True;
       ver2 = Standard_True;
@@ -889,42 +772,24 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P)
       myFE = myFaceItr1.Edge();
       HLRBRep_EdgeData& EDataFE2 = myEData(myFE);
       if (!fd.Simple()) EDataFE2.AutoIntersectionDone(Standard_False);
-      HLRAlgo::DecodeMinMax(EDataFE2.MinMax(),
-                           (Standard_Address)EdgeMin,
-                           (Standard_Address)EdgeMax);
+      HLRAlgo::DecodeMinMax(EDataFE2.MinMax(), EdgeMin, EdgeMax);
       if (myFaceItr1.BeginningOfWire())
-       HLRAlgo::CopyMinMax((Standard_Address)EdgeMin,
-                           (Standard_Address)EdgeMax,
-                           (Standard_Address)WireMin,
-                           (Standard_Address)WireMax);
+       HLRAlgo::CopyMinMax(EdgeMin, EdgeMax, WireMin, WireMax);
       else
-       HLRAlgo::AddMinMax((Standard_Address)EdgeMin,
-                          (Standard_Address)EdgeMax,
-                          (Standard_Address)WireMin,
-                          (Standard_Address)WireMax);
+       HLRAlgo::AddMinMax(EdgeMin, EdgeMax, WireMin, WireMax);
       if (myFaceItr1.EndOfWire()) {
-       HLRAlgo::EncodeMinMax((Standard_Address)WireMin,
-                             (Standard_Address)WireMax,
-                             (Standard_Address)MinMaxWire);
-       myFaceItr1.Wire()->UpdateMinMax((Standard_Address)MinMaxWire);
+       HLRAlgo::EncodeMinMax(WireMin, WireMax, MinMaxWire);
+       myFaceItr1.Wire()->UpdateMinMax(MinMaxWire);
        if (FirstTime) {
          FirstTime = Standard_False;
-         HLRAlgo::CopyMinMax((Standard_Address)WireMin,
-                             (Standard_Address)WireMax,
-                             (Standard_Address)FaceMin,
-                             (Standard_Address)FaceMax);
+         HLRAlgo::CopyMinMax(WireMin, WireMax, FaceMin, FaceMax);
        }
        else
-         HLRAlgo::AddMinMax((Standard_Address)WireMin,
-                            (Standard_Address)WireMax,
-                            (Standard_Address)FaceMin,
-                            (Standard_Address)FaceMax);
+         HLRAlgo::AddMinMax(WireMin, WireMax, FaceMin, FaceMax);
       }
     }
-    HLRAlgo::EncodeMinMax((Standard_Address)FaceMin,
-                         (Standard_Address)FaceMax,
-                         (Standard_Address)MinMaxFace);
-    fd.Wires()->UpdateMinMax((Standard_Address)MinMaxFace);  
+    HLRAlgo::EncodeMinMax(FaceMin, FaceMax, MinMaxFace);
+    fd.Wires()->UpdateMinMax(MinMaxFace);  
     fd.Size(HLRAlgo::SizeBox(FaceMin,FaceMax));
   }
 }
@@ -935,32 +800,32 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P)
 //=======================================================================
 
 void 
-HLRBRep_Data::InitBoundSort (const Standard_Address MinMaxTot,
+HLRBRep_Data::InitBoundSort (const HLRAlgo_EdgesBlock::MinMaxIndices& MinMaxTot,
                             const Standard_Integer e1,
                             const Standard_Integer e2)
 {
   myNbrSortEd = 0;
-  Standard_Address MinMaxShap = MinMaxTot;
+  const HLRAlgo_EdgesBlock::MinMaxIndices& MinMaxShap = MinMaxTot;
 
   for (Standard_Integer e = e1; e <= e2; e++) {
     HLRBRep_EdgeData& ed = myEData(e);
     if (!ed.Status().AllHidden()) {
-      myLEMinMax = ed.MinMax();
-      if (((MaxShap1 - MinLEdg1) & 0x80008000) == 0 &&
-         ((MaxLEdg1 - MinShap1) & 0x80008000) == 0 &&
-         ((MaxShap2 - MinLEdg2) & 0x80008000) == 0 &&
-         ((MaxLEdg2 - MinShap2) & 0x80008000) == 0 &&
-         ((MaxShap3 - MinLEdg3) & 0x80008000) == 0 &&
-         ((MaxLEdg3 - MinShap3) & 0x80008000) == 0 &&
-         ((MaxShap4 - MinLEdg4) & 0x80008000) == 0 &&
-         ((MaxLEdg4 - MinShap4) & 0x80008000) == 0 &&
-         ((MaxShap5 - MinLEdg5) & 0x80008000) == 0 &&
-         ((MaxLEdg5 - MinShap5) & 0x80008000) == 0 &&
-         ((MaxShap6 - MinLEdg6) & 0x80008000) == 0 &&
-         ((MaxLEdg6 - MinShap6) & 0x80008000) == 0 &&
-         ((MaxShap7 - MinLEdg7) & 0x80008000) == 0 &&
-         ((MaxLEdg7 - MinShap7) & 0x80008000) == 0 &&
-         ((MaxShap8 - MinLEdg8) & 0x80008000) == 0) {  //- rejection en z 
+      myLEMinMax = &ed.MinMax();
+      if (((MinMaxShap.Max[0] - myLEMinMax->Min[0]) & 0x80008000) == 0 &&
+         ((myLEMinMax->Max[0] - MinMaxShap.Min[0]) & 0x80008000) == 0 &&
+         ((MinMaxShap.Max[1] - myLEMinMax->Min[1]) & 0x80008000) == 0 &&
+         ((myLEMinMax->Max[1] - MinMaxShap.Min[1]) & 0x80008000) == 0 &&
+         ((MinMaxShap.Max[2] - myLEMinMax->Min[2]) & 0x80008000) == 0 &&
+         ((myLEMinMax->Max[2] - MinMaxShap.Min[2]) & 0x80008000) == 0 &&
+         ((MinMaxShap.Max[3] - myLEMinMax->Min[3]) & 0x80008000) == 0 &&
+         ((myLEMinMax->Max[3] - MinMaxShap.Min[3]) & 0x80008000) == 0 &&
+         ((MinMaxShap.Max[4] - myLEMinMax->Min[4]) & 0x80008000) == 0 &&
+         ((myLEMinMax->Max[4] - MinMaxShap.Min[4]) & 0x80008000) == 0 &&
+         ((MinMaxShap.Max[5] - myLEMinMax->Min[5]) & 0x80008000) == 0 &&
+         ((myLEMinMax->Max[5] - MinMaxShap.Min[5]) & 0x80008000) == 0 &&
+         ((MinMaxShap.Max[6] - myLEMinMax->Min[6]) & 0x80008000) == 0 &&
+         ((myLEMinMax->Max[6] - MinMaxShap.Min[6]) & 0x80008000) == 0 &&
+         ((MinMaxShap.Max[7] - myLEMinMax->Min[7]) & 0x80008000) == 0) {  //- rejection en z 
        myNbrSortEd++;
        myEdgeIndices(myNbrSortEd) = e;
       }
@@ -980,10 +845,10 @@ void HLRBRep_Data::InitEdge (const Standard_Integer FI,
 
   iFace       = FI;
   iFaceData   = &myFData(iFace);
-  iFaceGeom   = &(((HLRBRep_FaceData*)iFaceData)->Geometry());
-  iFaceBack   =   ((HLRBRep_FaceData*)iFaceData)->Back();
-  iFaceSimp   =   ((HLRBRep_FaceData*)iFaceData)->Simple();
-  iFaceMinMax =   ((HLRBRep_FaceData*)iFaceData)->Wires()->MinMax();
+  iFaceGeom   = &iFaceData->Geometry();
+  iFaceBack   = iFaceData->Back();
+  iFaceSimp   = iFaceData->Simple();
+  iFaceMinMax = &iFaceData->Wires()->MinMax();
   iFaceType   =   ((HLRBRep_Surface*)iFaceGeom)->GetType();
   iFaceTest   = !iFaceSimp;
   mySLProps.SetSurface(iFaceGeom);
@@ -1010,12 +875,12 @@ void HLRBRep_Data::InitEdge (const Standard_Integer FI,
   }
   
   if (iFaceTest) {
-    iFaceSmpl = !((HLRBRep_FaceData*)iFaceData)->Cut();
-    myFaceItr2.InitEdge(*((HLRBRep_FaceData*)iFaceData));
+    iFaceSmpl = !iFaceData->Cut();
+    myFaceItr2.InitEdge(*iFaceData);
   }
   else {
 
-    for (myFaceItr1.InitEdge(*((HLRBRep_FaceData*)iFaceData));
+    for (myFaceItr1.InitEdge(*iFaceData);
         myFaceItr1.MoreEdge();
         myFaceItr1.NextEdge()) {
       myFE = myFaceItr1.Edge();               // edges of a simple hiding
@@ -1043,18 +908,18 @@ Standard_Boolean HLRBRep_Data::MoreEdge ()
       myLEDouble   = myFaceItr2.Double  ();
       myLEIsoLine  = myFaceItr2.IsoLine ();
       myLEData     = &myEData(myLE);
-      myLEGeom     = &(((HLRBRep_EdgeData*)myLEData)->ChangeGeometry());
-      myLEMinMax   =   ((HLRBRep_EdgeData*)myLEData)->MinMax();
-      myLETol      =   ((HLRBRep_EdgeData*)myLEData)->Tolerance();
-      myLEType     =   ((HLRBRep_Curve   *)myLEGeom)->GetType();
+      myLEGeom     = &myLEData->ChangeGeometry();
+      myLEMinMax   = &myLEData->MinMax();
+      myLETol      = myLEData->Tolerance();
+      myLEType     = myLEGeom->GetType();
       if (!myLEDouble)
-       ((HLRBRep_EdgeData*)myLEData)->HideCount(myHideCount-1);
+        myLEData->HideCount(myHideCount-1);
       return Standard_True;
     }
     else {
       iFaceTest = Standard_False;      // at the end of the test
       iFaceSimp = iFaceSmpl;           // we know if it is a simple face
-      ((HLRBRep_FaceData*)iFaceData)->Simple(iFaceSimp);
+      iFaceData->Simple(iFaceSimp);
       myCurSortEd = 1;
       NextEdge(Standard_False);
     }
@@ -1081,10 +946,10 @@ void HLRBRep_Data::NextEdge (const Standard_Boolean skip)
     myLEDouble   = myFaceItr2.Double  ();
     myLEIsoLine  = myFaceItr2.IsoLine ();
     myLEData     = &myEData(myLE);
-    myLEGeom     = &(((HLRBRep_EdgeData*)myLEData)->ChangeGeometry());
-    myLEMinMax   =   ((HLRBRep_EdgeData*)myLEData)->MinMax();
-    myLETol      =   ((HLRBRep_EdgeData*)myLEData)->Tolerance();
-    myLEType     =   ((HLRBRep_Curve   *)myLEGeom)->GetType();
+    myLEGeom     = &myLEData->ChangeGeometry();
+    myLEMinMax   = &myLEData->MinMax();
+    myLETol      = myLEData->Tolerance();
+    myLEType     = myLEGeom->GetType();
     if (((HLRBRep_EdgeData*)myLEData)->Vertical() ||
        (myLEDouble &&
         ((HLRBRep_EdgeData*)myLEData)->HideCount() == myHideCount-1))
@@ -1099,10 +964,10 @@ void HLRBRep_Data::NextEdge (const Standard_Boolean skip)
     myLEDouble   = Standard_False;
     myLEIsoLine  = Standard_False;
     myLEData     = &myEData(myLE);
-    myLEGeom     = &(((HLRBRep_EdgeData*)myLEData)->ChangeGeometry());
-    myLEMinMax   =   ((HLRBRep_EdgeData*)myLEData)->MinMax();
-    myLETol      =   ((HLRBRep_EdgeData*)myLEData)->Tolerance();
-    myLEType     =   ((HLRBRep_Curve   *)myLEGeom)->GetType();
+    myLEGeom     = &myLEData->ChangeGeometry();
+    myLEMinMax   = &myLEData->MinMax();
+    myLETol      = myLEData->Tolerance();
+    myLEType     = myLEGeom->GetType();
   }
   if (((HLRBRep_EdgeData*)myLEData)->Vertical()) {
     NextEdge();
@@ -1116,21 +981,21 @@ void HLRBRep_Data::NextEdge (const Standard_Boolean skip)
     NextEdge();
     return;
   }
-  if (((MaxFace1 - MinLEdg1) & 0x80008000) != 0 ||
-      ((MaxLEdg1 - MinFace1) & 0x80008000) != 0 ||
-      ((MaxFace2 - MinLEdg2) & 0x80008000) != 0 ||
-      ((MaxLEdg2 - MinFace2) & 0x80008000) != 0 ||
-      ((MaxFace3 - MinLEdg3) & 0x80008000) != 0 ||
-      ((MaxLEdg3 - MinFace3) & 0x80008000) != 0 ||
-      ((MaxFace4 - MinLEdg4) & 0x80008000) != 0 ||
-      ((MaxLEdg4 - MinFace4) & 0x80008000) != 0 ||
-      ((MaxFace5 - MinLEdg5) & 0x80008000) != 0 ||
-      ((MaxLEdg5 - MinFace5) & 0x80008000) != 0 ||
-      ((MaxFace6 - MinLEdg6) & 0x80008000) != 0 ||
-      ((MaxLEdg6 - MinFace6) & 0x80008000) != 0 ||
-      ((MaxFace7 - MinLEdg7) & 0x80008000) != 0 ||
-      ((MaxLEdg7 - MinFace7) & 0x80008000) != 0 ||
-      ((MaxFace8 - MinLEdg8) & 0x80008000) != 0) { //-- rejection en z 
+  if (((iFaceMinMax->Max[0] - myLEMinMax->Min[0]) & 0x80008000) != 0 ||
+      ((myLEMinMax->Max[0] - iFaceMinMax->Min[0]) & 0x80008000) != 0 ||
+      ((iFaceMinMax->Max[1] - myLEMinMax->Min[1]) & 0x80008000) != 0 ||
+      ((myLEMinMax->Max[1] - iFaceMinMax->Min[1]) & 0x80008000) != 0 ||
+      ((iFaceMinMax->Max[2] - myLEMinMax->Min[2]) & 0x80008000) != 0 ||
+      ((myLEMinMax->Max[2] - iFaceMinMax->Min[2]) & 0x80008000) != 0 ||
+      ((iFaceMinMax->Max[3] - myLEMinMax->Min[3]) & 0x80008000) != 0 ||
+      ((myLEMinMax->Max[3] - iFaceMinMax->Min[3]) & 0x80008000) != 0 ||
+      ((iFaceMinMax->Max[4] - myLEMinMax->Min[4]) & 0x80008000) != 0 ||
+      ((myLEMinMax->Max[4] - iFaceMinMax->Min[4]) & 0x80008000) != 0 ||
+      ((iFaceMinMax->Max[5] - myLEMinMax->Min[5]) & 0x80008000) != 0 ||
+      ((myLEMinMax->Max[5] - iFaceMinMax->Min[5]) & 0x80008000) != 0 ||
+      ((iFaceMinMax->Max[6] - myLEMinMax->Min[6]) & 0x80008000) != 0 ||
+      ((myLEMinMax->Max[6] - iFaceMinMax->Min[6]) & 0x80008000) != 0 ||
+      ((iFaceMinMax->Max[7] - myLEMinMax->Min[7]) & 0x80008000) != 0) { //-- rejection en z 
     NextEdge();
     return;
   }
@@ -1182,22 +1047,22 @@ void HLRBRep_Data::NextInterference ()
     
     // rejection of current wire
     if (myFaceItr1.BeginningOfWire()) {
-      Standard_Address MinMaxWire = myFaceItr1.Wire()->MinMax();
-      if (((MaxWire1 - MinLEdg1) & 0x80008000) != 0 ||
-         ((MaxLEdg1 - MinWire1) & 0x80008000) != 0 ||
-         ((MaxWire2 - MinLEdg2) & 0x80008000) != 0 ||
-         ((MaxLEdg2 - MinWire2) & 0x80008000) != 0 ||
-         ((MaxWire3 - MinLEdg3) & 0x80008000) != 0 ||
-         ((MaxLEdg3 - MinWire3) & 0x80008000) != 0 ||
-         ((MaxWire4 - MinLEdg4) & 0x80008000) != 0 ||
-         ((MaxLEdg4 - MinWire4) & 0x80008000) != 0 ||
-         ((MaxWire5 - MinLEdg5) & 0x80008000) != 0 ||
-         ((MaxLEdg5 - MinWire5) & 0x80008000) != 0 ||
-         ((MaxWire6 - MinLEdg6) & 0x80008000) != 0 ||
-         ((MaxLEdg6 - MinWire6) & 0x80008000) != 0 ||
-         ((MaxWire7 - MinLEdg7) & 0x80008000) != 0 ||
-         ((MaxLEdg7 - MinWire7) & 0x80008000) != 0 ||
-         ((MaxWire8 - MinLEdg8) & 0x80008000) != 0) { //-- Rejection en Z
+      HLRAlgo_EdgesBlock::MinMaxIndices& MinMaxWire = myFaceItr1.Wire()->MinMax();
+      if (((MinMaxWire.Max[0] - myLEMinMax->Min[0]) & 0x80008000) != 0 ||
+         ((myLEMinMax->Max[0] - MinMaxWire.Min[0]) & 0x80008000) != 0 ||
+         ((MinMaxWire.Max[1] - myLEMinMax->Min[1]) & 0x80008000) != 0 ||
+         ((myLEMinMax->Max[1] - MinMaxWire.Min[1]) & 0x80008000) != 0 ||
+         ((MinMaxWire.Max[2] - myLEMinMax->Min[2]) & 0x80008000) != 0 ||
+         ((myLEMinMax->Max[2] - MinMaxWire.Min[2]) & 0x80008000) != 0 ||
+         ((MinMaxWire.Max[3] - myLEMinMax->Min[3]) & 0x80008000) != 0 ||
+         ((myLEMinMax->Max[3] - MinMaxWire.Min[3]) & 0x80008000) != 0 ||
+         ((MinMaxWire.Max[4] - myLEMinMax->Min[4]) & 0x80008000) != 0 ||
+         ((myLEMinMax->Max[4] - MinMaxWire.Min[4]) & 0x80008000) != 0 ||
+         ((MinMaxWire.Max[5] - myLEMinMax->Min[5]) & 0x80008000) != 0 ||
+         ((myLEMinMax->Max[5] - MinMaxWire.Min[5]) & 0x80008000) != 0 ||
+         ((MinMaxWire.Max[6] - myLEMinMax->Min[6]) & 0x80008000) != 0 ||
+         ((myLEMinMax->Max[6] - MinMaxWire.Min[6]) & 0x80008000) != 0 ||
+         ((MinMaxWire.Max[7] - myLEMinMax->Min[7]) & 0x80008000) != 0) { //-- Rejection en Z
        myFaceItr1.SkipWire();
        continue;
       }
@@ -1218,7 +1083,7 @@ void HLRBRep_Data::NextInterference ()
       // Edge from the boundary
       if (!((HLRBRep_EdgeData*)myFEData)->Vertical() && !(myFEDouble && !myFEOutLine)) {
        // not a vertical edge and not a double Edge
-       Standard_Address MinMaxFEdg = ((HLRBRep_EdgeData*)myFEData)->MinMax();
+       HLRAlgo_EdgesBlock::MinMaxIndices* MinMaxFEdg = &((HLRBRep_EdgeData*)myFEData)->MinMax();
        //-- -----------------------------------------------------------------------
        //-- Max - Min doit etre positif pour toutes les directions 
        //--
@@ -1236,21 +1101,21 @@ void HLRBRep_Data::NextInterference ()
           NoIntersection(myLE,myFE) == Standard_False) { 
 
          
-         if (((MaxFEdg1 - MinLEdg1) & 0x80008000) == 0 &&
-             ((MaxLEdg1 - MinFEdg1) & 0x80008000) == 0 &&
-             ((MaxFEdg2 - MinLEdg2) & 0x80008000) == 0 &&
-             ((MaxLEdg2 - MinFEdg2) & 0x80008000) == 0 &&
-             ((MaxFEdg3 - MinLEdg3) & 0x80008000) == 0 &&
-             ((MaxLEdg3 - MinFEdg3) & 0x80008000) == 0 &&
-             ((MaxFEdg4 - MinLEdg4) & 0x80008000) == 0 &&
-             ((MaxLEdg4 - MinFEdg4) & 0x80008000) == 0 &&
-             ((MaxFEdg5 - MinLEdg5) & 0x80008000) == 0 &&
-             ((MaxLEdg5 - MinFEdg5) & 0x80008000) == 0 &&
-             ((MaxFEdg6 - MinLEdg6) & 0x80008000) == 0 &&
-             ((MaxLEdg6 - MinFEdg6) & 0x80008000) == 0 &&
-             ((MaxFEdg7 - MinLEdg7) & 0x80008000) == 0 && 
-             ((MaxLEdg7 - MinFEdg7) & 0x80008000) == 0 && 
-             ((MaxFEdg8 - MinLEdg8) & 0x80008000) == 0) {   //-- Rejection en Z
+         if (((MinMaxFEdg->Max[0] - myLEMinMax->Min[0]) & 0x80008000) == 0 &&
+             ((myLEMinMax->Max[0] - MinMaxFEdg->Min[0]) & 0x80008000) == 0 &&
+             ((MinMaxFEdg->Max[1] - myLEMinMax->Min[1]) & 0x80008000) == 0 &&
+             ((myLEMinMax->Max[1] - MinMaxFEdg->Min[1]) & 0x80008000) == 0 &&
+             ((MinMaxFEdg->Max[2] - myLEMinMax->Min[2]) & 0x80008000) == 0 &&
+             ((myLEMinMax->Max[2] - MinMaxFEdg->Min[2]) & 0x80008000) == 0 &&
+             ((MinMaxFEdg->Max[3] - myLEMinMax->Min[3]) & 0x80008000) == 0 &&
+             ((myLEMinMax->Max[3] - MinMaxFEdg->Min[3]) & 0x80008000) == 0 &&
+             ((MinMaxFEdg->Max[4] - myLEMinMax->Min[4]) & 0x80008000) == 0 &&
+             ((myLEMinMax->Max[4] - MinMaxFEdg->Min[4]) & 0x80008000) == 0 &&
+             ((MinMaxFEdg->Max[5] - myLEMinMax->Min[5]) & 0x80008000) == 0 &&
+             ((myLEMinMax->Max[5] - MinMaxFEdg->Min[5]) & 0x80008000) == 0 &&
+             ((MinMaxFEdg->Max[6] - myLEMinMax->Min[6]) & 0x80008000) == 0 && 
+             ((myLEMinMax->Max[6] - MinMaxFEdg->Min[6]) & 0x80008000) == 0 && 
+             ((MinMaxFEdg->Max[7] - myLEMinMax->Min[7]) & 0x80008000) == 0) {   //-- Rejection en Z
            // not rejected perform intersection
            Standard_Boolean rej = Standard_False;
            if (myLE == myFE) { // test if an auto-intersection is not usefull
@@ -1465,7 +1330,8 @@ void HLRBRep_Data::LocalFEGeometry2D (const Standard_Integer FE,
                                      gp_Dir2d& Nm,
                                      Standard_Real& Cu)
 {
-  myFLProps.SetCurve(&(myEData(FE).ChangeGeometry()));
+  const HLRBRep_Curve* aCurve = &myEData(FE).ChangeGeometry();
+  myFLProps.SetCurve(aCurve);
   myFLProps.SetParameter(Param);
   if (!myFLProps.IsTangentDefined())
     Standard_Failure::Raise("HLRBRep_Data::LocalGeometry2D");
@@ -1794,40 +1660,52 @@ void HLRBRep_Data::OrientOthEdge (const Standard_Integer I,
 //function : Classify
 //purpose  : 
 //=======================================================================
+namespace
+{
+
+static void REJECT1(
+  const Standard_Real theDeca[],
+  const Standard_Real theTotMin[],
+  const Standard_Real theTotMax[],
+  const Standard_Real theSurD[],
+  HLRAlgo_EdgesBlock::MinMaxIndices& theVertMin,
+  HLRAlgo_EdgesBlock::MinMaxIndices& theVertMax)
+{
+  theVertMin.Min[0] = (Standard_Integer)((theDeca[ 0]+theTotMin[ 0]) * theSurD[ 0]);
+  theVertMax.Min[0] = (Standard_Integer)((theDeca[ 0]+theTotMax[ 0]) * theSurD[ 0]);
+  theVertMin.Min[1] = (Standard_Integer)((theDeca[ 1]+theTotMin[ 1]) * theSurD[ 1]);
+  theVertMax.Min[1] = (Standard_Integer)((theDeca[ 1]+theTotMax[ 1]) * theSurD[ 1]);
+  theVertMin.Min[2] = (Standard_Integer)((theDeca[ 2]+theTotMin[ 2]) * theSurD[ 2]);
+  theVertMax.Min[2] = (Standard_Integer)((theDeca[ 2]+theTotMax[ 2]) * theSurD[ 2]);
+  theVertMin.Min[3] = (Standard_Integer)((theDeca[ 3]+theTotMin[ 3]) * theSurD[ 3]);
+  theVertMax.Min[3] = (Standard_Integer)((theDeca[ 3]+theTotMax[ 3]) * theSurD[ 3]);
+  theVertMin.Min[4] = (Standard_Integer)((theDeca[ 4]+theTotMin[ 4]) * theSurD[ 4]);
+  theVertMax.Min[4] = (Standard_Integer)((theDeca[ 4]+theTotMax[ 4]) * theSurD[ 4]);
+  theVertMin.Min[5] = (Standard_Integer)((theDeca[ 5]+theTotMin[ 5]) * theSurD[ 5]);
+  theVertMax.Min[5] = (Standard_Integer)((theDeca[ 5]+theTotMax[ 5]) * theSurD[ 5]);
+  theVertMin.Min[6] = (Standard_Integer)((theDeca[ 6]+theTotMin[ 6]) * theSurD[ 6]);
+  theVertMax.Min[6] = (Standard_Integer)((theDeca[ 6]+theTotMax[ 6]) * theSurD[ 6]);
+  theVertMin.Min[7] = (Standard_Integer)((theDeca[ 7]+theTotMin[ 7]) * theSurD[ 7]);
+  theVertMax.Min[7] = (Standard_Integer)((theDeca[ 7]+theTotMax[ 7]) * theSurD[ 7]);
+  theVertMin.Max[0] = (Standard_Integer)((theDeca[ 8]+theTotMin[ 8]) * theSurD[ 8]);
+  theVertMax.Max[0] = (Standard_Integer)((theDeca[ 8]+theTotMax[ 8]) * theSurD[ 8]);
+  theVertMin.Max[1] = (Standard_Integer)((theDeca[ 9]+theTotMin[ 9]) * theSurD[ 9]);
+  theVertMax.Max[1] = (Standard_Integer)((theDeca[ 9]+theTotMax[ 9]) * theSurD[ 9]);
+  theVertMin.Max[2] = (Standard_Integer)((theDeca[10]+theTotMin[10]) * theSurD[10]);
+  theVertMax.Max[2] = (Standard_Integer)((theDeca[10]+theTotMax[10]) * theSurD[10]);
+  theVertMin.Max[3] = (Standard_Integer)((theDeca[11]+theTotMin[11]) * theSurD[11]);
+  theVertMax.Max[3] = (Standard_Integer)((theDeca[11]+theTotMax[11]) * theSurD[11]);
+  theVertMin.Max[4] = (Standard_Integer)((theDeca[12]+theTotMin[12]) * theSurD[12]);
+  theVertMax.Max[4] = (Standard_Integer)((theDeca[12]+theTotMax[12]) * theSurD[12]);
+  theVertMin.Max[5] = (Standard_Integer)((theDeca[13]+theTotMin[13]) * theSurD[13]);
+  theVertMax.Max[5] = (Standard_Integer)((theDeca[13]+theTotMax[13]) * theSurD[13]);
+  theVertMin.Max[6] = (Standard_Integer)((theDeca[14]+theTotMin[14]) * theSurD[14]);
+  theVertMax.Max[6] = (Standard_Integer)((theDeca[14]+theTotMax[14]) * theSurD[14]);
+  theVertMin.Max[7] = (Standard_Integer)((theDeca[15]+theTotMin[15]) * theSurD[15]);
+  theVertMax.Max[7] = (Standard_Integer)((theDeca[15]+theTotMax[15]) * theSurD[15]);
+}
 
-#define REJECT1    \
-    VertMin[ 0] = (Standard_Integer)((myDeca[ 0]+TotMin[ 0])*mySurD[ 0]); \
-    VertMax[ 0] = (Standard_Integer)((myDeca[ 0]+TotMax[ 0])*mySurD[ 0]); \
-    VertMin[ 1] = (Standard_Integer)((myDeca[ 1]+TotMin[ 1])*mySurD[ 1]); \
-    VertMax[ 1] = (Standard_Integer)((myDeca[ 1]+TotMax[ 1])*mySurD[ 1]); \
-    VertMin[ 2] = (Standard_Integer)((myDeca[ 2]+TotMin[ 2])*mySurD[ 2]); \
-    VertMax[ 2] = (Standard_Integer)((myDeca[ 2]+TotMax[ 2])*mySurD[ 2]); \
-    VertMin[ 3] = (Standard_Integer)((myDeca[ 3]+TotMin[ 3])*mySurD[ 3]); \
-    VertMax[ 3] = (Standard_Integer)((myDeca[ 3]+TotMax[ 3])*mySurD[ 3]); \
-    VertMin[ 4] = (Standard_Integer)((myDeca[ 4]+TotMin[ 4])*mySurD[ 4]); \
-    VertMax[ 4] = (Standard_Integer)((myDeca[ 4]+TotMax[ 4])*mySurD[ 4]); \
-    VertMin[ 5] = (Standard_Integer)((myDeca[ 5]+TotMin[ 5])*mySurD[ 5]); \
-    VertMax[ 5] = (Standard_Integer)((myDeca[ 5]+TotMax[ 5])*mySurD[ 5]); \
-    VertMin[ 6] = (Standard_Integer)((myDeca[ 6]+TotMin[ 6])*mySurD[ 6]); \
-    VertMax[ 6] = (Standard_Integer)((myDeca[ 6]+TotMax[ 6])*mySurD[ 6]); \
-    VertMin[ 7] = (Standard_Integer)((myDeca[ 7]+TotMin[ 7])*mySurD[ 7]); \
-    VertMax[ 7] = (Standard_Integer)((myDeca[ 7]+TotMax[ 7])*mySurD[ 7]); \
-    VertMin[ 8] = (Standard_Integer)((myDeca[ 8]+TotMin[ 8])*mySurD[ 8]); \
-    VertMax[ 8] = (Standard_Integer)((myDeca[ 8]+TotMax[ 8])*mySurD[ 8]); \
-    VertMin[ 9] = (Standard_Integer)((myDeca[ 9]+TotMin[ 9])*mySurD[ 9]); \
-    VertMax[ 9] = (Standard_Integer)((myDeca[ 9]+TotMax[ 9])*mySurD[ 9]); \
-    VertMin[10] = (Standard_Integer)((myDeca[10]+TotMin[10])*mySurD[10]); \
-    VertMax[10] = (Standard_Integer)((myDeca[10]+TotMax[10])*mySurD[10]); \
-    VertMin[11] = (Standard_Integer)((myDeca[11]+TotMin[11])*mySurD[11]); \
-    VertMax[11] = (Standard_Integer)((myDeca[11]+TotMax[11])*mySurD[11]); \
-    VertMin[12] = (Standard_Integer)((myDeca[12]+TotMin[12])*mySurD[12]); \
-    VertMax[12] = (Standard_Integer)((myDeca[12]+TotMax[12])*mySurD[12]); \
-    VertMin[13] = (Standard_Integer)((myDeca[13]+TotMin[13])*mySurD[13]); \
-    VertMax[13] = (Standard_Integer)((myDeca[13]+TotMax[13])*mySurD[13]); \
-    VertMin[14] = (Standard_Integer)((myDeca[14]+TotMin[14])*mySurD[14]); \
-    VertMax[14] = (Standard_Integer)((myDeca[14]+TotMax[14])*mySurD[14]); \
-    VertMin[15] = (Standard_Integer)((myDeca[15]+TotMin[15])*mySurD[15]); \
-    VertMax[15] = (Standard_Integer)((myDeca[15]+TotMax[15])*mySurD[15]); 
+}
 
 TopAbs_State 
 HLRBRep_Data::Classify (const Standard_Integer E,
@@ -1839,7 +1717,7 @@ HLRBRep_Data::Classify (const Standard_Integer E,
   (void)E; // avoid compiler warning
 
   nbClassification++;
-  Standard_Integer VertMin[16],VertMax[16],MinMaxVert[16];
+  HLRAlgo_EdgesBlock::MinMaxIndices VertMin, VertMax, MinMaxVert;
   Standard_Real TotMin[16],TotMax[16];
   
   Standard_Integer i;
@@ -1856,35 +1734,27 @@ HLRBRep_Data::Classify (const Standard_Integer E,
     
     //-- les rejections sont faites dans l intersecteur a moindre frais 
     //-- puisque la surface sera chargee
-    HLRAlgo::InitMinMax(Precision::Infinite(),
-                       (Standard_Address)TotMin,
-                       (Standard_Address)TotMax);
-    HLRAlgo::UpdateMinMax(xsta,ysta,zsta,
-                         (Standard_Address)TotMin,
-                         (Standard_Address)TotMax);
-    HLRAlgo::EnlargeMinMax(tol,
-                          (Standard_Address)TotMin,
-                          (Standard_Address)TotMax);
-    REJECT1;
-
-    HLRAlgo::EncodeMinMax((Standard_Address)VertMin,
-                         (Standard_Address)VertMax,
-                         (Standard_Address)MinMaxVert);
-    if (((MaxFace1 - MinVert1) & 0x80008000) != 0 ||
-       ((MaxVert1 - MinFace1) & 0x80008000) != 0 ||
-       ((MaxFace2 - MinVert2) & 0x80008000) != 0 ||
-       ((MaxVert2 - MinFace2) & 0x80008000) != 0 ||
-       ((MaxFace3 - MinVert3) & 0x80008000) != 0 ||
-       ((MaxVert3 - MinFace3) & 0x80008000) != 0 ||
-       ((MaxFace4 - MinVert4) & 0x80008000) != 0 ||
-       ((MaxVert4 - MinFace4) & 0x80008000) != 0 ||
-       ((MaxFace5 - MinVert5) & 0x80008000) != 0 ||
-       ((MaxVert5 - MinFace5) & 0x80008000) != 0 ||
-       ((MaxFace6 - MinVert6) & 0x80008000) != 0 ||
-       ((MaxVert6 - MinFace6) & 0x80008000) != 0 ||
-       ((MaxFace7 - MinVert7) & 0x80008000) != 0 ||
-       ((MaxVert7 - MinFace7) & 0x80008000) != 0 ||
-       ((MaxFace8 - MinVert8) & 0x80008000) != 0) { //-- Rejection en Z 
+    HLRAlgo::InitMinMax(Precision::Infinite(), TotMin, TotMax);
+    HLRAlgo::UpdateMinMax(xsta,ysta,zsta, TotMin, TotMax);
+    HLRAlgo::EnlargeMinMax(tol, TotMin, TotMax);
+    REJECT1(myDeca, TotMin, TotMax, mySurD, VertMin, VertMax);
+
+    HLRAlgo::EncodeMinMax(VertMin, VertMax, MinMaxVert);
+    if (((iFaceMinMax->Max[0] - MinMaxVert.Min[0]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[0] - iFaceMinMax->Min[0]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[1] - MinMaxVert.Min[1]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[1] - iFaceMinMax->Min[1]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[2] - MinMaxVert.Min[2]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[2] - iFaceMinMax->Min[2]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[3] - MinMaxVert.Min[3]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[3] - iFaceMinMax->Min[3]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[4] - MinMaxVert.Min[4]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[4] - iFaceMinMax->Min[4]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[5] - MinMaxVert.Min[5]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[5] - iFaceMinMax->Min[5]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[6] - MinMaxVert.Min[6]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[6] - iFaceMinMax->Min[6]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[7] - MinMaxVert.Min[7]) & 0x80008000) != 0) { //-- Rejection en Z 
       return state;
     }
   }
@@ -1894,71 +1764,55 @@ HLRBRep_Data::Classify (const Standard_Integer E,
     
     //-- les rejections sont faites dans l intersecteur a moindre frais 
     //-- puisque la surface sera chargee
-    HLRAlgo::InitMinMax(Precision::Infinite(),
-                       (Standard_Address)TotMin,
-                       (Standard_Address)TotMax);
-    HLRAlgo::UpdateMinMax(xsta,ysta,zsta,
-                         (Standard_Address)TotMin,
-                         (Standard_Address)TotMax);
-    HLRAlgo::EnlargeMinMax(tol,
-                          (Standard_Address)TotMin,
-                          (Standard_Address)TotMax);
-
-    REJECT1; 
-
-    HLRAlgo::EncodeMinMax((Standard_Address)VertMin,
-                         (Standard_Address)VertMax,
-                         (Standard_Address)MinMaxVert);
-    if (((MaxFace1 - MinVert1) & 0x80008000) != 0 ||
-       ((MaxVert1 - MinFace1) & 0x80008000) != 0 ||
-       ((MaxFace2 - MinVert2) & 0x80008000) != 0 ||
-       ((MaxVert2 - MinFace2) & 0x80008000) != 0 ||
-       ((MaxFace3 - MinVert3) & 0x80008000) != 0 ||
-       ((MaxVert3 - MinFace3) & 0x80008000) != 0 ||
-       ((MaxFace4 - MinVert4) & 0x80008000) != 0 ||
-       ((MaxVert4 - MinFace4) & 0x80008000) != 0 ||
-       ((MaxFace5 - MinVert5) & 0x80008000) != 0 ||
-       ((MaxVert5 - MinFace5) & 0x80008000) != 0 ||
-       ((MaxFace6 - MinVert6) & 0x80008000) != 0 ||
-       ((MaxVert6 - MinFace6) & 0x80008000) != 0 ||
-       ((MaxFace7 - MinVert7) & 0x80008000) != 0 ||
-       ((MaxVert7 - MinFace7) & 0x80008000) != 0 ||
-       ((MaxFace8 - MinVert8) & 0x80008000) != 0) { //-- Rejection en Z 
+    HLRAlgo::InitMinMax(Precision::Infinite(), TotMin, TotMax);
+    HLRAlgo::UpdateMinMax(xsta,ysta,zsta, TotMin, TotMax);
+    HLRAlgo::EnlargeMinMax(tol, TotMin, TotMax);
+
+    REJECT1(myDeca, TotMin, TotMax, mySurD, VertMin, VertMax);
+
+    HLRAlgo::EncodeMinMax(VertMin, VertMax, MinMaxVert);
+    if (((iFaceMinMax->Max[0] - MinMaxVert.Min[0]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[0] - iFaceMinMax->Min[0]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[1] - MinMaxVert.Min[1]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[1] - iFaceMinMax->Min[1]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[2] - MinMaxVert.Min[2]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[2] - iFaceMinMax->Min[2]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[3] - MinMaxVert.Min[3]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[3] - iFaceMinMax->Min[3]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[4] - MinMaxVert.Min[4]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[4] - iFaceMinMax->Min[4]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[5] - MinMaxVert.Min[5]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[5] - iFaceMinMax->Min[5]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[6] - MinMaxVert.Min[6]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[6] - iFaceMinMax->Min[6]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[7] - MinMaxVert.Min[7]) & 0x80008000) != 0) { //-- Rejection en Z 
       return state;
     }
     end = EC.Parameter3d(EC.LastParameter());
     myProj.Project(EC.Value3D(end),xend,yend,zend);
     
-    HLRAlgo::InitMinMax(Precision::Infinite(),
-                       (Standard_Address)TotMin,
-                       (Standard_Address)TotMax);
-    HLRAlgo::UpdateMinMax(xend,yend,zend,
-                         (Standard_Address)TotMin,
-                         (Standard_Address)TotMax);
-    HLRAlgo::EnlargeMinMax(tol,
-                          (Standard_Address)TotMin,
-                          (Standard_Address)TotMax);
-
-    REJECT1;
-
-    HLRAlgo::EncodeMinMax((Standard_Address)VertMin,
-                         (Standard_Address)VertMax,
-                         (Standard_Address)MinMaxVert);
-    if (((MaxFace1 - MinVert1) & 0x80008000) != 0 ||
-       ((MaxVert1 - MinFace1) & 0x80008000) != 0 ||
-       ((MaxFace2 - MinVert2) & 0x80008000) != 0 ||
-       ((MaxVert2 - MinFace2) & 0x80008000) != 0 ||
-       ((MaxFace3 - MinVert3) & 0x80008000) != 0 ||
-       ((MaxVert3 - MinFace3) & 0x80008000) != 0 ||
-       ((MaxFace4 - MinVert4) & 0x80008000) != 0 ||
-       ((MaxVert4 - MinFace4) & 0x80008000) != 0 ||
-       ((MaxFace5 - MinVert5) & 0x80008000) != 0 ||
-       ((MaxVert5 - MinFace5) & 0x80008000) != 0 ||
-       ((MaxFace6 - MinVert6) & 0x80008000) != 0 ||
-       ((MaxVert6 - MinFace6) & 0x80008000) != 0 ||
-       ((MaxFace7 - MinVert7) & 0x80008000) != 0 ||
-       ((MaxVert7 - MinFace7) & 0x80008000) != 0 ||
-       ((MaxFace8 - MinVert8) & 0x80008000) != 0) { //-- Rejection en Z 
+    HLRAlgo::InitMinMax(Precision::Infinite(), TotMin, TotMax);
+    HLRAlgo::UpdateMinMax(xend,yend,zend, TotMin, TotMax);
+    HLRAlgo::EnlargeMinMax(tol, TotMin, TotMax);
+
+    REJECT1(myDeca, TotMin, TotMax, mySurD, VertMin, VertMax);
+
+    HLRAlgo::EncodeMinMax(VertMin, VertMax, MinMaxVert);
+    if (((iFaceMinMax->Max[0] - MinMaxVert.Min[0]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[0] - iFaceMinMax->Min[0]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[1] - MinMaxVert.Min[1]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[1] - iFaceMinMax->Min[1]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[2] - MinMaxVert.Min[2]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[2] - iFaceMinMax->Min[2]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[3] - MinMaxVert.Min[3]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[3] - iFaceMinMax->Min[3]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[4] - MinMaxVert.Min[4]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[4] - iFaceMinMax->Min[4]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[5] - MinMaxVert.Min[5]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[5] - iFaceMinMax->Min[5]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[6] - MinMaxVert.Min[6]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[6] - iFaceMinMax->Min[6]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[7] - MinMaxVert.Min[7]) & 0x80008000) != 0) { //-- Rejection en Z 
       return state;
     }
     sta = 0.4 * sta + 0.6 * end; // dangerous if it is the middle
@@ -1966,20 +1820,12 @@ HLRBRep_Data::Classify (const Standard_Integer E,
     
     //-- les rejections sont faites dans l intersecteur a moindre frais 
     //-- puisque la surface sera chargee
-    HLRAlgo::InitMinMax(Precision::Infinite(),
-                       (Standard_Address)TotMin,
-                       (Standard_Address)TotMax);
-    HLRAlgo::UpdateMinMax(xsta,ysta,zsta,
-                         (Standard_Address)TotMin,
-                         (Standard_Address)TotMax);
-    HLRAlgo::EnlargeMinMax(tol,
-                          (Standard_Address)TotMin,
-                          (Standard_Address)TotMax);
-    REJECT1;
-
-    HLRAlgo::EncodeMinMax((Standard_Address)VertMin,
-                         (Standard_Address)VertMax,
-                         (Standard_Address)MinMaxVert);
+    HLRAlgo::InitMinMax(Precision::Infinite(), TotMin, TotMax);
+    HLRAlgo::UpdateMinMax(xsta,ysta,zsta, TotMin, TotMax);
+    HLRAlgo::EnlargeMinMax(tol, TotMin, TotMax);
+    REJECT1(myDeca, TotMin, TotMax, mySurD, VertMin, VertMax);
+
+    HLRAlgo::EncodeMinMax(VertMin, VertMax, MinMaxVert);
     /*
 #ifdef OCCT_DEBUG
        {
@@ -2022,21 +1868,21 @@ HLRBRep_Data::Classify (const Standard_Integer E,
  #endif
     */
 
-    if (((MaxFace1 - MinVert1) & 0x80008000) != 0 ||
-       ((MaxVert1 - MinFace1) & 0x80008000) != 0 ||
-       ((MaxFace2 - MinVert2) & 0x80008000) != 0 ||
-       ((MaxVert2 - MinFace2) & 0x80008000) != 0 ||
-       ((MaxFace3 - MinVert3) & 0x80008000) != 0 ||
-       ((MaxVert3 - MinFace3) & 0x80008000) != 0 ||
-       ((MaxFace4 - MinVert4) & 0x80008000) != 0 ||
-       ((MaxVert4 - MinFace4) & 0x80008000) != 0 ||
-       ((MaxFace5 - MinVert5) & 0x80008000) != 0 ||
-       ((MaxVert5 - MinFace5) & 0x80008000) != 0 ||
-       ((MaxFace6 - MinVert6) & 0x80008000) != 0 ||
-       ((MaxVert6 - MinFace6) & 0x80008000) != 0 ||
-       ((MaxFace7 - MinVert7) & 0x80008000) != 0 ||
-       ((MaxVert7 - MinFace7) & 0x80008000) != 0 ||
-       ((MaxFace8 - MinVert8) & 0x80008000) != 0) { //-- Rejection en Z 
+    if (((iFaceMinMax->Max[0] - MinMaxVert.Min[0]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[0] - iFaceMinMax->Min[0]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[1] - MinMaxVert.Min[1]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[1] - iFaceMinMax->Min[1]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[2] - MinMaxVert.Min[2]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[2] - iFaceMinMax->Min[2]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[3] - MinMaxVert.Min[3]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[3] - iFaceMinMax->Min[3]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[4] - MinMaxVert.Min[4]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[4] - iFaceMinMax->Min[4]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[5] - MinMaxVert.Min[5]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[5] - iFaceMinMax->Min[5]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[6] - MinMaxVert.Min[6]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[6] - iFaceMinMax->Min[6]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[7] - MinMaxVert.Min[7]) & 0x80008000) != 0) { //-- Rejection en Z 
       return state;
     }
   }
@@ -2124,7 +1970,7 @@ TopAbs_State HLRBRep_Data::SimplClassify (const Standard_Integer /*E*/,
                                          const Standard_Real p2)
 {
   nbClassification++;
-  Standard_Integer VertMin[16],VertMax[16],MinMaxVert[16];
+  HLRAlgo_EdgesBlock::MinMaxIndices VertMin, VertMax, MinMaxVert;
   Standard_Real TotMin[16],TotMax[16];
   
   Standard_Integer i;
@@ -2141,35 +1987,27 @@ TopAbs_State HLRBRep_Data::SimplClassify (const Standard_Integer /*E*/,
     
     //-- les rejections sont faites dans l intersecteur a moindre frais 
     //-- puisque la surface sera chargee
-    HLRAlgo::InitMinMax(Precision::Infinite(),
-                       (Standard_Address)TotMin,
-                       (Standard_Address)TotMax);
-    HLRAlgo::UpdateMinMax(xsta,ysta,zsta,
-                         (Standard_Address)TotMin,
-                         (Standard_Address)TotMax);
-    HLRAlgo::EnlargeMinMax(tol,
-                          (Standard_Address)TotMin,
-                          (Standard_Address)TotMax);
-    REJECT1;
-
-    HLRAlgo::EncodeMinMax((Standard_Address)VertMin,
-                         (Standard_Address)VertMax,
-                         (Standard_Address)MinMaxVert);
-    if (((MaxFace1 - MinVert1) & 0x80008000) != 0 ||
-       ((MaxVert1 - MinFace1) & 0x80008000) != 0 ||
-       ((MaxFace2 - MinVert2) & 0x80008000) != 0 ||
-       ((MaxVert2 - MinFace2) & 0x80008000) != 0 ||
-       ((MaxFace3 - MinVert3) & 0x80008000) != 0 ||
-       ((MaxVert3 - MinFace3) & 0x80008000) != 0 ||
-       ((MaxFace4 - MinVert4) & 0x80008000) != 0 ||
-       ((MaxVert4 - MinFace4) & 0x80008000) != 0 ||
-       ((MaxFace5 - MinVert5) & 0x80008000) != 0 ||
-       ((MaxVert5 - MinFace5) & 0x80008000) != 0 ||
-       ((MaxFace6 - MinVert6) & 0x80008000) != 0 ||
-       ((MaxVert6 - MinFace6) & 0x80008000) != 0 ||
-       ((MaxFace7 - MinVert7) & 0x80008000) != 0 ||
-       ((MaxVert7 - MinFace7) & 0x80008000) != 0 ||
-       ((MaxFace8 - MinVert8) & 0x80008000) != 0) { //-- Rejection en Z 
+    HLRAlgo::InitMinMax(Precision::Infinite(), TotMin, TotMax);
+    HLRAlgo::UpdateMinMax(xsta,ysta,zsta, TotMin, TotMax);
+    HLRAlgo::EnlargeMinMax(tol, TotMin, TotMax);
+    REJECT1(myDeca, TotMin, TotMax, mySurD, VertMin, VertMax);
+
+    HLRAlgo::EncodeMinMax(VertMin, VertMax, MinMaxVert);
+    if (((iFaceMinMax->Max[0] - MinMaxVert.Min[0]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[0] - iFaceMinMax->Min[0]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[1] - MinMaxVert.Min[1]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[1] - iFaceMinMax->Min[1]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[2] - MinMaxVert.Min[2]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[2] - iFaceMinMax->Min[2]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[3] - MinMaxVert.Min[3]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[3] - iFaceMinMax->Min[3]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[4] - MinMaxVert.Min[4]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[4] - iFaceMinMax->Min[4]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[5] - MinMaxVert.Min[5]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[5] - iFaceMinMax->Min[5]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[6] - MinMaxVert.Min[6]) & 0x80008000) != 0 ||
+       ((MinMaxVert.Max[6] - iFaceMinMax->Min[6]) & 0x80008000) != 0 ||
+       ((iFaceMinMax->Max[7] - MinMaxVert.Min[7]) & 0x80008000) != 0) { //-- Rejection en Z 
       return TopAbs_OUT;
     }
   }
index f537114..c47e635 100644 (file)
@@ -50,6 +50,7 @@ class gp_Dir2d;
 class HLRBRep_EdgeData;
 class HLRBRep_FaceData;
 class IntRes2d_IntersectionPoint;
+class TableauRejection;
 
 
 class HLRBRep_Data;
@@ -99,7 +100,7 @@ public:
     TopTools_IndexedMapOfShape& FaceMap();
   
   //! to compare with only non rejected edges.
-  Standard_EXPORT void InitBoundSort (const Standard_Address MinMaxTot, const Standard_Integer e1, const Standard_Integer e2);
+  Standard_EXPORT void InitBoundSort (const HLRAlgo_EdgesBlock::MinMaxIndices& MinMaxTot, const Standard_Integer e1, const Standard_Integer e2);
   
   //! Begin an iteration only  on visible Edges
   //! crossing the face number <FI>.
@@ -228,9 +229,9 @@ private:
   HLRBRep_FaceIterator myFaceItr1;
   HLRBRep_FaceIterator myFaceItr2;
   Standard_Integer iFace;
-  Standard_Address iFaceData;
+  HLRBRep_FaceData* iFaceData;
   Standard_Address iFaceGeom;
-  Standard_Address iFaceMinMax;
+  HLRAlgo_EdgesBlock::MinMaxIndices* iFaceMinMax;
   GeomAbs_SurfaceType iFaceType;
   Standard_Boolean iFaceBack;
   Standard_Boolean iFaceSimp;
@@ -246,9 +247,9 @@ private:
   Standard_Boolean myLEInternal;
   Standard_Boolean myLEDouble;
   Standard_Boolean myLEIsoLine;
-  Standard_Address myLEData;
-  Standard_Address myLEGeom;
-  Standard_Address myLEMinMax;
+  HLRBRep_EdgeData* myLEData;
+  const HLRBRep_Curve* myLEGeom;
+  HLRAlgo_EdgesBlock::MinMaxIndices* myLEMinMax;
   GeomAbs_CurveType myLEType;
   Standard_ShortReal myLETol;
   Standard_Integer myFE;
@@ -256,8 +257,8 @@ private:
   Standard_Boolean myFEOutLine;
   Standard_Boolean myFEInternal;
   Standard_Boolean myFEDouble;
-  Standard_Address myFEData;
-  Standard_Address myFEGeom;
+  HLRBRep_EdgeData* myFEData;
+  HLRBRep_Curve* myFEGeom;
   GeomAbs_CurveType myFEType;
   Standard_ShortReal myFETol;
   HLRBRep_Intersector myIntersector;
@@ -269,7 +270,7 @@ private:
   Standard_Integer iInterf;
   HLRAlgo_Interference myIntf;
   Standard_Boolean myAboveIntf;
-  Standard_Address myReject;
+  TableauRejection* myReject;
 
 
 };
index ddcc534..da7d9f4 100644 (file)
 #include <HLRBRep_EdgeData.hxx>
 #include <TopoDS_Edge.hxx>
 
-//=======================================================================
-//function : EdgeData
-//purpose  : 
-//=======================================================================
-HLRBRep_EdgeData::HLRBRep_EdgeData () :
-       myFlags(0),
-       myHideCount(0)
-{ Selected(Standard_True); }
-
 //=======================================================================
 //function : Set
 //purpose  : 
@@ -66,28 +57,3 @@ void HLRBRep_EdgeData::Set (const Standard_Boolean Rg1L,
      End  ,(Standard_ShortReal)(ChangeGeometry().Curve().Resolution
                                ((Standard_Real)TolEnd  )));
 }
-
-//=======================================================================
-//function : UpdateMinMax
-//purpose  : 
-//=======================================================================
-
-void HLRBRep_EdgeData::UpdateMinMax (const Standard_Address TotMinMax)
-{
-  myMinMax[ 0] = ((Standard_Integer*)TotMinMax)[ 0];
-  myMinMax[ 1] = ((Standard_Integer*)TotMinMax)[ 1];
-  myMinMax[ 2] = ((Standard_Integer*)TotMinMax)[ 2];
-  myMinMax[ 3] = ((Standard_Integer*)TotMinMax)[ 3];
-  myMinMax[ 4] = ((Standard_Integer*)TotMinMax)[ 4];
-  myMinMax[ 5] = ((Standard_Integer*)TotMinMax)[ 5];
-  myMinMax[ 6] = ((Standard_Integer*)TotMinMax)[ 6];
-  myMinMax[ 7] = ((Standard_Integer*)TotMinMax)[ 7];
-  myMinMax[ 8] = ((Standard_Integer*)TotMinMax)[ 8];
-  myMinMax[ 9] = ((Standard_Integer*)TotMinMax)[ 9];
-  myMinMax[10] = ((Standard_Integer*)TotMinMax)[10];
-  myMinMax[11] = ((Standard_Integer*)TotMinMax)[11];
-  myMinMax[12] = ((Standard_Integer*)TotMinMax)[12];
-  myMinMax[13] = ((Standard_Integer*)TotMinMax)[13];
-  myMinMax[14] = ((Standard_Integer*)TotMinMax)[14];
-  myMinMax[15] = ((Standard_Integer*)TotMinMax)[15];
-}
index 12bf406..f0789ca 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _HLRBRep_EdgeData_HeaderFile
 #define _HLRBRep_EdgeData_HeaderFile
 
+#include <HLRAlgo_WiresBlock.hxx>
+
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
@@ -27,7 +29,6 @@
 #include <HLRBRep_Curve.hxx>
 #include <Standard_ShortReal.hxx>
 #include <Standard_Real.hxx>
-#include <Standard_Address.hxx>
 class TopoDS_Edge;
 class HLRAlgo_EdgeStatus;
 class HLRBRep_Curve;
@@ -40,9 +41,13 @@ public:
 
   DEFINE_STANDARD_ALLOC
 
-  
-  Standard_EXPORT HLRBRep_EdgeData();
-  
+  HLRBRep_EdgeData() :
+    myFlags(0),
+    myHideCount(0)
+  {
+    Selected(Standard_True);
+  }
+
   Standard_EXPORT void Set (const Standard_Boolean Reg1, const Standard_Boolean RegN, const TopoDS_Edge& EG, const Standard_Integer V1, const Standard_Integer V2, const Standard_Boolean Out1, const Standard_Boolean Out2, const Standard_Boolean Cut1, const Standard_Boolean Cut2, const Standard_Real Start, const Standard_ShortReal TolStart, const Standard_Real End, const Standard_ShortReal TolEnd);
   
     Standard_Boolean Selected() const;
@@ -109,9 +114,15 @@ public:
   
     void VEnd (const Standard_Integer I);
   
-  Standard_EXPORT void UpdateMinMax (const Standard_Address TotMinMax);
+  void UpdateMinMax (const HLRAlgo_EdgesBlock::MinMaxIndices& theTotMinMax)
+  {
+    myMinMax = theTotMinMax;
+  }
   
-    Standard_Address MinMax() const;
+  HLRAlgo_EdgesBlock::MinMaxIndices& MinMax()
+  {
+    return myMinMax;
+  }
   
     HLRAlgo_EdgeStatus& Status();
   
@@ -119,8 +130,11 @@ public:
   
     const HLRBRep_Curve& Geometry() const;
   
-    Standard_Address Curve();
-  
+    HLRBRep_Curve* Curve()
+    {
+      return &myGeometry;
+    }
+
     Standard_ShortReal Tolerance() const;
 
 protected:
@@ -148,7 +162,7 @@ private:
   Standard_Integer myHideCount;
   Standard_Integer myVSta;
   Standard_Integer myVEnd;
-  Standard_Integer myMinMax[16];
+  HLRAlgo_EdgesBlock::MinMaxIndices myMinMax;
   HLRAlgo_EdgeStatus myStatus;
   HLRBRep_Curve myGeometry;
   Standard_ShortReal myTolerance;
index b70986b..4f73783 100644 (file)
@@ -310,14 +310,6 @@ inline Standard_Integer HLRBRep_EdgeData::VEnd () const
 inline void HLRBRep_EdgeData::VEnd (const Standard_Integer I)
 { myVEnd = I; }
 
-//=======================================================================
-//function : MinMax
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRBRep_EdgeData::MinMax () const
-{ return (Standard_Address)&myMinMax; }
-
 //=======================================================================
 //function : Status
 //purpose  : 
@@ -342,14 +334,6 @@ inline HLRBRep_Curve & HLRBRep_EdgeData::ChangeGeometry ()
 inline const HLRBRep_Curve & HLRBRep_EdgeData::Geometry () const
 { return myGeometry; }
 
-//=======================================================================
-//function : Curve
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRBRep_EdgeData::Curve ()
-{ return ((Standard_Address)&myGeometry); }
-
 //=======================================================================
 //function : Tolerance
 //purpose  : 
index c4f35c6..8b5a5b7 100644 (file)
@@ -44,40 +44,6 @@ extern Standard_Integer nbCal3Intersection; // curve-surface intersections
 static Standard_Integer TRACE = Standard_True;
 static Standard_Integer TRACE10 = Standard_True; 
 
-#define MinShBI1 MinMaxShBI[ 0]
-#define MinShBI2 MinMaxShBI[ 1]
-#define MinShBI3 MinMaxShBI[ 2]
-#define MinShBI4 MinMaxShBI[ 3]
-#define MinShBI5 MinMaxShBI[ 4]
-#define MinShBI6 MinMaxShBI[ 5]
-#define MinShBI7 MinMaxShBI[ 6]
-#define MinShBI8 MinMaxShBI[ 7]
-#define MaxShBI1 MinMaxShBI[ 8]
-#define MaxShBI2 MinMaxShBI[ 9]
-#define MaxShBI3 MinMaxShBI[10]
-#define MaxShBI4 MinMaxShBI[11]
-#define MaxShBI5 MinMaxShBI[12]
-#define MaxShBI6 MinMaxShBI[13]
-#define MaxShBI7 MinMaxShBI[14]
-#define MaxShBI8 MinMaxShBI[15]
-
-#define MinShBJ1 MinMaxShBJ[ 0]
-#define MinShBJ2 MinMaxShBJ[ 1]
-#define MinShBJ3 MinMaxShBJ[ 2]
-#define MinShBJ4 MinMaxShBJ[ 3]
-#define MinShBJ5 MinMaxShBJ[ 4]
-#define MinShBJ6 MinMaxShBJ[ 5]
-#define MinShBJ7 MinMaxShBJ[ 6]
-#define MinShBJ8 MinMaxShBJ[ 7]
-#define MaxShBJ1 MinMaxShBJ[ 8]
-#define MaxShBJ2 MinMaxShBJ[ 9]
-#define MaxShBJ3 MinMaxShBJ[10]
-#define MaxShBJ4 MinMaxShBJ[11]
-#define MaxShBJ5 MinMaxShBJ[12]
-#define MaxShBJ6 MinMaxShBJ[13]
-#define MaxShBJ7 MinMaxShBJ[14]
-#define MaxShBJ8 MinMaxShBJ[15]
-
 //=======================================================================
 //function : HLRBRep_InternalAlgo
 //purpose  : 
@@ -188,8 +154,8 @@ void HLRBRep_InternalAlgo::Update ()
 
     myDS->Update(myProj);
 
-    Standard_Integer ShapMin[16],ShapMax[16],MinMaxShap[16];
-    Standard_Integer TheMin[16],TheMax[16];
+    HLRAlgo_EdgesBlock::MinMaxIndices ShapMin, ShapMax, MinMaxShap;
+    HLRAlgo_EdgesBlock::MinMaxIndices TheMin, TheMax;
     HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
     HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
 
@@ -201,37 +167,22 @@ void HLRBRep_InternalAlgo::Update ()
 
       for (Standard_Integer e = e1; e <= e2; e++) {
         HLRBRep_EdgeData ed = aEDataArray.ChangeValue(e);
-        HLRAlgo::DecodeMinMax(ed.MinMax(),
-                             (Standard_Address)TheMin,
-                             (Standard_Address)TheMax);
+        HLRAlgo::DecodeMinMax(ed.MinMax(), TheMin, TheMax);
        if (FirstTime) {
          FirstTime = Standard_False;
-         HLRAlgo::CopyMinMax((Standard_Address)TheMin,
-                             (Standard_Address)TheMax,
-                             (Standard_Address)ShapMin,
-                             (Standard_Address)ShapMax);
+         HLRAlgo::CopyMinMax(TheMin, TheMax, ShapMin, ShapMax);
        }
        else
-         HLRAlgo::AddMinMax((Standard_Address)TheMin,
-                            (Standard_Address)TheMax,
-                            (Standard_Address)ShapMin,
-                            (Standard_Address)ShapMax);
+         HLRAlgo::AddMinMax(TheMin, TheMax, ShapMin, ShapMax);
       }
 
       for (Standard_Integer f = f1; f <= f2; f++) {
         HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
-        HLRAlgo::DecodeMinMax(fd.Wires()->MinMax(),
-                             (Standard_Address)TheMin,
-                             (Standard_Address)TheMax);
-       HLRAlgo::AddMinMax((Standard_Address)TheMin,
-                          (Standard_Address)TheMax,
-                          (Standard_Address)ShapMin,
-                          (Standard_Address)ShapMax);
+        HLRAlgo::DecodeMinMax(fd.Wires()->MinMax(), TheMin, TheMax);
+       HLRAlgo::AddMinMax(TheMin, TheMax, ShapMin, ShapMax);
       }
-      HLRAlgo::EncodeMinMax((Standard_Address)ShapMin,
-                           (Standard_Address)ShapMax,
-                           (Standard_Address)MinMaxShap);
-      SB.UpdateMinMax((Standard_Address)MinMaxShap);
+      HLRAlgo::EncodeMinMax(ShapMin, ShapMax, MinMaxShap);
+      SB.UpdateMinMax(MinMaxShap);
     }
   }
 }
@@ -676,24 +627,22 @@ void HLRBRep_InternalAlgo::Hide (const Standard_Integer I,
 
     if (I == J) Hide(I);
     else {
-      Standard_Integer* MinMaxShBI =
-       (Standard_Integer*)myShapes(I).MinMax();
-      Standard_Integer* MinMaxShBJ =
-       (Standard_Integer*)myShapes(J).MinMax();
-      if (((MaxShBJ1 - MinShBI1) & 0x80008000) == 0 &&
-         ((MaxShBI1 - MinShBJ1) & 0x80008000) == 0 &&
-         ((MaxShBJ2 - MinShBI2) & 0x80008000) == 0 &&
-         ((MaxShBI2 - MinShBJ2) & 0x80008000) == 0 &&
-         ((MaxShBJ3 - MinShBI3) & 0x80008000) == 0 &&
-         ((MaxShBI3 - MinShBJ3) & 0x80008000) == 0 &&
-         ((MaxShBJ4 - MinShBI4) & 0x80008000) == 0 &&
-         ((MaxShBI4 - MinShBJ4) & 0x80008000) == 0 &&
-         ((MaxShBJ5 - MinShBI5) & 0x80008000) == 0 &&
-         ((MaxShBI5 - MinShBJ5) & 0x80008000) == 0 &&
-         ((MaxShBJ6 - MinShBI6) & 0x80008000) == 0 &&
-         ((MaxShBI6 - MinShBJ6) & 0x80008000) == 0 &&
-         ((MaxShBJ7 - MinShBI7) & 0x80008000) == 0 &&
-         ((MaxShBJ8 - MinShBI8) & 0x80008000) == 0) {
+      HLRAlgo_EdgesBlock::MinMaxIndices* MinMaxShBI = &myShapes(I).MinMax();
+      HLRAlgo_EdgesBlock::MinMaxIndices* MinMaxShBJ = &myShapes(J).MinMax();
+      if (((MinMaxShBJ->Max[0] - MinMaxShBI->Min[0]) & 0x80008000) == 0 &&
+         ((MinMaxShBI->Max[0] - MinMaxShBJ->Min[0]) & 0x80008000) == 0 &&
+         ((MinMaxShBJ->Max[1] - MinMaxShBI->Min[1]) & 0x80008000) == 0 &&
+         ((MinMaxShBI->Max[1] - MinMaxShBJ->Min[1]) & 0x80008000) == 0 &&
+         ((MinMaxShBJ->Max[2] - MinMaxShBI->Min[2]) & 0x80008000) == 0 &&
+         ((MinMaxShBI->Max[2] - MinMaxShBJ->Min[2]) & 0x80008000) == 0 &&
+         ((MinMaxShBJ->Max[3] - MinMaxShBI->Min[3]) & 0x80008000) == 0 &&
+         ((MinMaxShBI->Max[3] - MinMaxShBJ->Min[3]) & 0x80008000) == 0 &&
+         ((MinMaxShBJ->Max[4] - MinMaxShBI->Min[4]) & 0x80008000) == 0 &&
+         ((MinMaxShBI->Max[4] - MinMaxShBJ->Min[4]) & 0x80008000) == 0 &&
+         ((MinMaxShBJ->Max[5] - MinMaxShBI->Min[5]) & 0x80008000) == 0 &&
+         ((MinMaxShBI->Max[5] - MinMaxShBJ->Min[5]) & 0x80008000) == 0 &&
+         ((MinMaxShBJ->Max[6] - MinMaxShBI->Min[6]) & 0x80008000) == 0 &&
+         ((MinMaxShBJ->Max[7] - MinMaxShBI->Min[7]) & 0x80008000) == 0) {
        if (myDebug) {
          cout << " hiding the shape " << I;
          cout << " by the shape : " << J << endl;
index bc18c7e..9abd175 100644 (file)
@@ -40,9 +40,9 @@
 #include <StdFail_UndefinedDerivative.hxx>
 
 #include <stdio.h>
-#define PERF 0
+//#define PERF
 
-#if PERF
+#ifdef PERF
 static Standard_Integer NbIntersCS=0;
 static Standard_Integer NbIntersCSVides=0;
 static Standard_Integer NbIntersAuto=0;
@@ -64,7 +64,7 @@ static Standard_Integer NbIntersSimulate=0;
 HLRBRep_Intersector::HLRBRep_Intersector () :
 myPolyhedron(NULL)
 {
-#if PERF
+#ifdef PERF
   if(NbInters) { 
     printf("\n--------------------------------------");
     printf("\nNbIntersSimulate  : %6d",NbIntersSimulate);
@@ -99,7 +99,7 @@ void  HLRBRep_Intersector::Perform (const Standard_Address A1,
                                    const Standard_Real da1,
                                    const Standard_Real db1)
 {
-#if PERF 
+#ifdef PERF
   NbIntersAuto++;
 #endif
 
@@ -361,7 +361,7 @@ void  HLRBRep_Intersector::Perform (const Standard_Integer /*nA*/,
 
   
   
-#if PERF
+#ifdef PERF
   NbInters++;
   if(myIntersector.NbPoints()==1) { 
     if(myIntersector.NbSegments()==0) { 
@@ -402,7 +402,7 @@ void  HLRBRep_Intersector::SimulateOnePoint(const Standard_Address A1,
                                            const Standard_Real    u,
                                            const Standard_Address A2,
                                            const Standard_Real    v) { 
-#if PERF
+#ifdef PERF
   NbIntersSimulate++;
 #endif
   Standard_Address myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
@@ -435,7 +435,7 @@ void  HLRBRep_Intersector::Load (Standard_Address& A)
 {
   mySurface = A;
   if (myPolyhedron != NULL) { 
-    delete (HLRBRep_ThePolyhedronOfInterCSurf*)myPolyhedron;
+    delete myPolyhedron;
     myPolyhedron = NULL;
   }
 }
@@ -469,13 +469,11 @@ void  HLRBRep_Intersector::Perform (const gp_Lin& L,
        v2   = HLRBRep_SurfaceTool::LastVParameter(mySurface);   
        nbsu = HLRBRep_SurfaceTool::NbSamplesU(mySurface,u1,u2);
        nbsv = HLRBRep_SurfaceTool::NbSamplesV(mySurface,v1,v2);
-       myPolyhedron = (Standard_Address)
-         (new HLRBRep_ThePolyhedronOfInterCSurf
-          (mySurface,nbsu,nbsv,u1,v1,u2,v2));
+       myPolyhedron =
+    new HLRBRep_ThePolyhedronOfInterCSurf(mySurface,nbsu,nbsv,u1,v1,u2,v2);
       }
       Standard_Real x0,y0,z0,x1,y1,z1,pmin,pmax;//,pp;
-      ((HLRBRep_ThePolyhedronOfInterCSurf*)myPolyhedron)
-       ->Bounding().Get(x0,y0,z0,x1,y1,z1);
+      myPolyhedron->Bounding().Get(x0,y0,z0,x1,y1,z1);
 #if 0
       pmax = pmin = ElCLib::Parameter(L, gp_Pnt((x1+x0)*0.5,
                                                (y1+y0)*0.5,
@@ -520,7 +518,7 @@ void  HLRBRep_Intersector::Perform (const gp_Lin& L,
 
     }
   }
-#if PERF
+#ifdef PERF
   NbIntersCS++;
   if(myCSIntersector.NbPoints()==0) { 
     NbIntersCSVides++;
@@ -631,7 +629,7 @@ HLRBRep_Intersector::CSSegment (const Standard_Integer N) const
 void HLRBRep_Intersector::Destroy ()
 {
   if (myPolyhedron != NULL)
-    delete (HLRBRep_ThePolyhedronOfInterCSurf *)myPolyhedron;
+    delete myPolyhedron;
 }
 
 
@@ -725,7 +723,7 @@ void  HLRBRep_Intersector::Perform (const Standard_Integer nA,
   
   
   
-#if PERF
+#ifdef PERF
   NbInters++;
   if(myIntersector.NbPoints()==1) { 
     if(myIntersector.NbSegments()==0) { 
index b22d535..b3a619e 100644 (file)
@@ -106,7 +106,7 @@ private:
   HLRBRep_CInter myIntersector;
   HLRBRep_InterCSurf myCSIntersector;
   Standard_Address mySurface;
-  Standard_Address myPolyhedron;
+  HLRBRep_ThePolyhedronOfInterCSurf* myPolyhedron;
 
 
 };
index 134b6c7..0e18833 100644 (file)
@@ -32,6 +32,7 @@
 #include <HLRAlgo_PolyAlgo.hxx>
 #include <HLRAlgo_PolyData.hxx>
 #include <HLRAlgo_PolyInternalData.hxx>
+#include <HLRAlgo_PolyMask.hxx>
 #include <HLRAlgo_PolyShellData.hxx>
 #include <HLRAlgo_Projector.hxx>
 #include <HLRBRep_PolyAlgo.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(HLRBRep_PolyAlgo,MMgt_TShared)
 
-#define EMskOutLin1  ((Standard_Integer)   1)
-#define EMskOutLin2  ((Standard_Integer)   2)
-#define EMskOutLin3  ((Standard_Integer)   4)
-#define EMskGrALin1  ((Standard_Integer)   8)
-#define EMskGrALin2  ((Standard_Integer)  16)
-#define EMskGrALin3  ((Standard_Integer)  32)
-#define FMskBack     ((Standard_Integer)  64)
-#define FMskSide     ((Standard_Integer) 128)
-#define FMskHiding   ((Standard_Integer) 256)
-#define FMskFlat     ((Standard_Integer) 512)
-#define FMskOnOutL   ((Standard_Integer)1024)
-#define FMskOrBack   ((Standard_Integer)2048)
-#define FMskFrBack   ((Standard_Integer)4096)
-
-#define NMskVert ((Standard_Integer) 1)
-#define NMskOutL ((Standard_Integer) 2)
-#define NMskNorm ((Standard_Integer) 4)
-#define NMskFuck ((Standard_Integer) 8)
-#define NMskEdge ((Standard_Integer)16)
-#define NMskMove ((Standard_Integer)32)
-
-#define PntXTI1 ((Standard_Real*)Coordinates)[ 0]
-#define PntYTI1 ((Standard_Real*)Coordinates)[ 1]
-#define PntZTI1 ((Standard_Real*)Coordinates)[ 2]
-#define PntXTI2 ((Standard_Real*)Coordinates)[ 3]
-#define PntYTI2 ((Standard_Real*)Coordinates)[ 4]
-#define PntZTI2 ((Standard_Real*)Coordinates)[ 5]
-#define PntX1   ((Standard_Real*)Coordinates)[ 6]
-#define PntY1   ((Standard_Real*)Coordinates)[ 7]
-#define PntZ1   ((Standard_Real*)Coordinates)[ 8]
-#define PntX2   ((Standard_Real*)Coordinates)[ 9]
-#define PntY2   ((Standard_Real*)Coordinates)[10]
-#define PntZ2   ((Standard_Real*)Coordinates)[11]
-
-#define Pn2XTI1 ((Standard_Real*)Coordinate2)[ 0]
-#define Pn2YTI1 ((Standard_Real*)Coordinate2)[ 1]
-#define Pn2ZTI1 ((Standard_Real*)Coordinate2)[ 2]
-#define Pn2XTI2 ((Standard_Real*)Coordinate2)[ 3]
-#define Pn2YTI2 ((Standard_Real*)Coordinate2)[ 4]
-#define Pn2ZTI2 ((Standard_Real*)Coordinate2)[ 5]
-#define Pn2X1   ((Standard_Real*)Coordinate2)[ 6]
-#define Pn2Y1   ((Standard_Real*)Coordinate2)[ 7]
-#define Pn2Z1   ((Standard_Real*)Coordinate2)[ 8]
-#define Pn2X2   ((Standard_Real*)Coordinate2)[ 9]
-#define Pn2Y2   ((Standard_Real*)Coordinate2)[10]
-#define Pn2Z2   ((Standard_Real*)Coordinate2)[11]
-
-#define Tri1Node1 ((Standard_Integer*)Tri1Indices)[0]
-#define Tri1Node2 ((Standard_Integer*)Tri1Indices)[1]
-#define Tri1Node3 ((Standard_Integer*)Tri1Indices)[2]
-#define Tri1Flags ((Standard_Integer*)Tri1Indices)[3]
-
-#define Tri2Node1 ((Standard_Integer*)Tri2Indices)[0]
-#define Tri2Node2 ((Standard_Integer*)Tri2Indices)[1]
-#define Tri2Node3 ((Standard_Integer*)Tri2Indices)[2]
-#define Tri2Flags ((Standard_Integer*)Tri2Indices)[3]
-
-#define Tri3Node1 ((Standard_Integer*)Tri3Indices)[0]
-#define Tri3Node2 ((Standard_Integer*)Tri3Indices)[1]
-#define Tri3Node3 ((Standard_Integer*)Tri3Indices)[2]
-#define Tri3Flags ((Standard_Integer*)Tri3Indices)[3]
-
-#define Seg1LstSg1 ((Standard_Integer*)Seg1Indices)[0]
-#define Seg1LstSg2 ((Standard_Integer*)Seg1Indices)[1]
-#define Seg1NxtSg1 ((Standard_Integer*)Seg1Indices)[2]
-#define Seg1NxtSg2 ((Standard_Integer*)Seg1Indices)[3]
-#define Seg1Conex1 ((Standard_Integer*)Seg1Indices)[4]
-#define Seg1Conex2 ((Standard_Integer*)Seg1Indices)[5]
-
-#define Seg2LstSg1 ((Standard_Integer*)Seg2Indices)[0]
-#define Seg2LstSg2 ((Standard_Integer*)Seg2Indices)[1]
-#define Seg2NxtSg1 ((Standard_Integer*)Seg2Indices)[2]
-#define Seg2NxtSg2 ((Standard_Integer*)Seg2Indices)[3]
-#define Seg2Conex1 ((Standard_Integer*)Seg2Indices)[4]
-#define Seg2Conex2 ((Standard_Integer*)Seg2Indices)[5]
-
-#define Nod1NdSg ((Standard_Integer*)Nod1Indices)[0]
-#define Nod1Flag ((Standard_Integer*)Nod1Indices)[1]
-#define Nod1Edg1 ((Standard_Integer*)Nod1Indices)[2]
-#define Nod1Edg2 ((Standard_Integer*)Nod1Indices)[3]
-
-#define Nod1PntX ((Standard_Real*)Nod1RValues)[ 0]
-#define Nod1PntY ((Standard_Real*)Nod1RValues)[ 1]
-#define Nod1PntZ ((Standard_Real*)Nod1RValues)[ 2]
-#define Nod1PntU ((Standard_Real*)Nod1RValues)[ 3]
-#define Nod1PntV ((Standard_Real*)Nod1RValues)[ 4]
-#define Nod1NrmX ((Standard_Real*)Nod1RValues)[ 5]
-#define Nod1NrmY ((Standard_Real*)Nod1RValues)[ 6]
-#define Nod1NrmZ ((Standard_Real*)Nod1RValues)[ 7]
-#define Nod1PCu1 ((Standard_Real*)Nod1RValues)[ 8]
-#define Nod1PCu2 ((Standard_Real*)Nod1RValues)[ 9]
-#define Nod1Scal ((Standard_Real*)Nod1RValues)[10]
-
-#define NodANdSg ((Standard_Integer*)NodAIndices)[0]
-#define NodAFlag ((Standard_Integer*)NodAIndices)[1]
-#define NodAEdg1 ((Standard_Integer*)NodAIndices)[2]
-#define NodAEdg2 ((Standard_Integer*)NodAIndices)[3]
-
-#define NodAPntX ((Standard_Real*)NodARValues)[ 0]
-#define NodAPntY ((Standard_Real*)NodARValues)[ 1]
-#define NodAPntZ ((Standard_Real*)NodARValues)[ 2]
-#define NodAPntU ((Standard_Real*)NodARValues)[ 3]
-#define NodAPntV ((Standard_Real*)NodARValues)[ 4]
-#define NodANrmX ((Standard_Real*)NodARValues)[ 5]
-#define NodANrmY ((Standard_Real*)NodARValues)[ 6]
-#define NodANrmZ ((Standard_Real*)NodARValues)[ 7]
-#define NodAPCu1 ((Standard_Real*)NodARValues)[ 8]
-#define NodAPCu2 ((Standard_Real*)NodARValues)[ 9]
-#define NodAScal ((Standard_Real*)NodARValues)[10]
-
-#define NodBNdSg ((Standard_Integer*)NodBIndices)[0]
-#define NodBFlag ((Standard_Integer*)NodBIndices)[1]
-#define NodBEdg1 ((Standard_Integer*)NodBIndices)[2]
-#define NodBEdg2 ((Standard_Integer*)NodBIndices)[3]
-
-#define NodBPntX ((Standard_Real*)NodBRValues)[ 0]
-#define NodBPntY ((Standard_Real*)NodBRValues)[ 1]
-#define NodBPntZ ((Standard_Real*)NodBRValues)[ 2]
-#define NodBPntU ((Standard_Real*)NodBRValues)[ 3]
-#define NodBPntV ((Standard_Real*)NodBRValues)[ 4]
-#define NodBNrmX ((Standard_Real*)NodBRValues)[ 5]
-#define NodBNrmY ((Standard_Real*)NodBRValues)[ 6]
-#define NodBNrmZ ((Standard_Real*)NodBRValues)[ 7]
-#define NodBPCu1 ((Standard_Real*)NodBRValues)[ 8]
-#define NodBPCu2 ((Standard_Real*)NodBRValues)[ 9]
-#define NodBScal ((Standard_Real*)NodBRValues)[10]
-
-#define Nod2NdSg ((Standard_Integer*)Nod2Indices)[0]
-#define Nod2Flag ((Standard_Integer*)Nod2Indices)[1]
-#define Nod2Edg1 ((Standard_Integer*)Nod2Indices)[2]
-#define Nod2Edg2 ((Standard_Integer*)Nod2Indices)[3]
-
-#define Nod2PntX ((Standard_Real*)Nod2RValues)[ 0]
-#define Nod2PntY ((Standard_Real*)Nod2RValues)[ 1]
-#define Nod2PntZ ((Standard_Real*)Nod2RValues)[ 2]
-#define Nod2PntU ((Standard_Real*)Nod2RValues)[ 3]
-#define Nod2PntV ((Standard_Real*)Nod2RValues)[ 4]
-#define Nod2NrmX ((Standard_Real*)Nod2RValues)[ 5]
-#define Nod2NrmY ((Standard_Real*)Nod2RValues)[ 6]
-#define Nod2NrmZ ((Standard_Real*)Nod2RValues)[ 7]
-#define Nod2PCu1 ((Standard_Real*)Nod2RValues)[ 8]
-#define Nod2PCu2 ((Standard_Real*)Nod2RValues)[ 9]
-#define Nod2Scal ((Standard_Real*)Nod2RValues)[10]
-
-#define Nod3NdSg ((Standard_Integer*)Nod3Indices)[0]
-#define Nod3Flag ((Standard_Integer*)Nod3Indices)[1]
-#define Nod3Edg1 ((Standard_Integer*)Nod3Indices)[2]
-#define Nod3Edg2 ((Standard_Integer*)Nod3Indices)[3]
-
-#define Nod3PntX ((Standard_Real*)Nod3RValues)[ 0]
-#define Nod3PntY ((Standard_Real*)Nod3RValues)[ 1]
-#define Nod3PntZ ((Standard_Real*)Nod3RValues)[ 2]
-#define Nod3PntU ((Standard_Real*)Nod3RValues)[ 3]
-#define Nod3PntV ((Standard_Real*)Nod3RValues)[ 4]
-#define Nod3NrmX ((Standard_Real*)Nod3RValues)[ 5]
-#define Nod3NrmY ((Standard_Real*)Nod3RValues)[ 6]
-#define Nod3NrmZ ((Standard_Real*)Nod3RValues)[ 7]
-#define Nod3PCu1 ((Standard_Real*)Nod3RValues)[ 8]
-#define Nod3PCu2 ((Standard_Real*)Nod3RValues)[ 9]
-#define Nod3Scal ((Standard_Real*)Nod3RValues)[10]
-
-#define Nod4NdSg ((Standard_Integer*)Nod4Indices)[0]
-#define Nod4Flag ((Standard_Integer*)Nod4Indices)[1]
-#define Nod4Edg1 ((Standard_Integer*)Nod4Indices)[2]
-#define Nod4Edg2 ((Standard_Integer*)Nod4Indices)[3]
-
-#define Nod4PntX ((Standard_Real*)Nod4RValues)[ 0]
-#define Nod4PntY ((Standard_Real*)Nod4RValues)[ 1]
-#define Nod4PntZ ((Standard_Real*)Nod4RValues)[ 2]
-#define Nod4PntU ((Standard_Real*)Nod4RValues)[ 3]
-#define Nod4PntV ((Standard_Real*)Nod4RValues)[ 4]
-#define Nod4NrmX ((Standard_Real*)Nod4RValues)[ 5]
-#define Nod4NrmY ((Standard_Real*)Nod4RValues)[ 6]
-#define Nod4NrmZ ((Standard_Real*)Nod4RValues)[ 7]
-#define Nod4PCu1 ((Standard_Real*)Nod4RValues)[ 8]
-#define Nod4PCu2 ((Standard_Real*)Nod4RValues)[ 9]
-#define Nod4Scal ((Standard_Real*)Nod4RValues)[10]
-
-#define Nod11NdSg ((Standard_Integer*)Nod11Indices)[0]
-#define Nod11Flag ((Standard_Integer*)Nod11Indices)[1]
-#define Nod11Edg1 ((Standard_Integer*)Nod11Indices)[2]
-#define Nod11Edg2 ((Standard_Integer*)Nod11Indices)[3]
-
-#define Nod11PntX ((Standard_Real*)Nod11RValues)[ 0]
-#define Nod11PntY ((Standard_Real*)Nod11RValues)[ 1]
-#define Nod11PntZ ((Standard_Real*)Nod11RValues)[ 2]
-#define Nod11PntU ((Standard_Real*)Nod11RValues)[ 3]
-#define Nod11PntV ((Standard_Real*)Nod11RValues)[ 4]
-#define Nod11NrmX ((Standard_Real*)Nod11RValues)[ 5]
-#define Nod11NrmY ((Standard_Real*)Nod11RValues)[ 6]
-#define Nod11NrmZ ((Standard_Real*)Nod11RValues)[ 7]
-#define Nod11PCu1 ((Standard_Real*)Nod11RValues)[ 8]
-#define Nod11PCu2 ((Standard_Real*)Nod11RValues)[ 9]
-#define Nod11Scal ((Standard_Real*)Nod11RValues)[10]
-
-#define Nod1ANdSg ((Standard_Integer*)Nod1AIndices)[0]
-#define Nod1AFlag ((Standard_Integer*)Nod1AIndices)[1]
-#define Nod1AEdg1 ((Standard_Integer*)Nod1AIndices)[2]
-#define Nod1AEdg2 ((Standard_Integer*)Nod1AIndices)[3]
-
-#define Nod1APntX ((Standard_Real*)Nod1ARValues)[ 0]
-#define Nod1APntY ((Standard_Real*)Nod1ARValues)[ 1]
-#define Nod1APntZ ((Standard_Real*)Nod1ARValues)[ 2]
-#define Nod1APntU ((Standard_Real*)Nod1ARValues)[ 3]
-#define Nod1APntV ((Standard_Real*)Nod1ARValues)[ 4]
-#define Nod1ANrmX ((Standard_Real*)Nod1ARValues)[ 5]
-#define Nod1ANrmY ((Standard_Real*)Nod1ARValues)[ 6]
-#define Nod1ANrmZ ((Standard_Real*)Nod1ARValues)[ 7]
-#define Nod1APCu1 ((Standard_Real*)Nod1ARValues)[ 8]
-#define Nod1APCu2 ((Standard_Real*)Nod1ARValues)[ 9]
-#define Nod1AScal ((Standard_Real*)Nod1ARValues)[10]
-
-#define Nod1BNdSg ((Standard_Integer*)Nod1BIndices)[0]
-#define Nod1BFlag ((Standard_Integer*)Nod1BIndices)[1]
-#define Nod1BEdg1 ((Standard_Integer*)Nod1BIndices)[2]
-#define Nod1BEdg2 ((Standard_Integer*)Nod1BIndices)[3]
-
-#define Nod1BPntX ((Standard_Real*)Nod1BRValues)[ 0]
-#define Nod1BPntY ((Standard_Real*)Nod1BRValues)[ 1]
-#define Nod1BPntZ ((Standard_Real*)Nod1BRValues)[ 2]
-#define Nod1BPntU ((Standard_Real*)Nod1BRValues)[ 3]
-#define Nod1BPntV ((Standard_Real*)Nod1BRValues)[ 4]
-#define Nod1BNrmX ((Standard_Real*)Nod1BRValues)[ 5]
-#define Nod1BNrmY ((Standard_Real*)Nod1BRValues)[ 6]
-#define Nod1BNrmZ ((Standard_Real*)Nod1BRValues)[ 7]
-#define Nod1BPCu1 ((Standard_Real*)Nod1BRValues)[ 8]
-#define Nod1BPCu2 ((Standard_Real*)Nod1BRValues)[ 9]
-#define Nod1BScal ((Standard_Real*)Nod1BRValues)[10]
-
-#define Nod12NdSg ((Standard_Integer*)Nod12Indices)[0]
-#define Nod12Flag ((Standard_Integer*)Nod12Indices)[1]
-#define Nod12Edg1 ((Standard_Integer*)Nod12Indices)[2]
-#define Nod12Edg2 ((Standard_Integer*)Nod12Indices)[3]
-
-#define Nod12PntX ((Standard_Real*)Nod12RValues)[ 0]
-#define Nod12PntY ((Standard_Real*)Nod12RValues)[ 1]
-#define Nod12PntZ ((Standard_Real*)Nod12RValues)[ 2]
-#define Nod12PntU ((Standard_Real*)Nod12RValues)[ 3]
-#define Nod12PntV ((Standard_Real*)Nod12RValues)[ 4]
-#define Nod12NrmX ((Standard_Real*)Nod12RValues)[ 5]
-#define Nod12NrmY ((Standard_Real*)Nod12RValues)[ 6]
-#define Nod12NrmZ ((Standard_Real*)Nod12RValues)[ 7]
-#define Nod12PCu1 ((Standard_Real*)Nod12RValues)[ 8]
-#define Nod12PCu2 ((Standard_Real*)Nod12RValues)[ 9]
-#define Nod12Scal ((Standard_Real*)Nod12RValues)[10]
-
-#define Nod13NdSg ((Standard_Integer*)Nod13Indices)[0]
-#define Nod13Flag ((Standard_Integer*)Nod13Indices)[1]
-#define Nod13Edg1 ((Standard_Integer*)Nod13Indices)[2]
-#define Nod13Edg2 ((Standard_Integer*)Nod13Indices)[3]
-
-#define Nod13PntX ((Standard_Real*)Nod13RValues)[ 0]
-#define Nod13PntY ((Standard_Real*)Nod13RValues)[ 1]
-#define Nod13PntZ ((Standard_Real*)Nod13RValues)[ 2]
-#define Nod13PntU ((Standard_Real*)Nod13RValues)[ 3]
-#define Nod13PntV ((Standard_Real*)Nod13RValues)[ 4]
-#define Nod13NrmX ((Standard_Real*)Nod13RValues)[ 5]
-#define Nod13NrmY ((Standard_Real*)Nod13RValues)[ 6]
-#define Nod13NrmZ ((Standard_Real*)Nod13RValues)[ 7]
-#define Nod13PCu1 ((Standard_Real*)Nod13RValues)[ 8]
-#define Nod13PCu2 ((Standard_Real*)Nod13RValues)[ 9]
-#define Nod13Scal ((Standard_Real*)Nod13RValues)[10]
-
-#define Nod14NdSg ((Standard_Integer*)Nod14Indices)[0]
-#define Nod14Flag ((Standard_Integer*)Nod14Indices)[1]
-#define Nod14Edg1 ((Standard_Integer*)Nod14Indices)[2]
-#define Nod14Edg2 ((Standard_Integer*)Nod14Indices)[3]
-
-#define Nod14PntX ((Standard_Real*)Nod14RValues)[ 0]
-#define Nod14PntY ((Standard_Real*)Nod14RValues)[ 1]
-#define Nod14PntZ ((Standard_Real*)Nod14RValues)[ 2]
-#define Nod14PntU ((Standard_Real*)Nod14RValues)[ 3]
-#define Nod14PntV ((Standard_Real*)Nod14RValues)[ 4]
-#define Nod14NrmX ((Standard_Real*)Nod14RValues)[ 5]
-#define Nod14NrmY ((Standard_Real*)Nod14RValues)[ 6]
-#define Nod14NrmZ ((Standard_Real*)Nod14RValues)[ 7]
-#define Nod14PCu1 ((Standard_Real*)Nod14RValues)[ 8]
-#define Nod14PCu2 ((Standard_Real*)Nod14RValues)[ 9]
-#define Nod14Scal ((Standard_Real*)Nod14RValues)[10]
-
-#define Nod21NdSg ((Standard_Integer*)Nod21Indices)[0]
-#define Nod21Flag ((Standard_Integer*)Nod21Indices)[1]
-#define Nod21Edg1 ((Standard_Integer*)Nod21Indices)[2]
-#define Nod21Edg2 ((Standard_Integer*)Nod21Indices)[3]
-
-#define Nod21PntX ((Standard_Real*)Nod21RValues)[ 0]
-#define Nod21PntY ((Standard_Real*)Nod21RValues)[ 1]
-#define Nod21PntZ ((Standard_Real*)Nod21RValues)[ 2]
-#define Nod21PntU ((Standard_Real*)Nod21RValues)[ 3]
-#define Nod21PntV ((Standard_Real*)Nod21RValues)[ 4]
-#define Nod21NrmX ((Standard_Real*)Nod21RValues)[ 5]
-#define Nod21NrmY ((Standard_Real*)Nod21RValues)[ 6]
-#define Nod21NrmZ ((Standard_Real*)Nod21RValues)[ 7]
-#define Nod21PCu1 ((Standard_Real*)Nod21RValues)[ 8]
-#define Nod21PCu2 ((Standard_Real*)Nod21RValues)[ 9]
-#define Nod21Scal ((Standard_Real*)Nod21RValues)[10]
-
-#define Nod2ANdSg ((Standard_Integer*)Nod2AIndices)[0]
-#define Nod2AFlag ((Standard_Integer*)Nod2AIndices)[1]
-#define Nod2AEdg1 ((Standard_Integer*)Nod2AIndices)[2]
-#define Nod2AEdg2 ((Standard_Integer*)Nod2AIndices)[3]
-
-#define Nod2APntX ((Standard_Real*)Nod2ARValues)[ 0]
-#define Nod2APntY ((Standard_Real*)Nod2ARValues)[ 1]
-#define Nod2APntZ ((Standard_Real*)Nod2ARValues)[ 2]
-#define Nod2APntU ((Standard_Real*)Nod2ARValues)[ 3]
-#define Nod2APntV ((Standard_Real*)Nod2ARValues)[ 4]
-#define Nod2ANrmX ((Standard_Real*)Nod2ARValues)[ 5]
-#define Nod2ANrmY ((Standard_Real*)Nod2ARValues)[ 6]
-#define Nod2ANrmZ ((Standard_Real*)Nod2ARValues)[ 7]
-#define Nod2APCu1 ((Standard_Real*)Nod2ARValues)[ 8]
-#define Nod2APCu2 ((Standard_Real*)Nod2ARValues)[ 9]
-#define Nod2AScal ((Standard_Real*)Nod2ARValues)[10]
-
-#define Nod2BNdSg ((Standard_Integer*)Nod2BIndices)[0]
-#define Nod2BFlag ((Standard_Integer*)Nod2BIndices)[1]
-#define Nod2BEdg1 ((Standard_Integer*)Nod2BIndices)[2]
-#define Nod2BEdg2 ((Standard_Integer*)Nod2BIndices)[3]
-
-#define Nod2BPntX ((Standard_Real*)Nod2BRValues)[ 0]
-#define Nod2BPntY ((Standard_Real*)Nod2BRValues)[ 1]
-#define Nod2BPntZ ((Standard_Real*)Nod2BRValues)[ 2]
-#define Nod2BPntU ((Standard_Real*)Nod2BRValues)[ 3]
-#define Nod2BPntV ((Standard_Real*)Nod2BRValues)[ 4]
-#define Nod2BNrmX ((Standard_Real*)Nod2BRValues)[ 5]
-#define Nod2BNrmY ((Standard_Real*)Nod2BRValues)[ 6]
-#define Nod2BNrmZ ((Standard_Real*)Nod2BRValues)[ 7]
-#define Nod2BPCu1 ((Standard_Real*)Nod2BRValues)[ 8]
-#define Nod2BPCu2 ((Standard_Real*)Nod2BRValues)[ 9]
-#define Nod2BScal ((Standard_Real*)Nod2BRValues)[10]
-
-#define Nod22NdSg ((Standard_Integer*)Nod22Indices)[0]
-#define Nod22Flag ((Standard_Integer*)Nod22Indices)[1]
-#define Nod22Edg1 ((Standard_Integer*)Nod22Indices)[2]
-#define Nod22Edg2 ((Standard_Integer*)Nod22Indices)[3]
-
-#define Nod22PntX ((Standard_Real*)Nod22RValues)[ 0]
-#define Nod22PntY ((Standard_Real*)Nod22RValues)[ 1]
-#define Nod22PntZ ((Standard_Real*)Nod22RValues)[ 2]
-#define Nod22PntU ((Standard_Real*)Nod22RValues)[ 3]
-#define Nod22PntV ((Standard_Real*)Nod22RValues)[ 4]
-#define Nod22NrmX ((Standard_Real*)Nod22RValues)[ 5]
-#define Nod22NrmY ((Standard_Real*)Nod22RValues)[ 6]
-#define Nod22NrmZ ((Standard_Real*)Nod22RValues)[ 7]
-#define Nod22PCu1 ((Standard_Real*)Nod22RValues)[ 8]
-#define Nod22PCu2 ((Standard_Real*)Nod22RValues)[ 9]
-#define Nod22Scal ((Standard_Real*)Nod22RValues)[10]
-
-#define Nod23NdSg ((Standard_Integer*)Nod23Indices)[0]
-#define Nod23Flag ((Standard_Integer*)Nod23Indices)[1]
-#define Nod23Edg1 ((Standard_Integer*)Nod23Indices)[2]
-#define Nod23Edg2 ((Standard_Integer*)Nod23Indices)[3]
-
-#define Nod23PntX ((Standard_Real*)Nod23RValues)[ 0]
-#define Nod23PntY ((Standard_Real*)Nod23RValues)[ 1]
-#define Nod23PntZ ((Standard_Real*)Nod23RValues)[ 2]
-#define Nod23PntU ((Standard_Real*)Nod23RValues)[ 3]
-#define Nod23PntV ((Standard_Real*)Nod23RValues)[ 4]
-#define Nod23NrmX ((Standard_Real*)Nod23RValues)[ 5]
-#define Nod23NrmY ((Standard_Real*)Nod23RValues)[ 6]
-#define Nod23NrmZ ((Standard_Real*)Nod23RValues)[ 7]
-#define Nod23PCu1 ((Standard_Real*)Nod23RValues)[ 8]
-#define Nod23PCu2 ((Standard_Real*)Nod23RValues)[ 9]
-#define Nod23Scal ((Standard_Real*)Nod23RValues)[10]
-
-#define Nod24NdSg ((Standard_Integer*)Nod24Indices)[0]
-#define Nod24Flag ((Standard_Integer*)Nod24Indices)[1]
-#define Nod24Edg1 ((Standard_Integer*)Nod24Indices)[2]
-#define Nod24Edg2 ((Standard_Integer*)Nod24Indices)[3]
-
-#define Nod24PntX ((Standard_Real*)Nod24RValues)[ 0]
-#define Nod24PntY ((Standard_Real*)Nod24RValues)[ 1]
-#define Nod24PntZ ((Standard_Real*)Nod24RValues)[ 2]
-#define Nod24PntU ((Standard_Real*)Nod24RValues)[ 3]
-#define Nod24PntV ((Standard_Real*)Nod24RValues)[ 4]
-#define Nod24NrmX ((Standard_Real*)Nod24RValues)[ 5]
-#define Nod24NrmY ((Standard_Real*)Nod24RValues)[ 6]
-#define Nod24NrmZ ((Standard_Real*)Nod24RValues)[ 7]
-#define Nod24PCu1 ((Standard_Real*)Nod24RValues)[ 8]
-#define Nod24PCu2 ((Standard_Real*)Nod24RValues)[ 9]
-#define Nod24Scal ((Standard_Real*)Nod24RValues)[10]
-
-#define ShapeIndex ((Standard_Integer*)IndexPtr)[0]
-#define F1Index    ((Standard_Integer*)IndexPtr)[1]
-#define F1Pt1Index ((Standard_Integer*)IndexPtr)[2]
-#define F1Pt2Index ((Standard_Integer*)IndexPtr)[3]
-#define F2Index    ((Standard_Integer*)IndexPtr)[4]
-#define F2Pt1Index ((Standard_Integer*)IndexPtr)[5]
-#define F2Pt2Index ((Standard_Integer*)IndexPtr)[6]
-#define MinSeg     ((Standard_Integer*)IndexPtr)[7]
-#define MaxSeg     ((Standard_Integer*)IndexPtr)[8]
-#define SegFlags   ((Standard_Integer*)IndexPtr)[9]
+enum
+{
+  NMsk_Vert =  1,
+  NMsk_OutL =  2,
+  NMsk_Norm =  4,
+  NMsk_Fuck =  8,
+  NMsk_Edge = 16,
+  NMsk_Move = 32
+};
+
 #ifdef OCCT_DEBUG
 static Standard_Integer DoTrace = Standard_False; 
 static Standard_Integer DoError = Standard_False; 
@@ -826,39 +445,34 @@ void HLRBRep_PolyAlgo::StoreShell (const TopoDS_Shape& Shape,
            S = Handle(Geom_RectangularTrimmedSurface)::DownCast(S)->BasisSurface();
          GeomAdaptor_Surface AS(S);
          pid->Planar(AS.GetType() == GeomAbs_Plane);
-         Standard_Address TData = &pid->TData();
-         Standard_Address PISeg = &pid->PISeg();
-         Standard_Address PINod = &pid->PINod();
+         HLRAlgo_Array1OfTData* TData = &pid->TData();
+         HLRAlgo_Array1OfPISeg* PISeg = &pid->PISeg();
+         HLRAlgo_Array1OfPINod* PINod = &pid->PINod();
          Poly_Triangle       * OT = &(Tri.ChangeValue(1));
-         HLRAlgo_TriangleData* NT =
-           &(((HLRAlgo_Array1OfTData*)TData)->ChangeValue(1));
+         HLRAlgo_TriangleData* NT = &TData->ChangeValue(1);
 
          for (i = 1; i <= nbT; i++) {
-           Standard_Address Tri2Indices = NT->Indices();
-           OT->Get(Tri2Node1,Tri2Node2,Tri2Node3);
-           Tri2Flags = 0;
+           OT->Get(NT->Node1, NT->Node2, NT->Node3);
+           NT->Flags = 0;
            if (reversed) {
-             j         = Tri2Node1;
-             Tri2Node1 = Tri2Node3;
-             Tri2Node3 = j;
+             j         = NT->Node1;
+             NT->Node1 = NT->Node3;
+             NT->Node3 = j;
            }
            OT++;
            NT++;
          }
 
          gp_Pnt                          * ON = &(Nod.ChangeValue(1));
-         Handle(HLRAlgo_PolyInternalNode)* NN = 
-           &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(1));
+         Handle(HLRAlgo_PolyInternalNode)* NN = &PINod->ChangeValue(1);
 
          for (i = 1; i <= nbN; i++) {
-           const Standard_Address Nod1RValues = (*NN)->RValues();
-           const Standard_Address Nod1Indices = (*NN)->Indices();
-           Nod1NdSg = 0;
-           Nod1Flag = 0;
-           Nod1PntX = ON->X();
-           Nod1PntY = ON->Y();
-           Nod1PntZ = ON->Z();
-           TTMultiply(Nod1PntX,Nod1PntY,Nod1PntZ);
+           HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*NN)->Data();
+           HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices = (*NN)->Indices();
+           aNodIndices.NdSg = 0;
+           aNodIndices.Flag = 0;
+      Nod1RValues.Point = ON->Coord();
+           TTMultiply(Nod1RValues.Point);
            ON++;
            NN++;
          }
@@ -871,16 +485,15 @@ void HLRBRep_PolyAlgo::StoreShell (const TopoDS_Shape& Shape,
                               ChangeValue(1));
            
            for (i = 1; i <= nbN; i++) {
-             const Standard_Address Nod1Indices = (*NN)->Indices();
-             const Standard_Address Nod1RValues = (*NN)->RValues();
-             Nod1PntU = OUVN->X();
-             Nod1PntV = OUVN->Y();
-             if (Normal(i,Nod1Indices,Nod1RValues,
+             HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices = (*NN)->Indices();
+             HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*NN)->Data();
+        Nod1RValues.UV = OUVN->Coord();
+             if (Normal(i,aNodIndices,Nod1RValues,
                         TData,PISeg,PINod,Standard_False))
-               Nod1Flag |=  NMskNorm;
+               aNodIndices.Flag |=  NMsk_Norm;
              else {
-               Nod1Flag &= ~NMskNorm;
-               Nod1Scal = 0;
+               aNodIndices.Flag &= ~NMsk_Norm;
+               Nod1RValues.Scal = 0;
              }
              OUVN++;
              NN++;
@@ -895,23 +508,19 @@ void HLRBRep_PolyAlgo::StoreShell (const TopoDS_Shape& Shape,
          NT = &(((HLRAlgo_Array1OfTData*)TData)->ChangeValue(1));
 
          for (i = 1; i <= nbT; i++) {
-           const Standard_Address Tri1Indices = NT->Indices();
            const Handle(HLRAlgo_PolyInternalNode)* PN1 = 
-             &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node1));
+        &PINod->ChangeValue(NT->Node1);
            const Handle(HLRAlgo_PolyInternalNode)* PN2 = 
-             &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node2));
+        &PINod->ChangeValue(NT->Node2);
            const Handle(HLRAlgo_PolyInternalNode)* PN3 = 
-             &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node3));
-           const Standard_Address Nod1Indices = (*PN1)->Indices();
-           const Standard_Address Nod2Indices = (*PN2)->Indices();
-           const Standard_Address Nod3Indices = (*PN3)->Indices();
-           const Standard_Address Nod1RValues = (*PN1)->RValues();
-           const Standard_Address Nod2RValues = (*PN2)->RValues();
-           const Standard_Address Nod3RValues = (*PN3)->RValues();
-           OrientTriangle(i,Tri1Indices,
-                          Nod1Indices,Nod1RValues,
-                          Nod2Indices,Nod2RValues,
-                          Nod3Indices,Nod3RValues);
+        &PINod->ChangeValue(NT->Node3);
+           HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*PN1)->Data();
+           HLRAlgo_PolyInternalNode::NodeData& Nod2RValues = (*PN2)->Data();
+           HLRAlgo_PolyInternalNode::NodeData& Nod3RValues = (*PN3)->Data();
+           OrientTriangle(i,*NT,
+                          (*PN1)->Indices(),Nod1RValues,
+                          (*PN2)->Indices(),Nod2RValues,
+                          (*PN3)->Indices(),Nod3RValues);
            NT++;
          }
        }
@@ -992,11 +601,11 @@ void HLRBRep_PolyAlgo::StoreShell (const TopoDS_Shape& Shape,
 
 Standard_Boolean HLRBRep_PolyAlgo::
 Normal (const Standard_Integer iNode,
-       const Standard_Address Nod1Indices,
-       const Standard_Address Nod1RValues,
-        Standard_Address& TData,
-        Standard_Address& PISeg,
-        Standard_Address& PINod,
+       HLRAlgo_PolyInternalNode::NodeIndices& theNodIndices,
+       HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
+        HLRAlgo_Array1OfTData*& TData,
+        HLRAlgo_Array1OfPISeg*& PISeg,
+        HLRAlgo_Array1OfPINod*& PINod,
         const Standard_Boolean orient) const
 {
   gp_Vec D1U,D1V,D2U,D2V,D2UV;
@@ -1005,11 +614,11 @@ Normal (const Standard_Integer iNode,
   Standard_Boolean OK;
   CSLib_DerivativeStatus Status;
   CSLib_NormalStatus NStat;
-  myBSurf.D1(Nod1PntU,Nod1PntV,P,D1U,D1V);
+  myBSurf.D1(Nod1RValues.UV.X(), Nod1RValues.UV.Y(), P, D1U, D1V);
   CSLib::Normal(D1U,D1V,Standard_Real(Precision::Angular()),
                Status,Norma);
   if (Status != CSLib_Done) {
-    myBSurf.D2(Nod1PntU,Nod1PntV,P,D1U,D1V,D2U,D2V,D2UV);
+    myBSurf.D2(Nod1RValues.UV.X(), Nod1RValues.UV.Y(), P, D1U, D1V, D2U, D2V, D2UV);
     CSLib::Normal(D1U,D1V,D2U,D2V,D2UV,
                  Precision::Angular(),OK,NStat,Norma);
     if (!OK)
@@ -1019,9 +628,9 @@ Normal (const Standard_Integer iNode,
   Standard_Real EyeY =  0;
   Standard_Real EyeZ = -1;
   if (myProj.Perspective()) {
-    EyeX = Nod1PntX;
-    EyeY = Nod1PntY;
-    EyeZ = Nod1PntZ - myProj.Focus();
+    EyeX = Nod1RValues.Point.X();
+    EyeY = Nod1RValues.Point.Y();
+    EyeZ = Nod1RValues.Point.Z() - myProj.Focus();
     Standard_Real d = sqrt(EyeX * EyeX + EyeY * EyeY + EyeZ * EyeZ);
     if (d > 0) {
       EyeX /= d;
@@ -1029,31 +638,22 @@ Normal (const Standard_Integer iNode,
       EyeZ /= d;
     }
   }
-  Nod1NrmX = Norma.X();
-  Nod1NrmY = Norma.Y();
-  Nod1NrmZ = Norma.Z();
+  Nod1RValues.Normal = Norma.XYZ();
 //  TMultiply(Nod1NrmX,Nod1NrmY,Nod1NrmZ);
-  TMultiply(Nod1NrmX,Nod1NrmY,Nod1NrmZ,myProj.Perspective()); //OCC349
-  Standard_Real NormX,NormY,NormZ;
+  TMultiply(Nod1RValues.Normal,myProj.Perspective()); //OCC349
+  gp_XYZ Norm;
   
-  if (AverageNormal(iNode,Nod1Indices,TData,PISeg,PINod,
-                   NormX,NormY,NormZ)) {
-    if (Nod1NrmX * NormX +
-       Nod1NrmY * NormY +
-       Nod1NrmZ * NormZ < 0) {
-      Nod1NrmX = -Nod1NrmX;
-      Nod1NrmY = -Nod1NrmY;
-      Nod1NrmZ = -Nod1NrmZ;
+  if (AverageNormal(iNode,theNodIndices,TData,PISeg,PINod,Norm))
+  {
+    if (Nod1RValues.Normal * Norm < 0)
+    {
+      Nod1RValues.Normal.Reverse();
     }
-    Nod1Scal = (Nod1NrmX * EyeX +
-               Nod1NrmY * EyeY +
-               Nod1NrmZ * EyeZ);
+    Nod1RValues.Scal = (Nod1RValues.Normal * gp_XYZ(EyeX, EyeY, EyeZ));
   }
   else {
-    Nod1Scal = 0;
-    Nod1NrmX = 1;
-    Nod1NrmY = 0;
-    Nod1NrmZ = 0;
+    Nod1RValues.Scal = 0;
+    Nod1RValues.Normal = gp_XYZ(1., 0., 0.);
 #ifdef OCCT_DEBUG
     if (DoError) {
       cout << "HLRBRep_PolyAlgo::Normal : AverageNormal error";
@@ -1061,19 +661,19 @@ Normal (const Standard_Integer iNode,
     }
 #endif
   }
-  if (Nod1Scal > 0) {
-    if ( Nod1Scal < myTolAngular) {
-      Nod1Scal  = 0;
-      Nod1Flag |= NMskOutL;
+  if (Nod1RValues.Scal > 0) {
+    if ( Nod1RValues.Scal < myTolAngular) {
+      Nod1RValues.Scal  = 0;
+      theNodIndices.Flag |= NMsk_OutL;
     }
   }
   else {
-    if (-Nod1Scal < myTolAngular) {
-      Nod1Scal  = 0;
-      Nod1Flag |= NMskOutL;
+    if (-Nod1RValues.Scal < myTolAngular) {
+      Nod1RValues.Scal  = 0;
+      theNodIndices.Flag |= NMsk_OutL;
     }
   }
-  if (orient) UpdateAroundNode(iNode,Nod1Indices,
+  if (orient) UpdateAroundNode(iNode,theNodIndices,
                               TData,PISeg,PINod);
   return Standard_True;
 }
@@ -1085,10 +685,10 @@ Normal (const Standard_Integer iNode,
 
 Standard_Boolean
 HLRBRep_PolyAlgo::AverageNormal(const Standard_Integer iNode,
-                               const Standard_Address Nod1Indices,
-                               Standard_Address& TData,
-                               Standard_Address& PISeg,
-                               Standard_Address& PINod,
+                               HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices,
+                               HLRAlgo_Array1OfTData*& TData,
+                               HLRAlgo_Array1OfPISeg*& PISeg,
+                               HLRAlgo_Array1OfPINod*& PINod,
                                Standard_Real& X,
                                Standard_Real& Y,
                                Standard_Real& Z) const
@@ -1098,37 +698,34 @@ HLRBRep_PolyAlgo::AverageNormal(const Standard_Integer iNode,
   X = 0;
   Y = 0;
   Z = 0;
-  iiii = Nod1NdSg;
+  iiii = theNodeIndices.NdSg;
 
   while (iiii != 0 && !OK) {
-    const Standard_Address Seg2Indices = 
-      ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-    iTri1 = Seg2Conex1;
-    iTri2 = Seg2Conex2;
+    HLRAlgo_PolyInternalSegment& aSegIndices =
+      ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii);
+    iTri1 = aSegIndices.Conex1;
+    iTri2 = aSegIndices.Conex2;
     if ( iTri1 != 0) AddNormalOnTriangle
       (iTri1,iNode,jNode,TData,PINod,X,Y,Z,OK);
     if ( iTri2 != 0) AddNormalOnTriangle
       (iTri2,iNode,jNode,TData,PINod,X,Y,Z,OK);
-    if (Seg2LstSg1 == iNode) iiii = Seg2NxtSg1;
-    else                     iiii = Seg2NxtSg2;
+    if (aSegIndices.LstSg1 == iNode) iiii = aSegIndices.NxtSg1;
+    else                     iiii = aSegIndices.NxtSg2;
   }
 
   if (jNode != 0) {
-    const Standard_Address Nod2Indices =
-      ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(jNode)->Indices();
-    iiii = Nod2NdSg;
+    iiii = theNodeIndices.NdSg;
     
     while (iiii != 0 && !OK) {
-      const Standard_Address Seg2Indices = 
-       ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-      iTri1 = Seg2Conex1;
-      iTri2 = Seg2Conex2;
+      HLRAlgo_PolyInternalSegment& aSegIndices = PISeg->ChangeValue(iiii);
+      iTri1 = aSegIndices.Conex1;
+      iTri2 = aSegIndices.Conex2;
       if ( iTri1 != 0) AddNormalOnTriangle
        (iTri1,jNode,kNode,TData,PINod,X,Y,Z,OK);
       if ( iTri2 != 0) AddNormalOnTriangle
        (iTri2,jNode,kNode,TData,PINod,X,Y,Z,OK);
-      if (Seg2LstSg1 == jNode) iiii = Seg2NxtSg1;
-      else                     iiii = Seg2NxtSg2;
+      if (aSegIndices.LstSg1 == jNode) iiii = aSegIndices.NxtSg1;
+      else                     iiii = aSegIndices.NxtSg2;
     }
   }
   Standard_Real d = sqrt (X * X + Y * Y + Z * Z);
@@ -1154,62 +751,48 @@ HLRBRep_PolyAlgo::
 AddNormalOnTriangle(const Standard_Integer iTri,
                    const Standard_Integer iNode,
                    Standard_Integer& jNode,
-                   Standard_Address& TData,
-                   Standard_Address& PINod,
+                   HLRAlgo_Array1OfTData*& TData,
+                   HLRAlgo_Array1OfPINod*& PINod,
                    Standard_Real& X,
                    Standard_Real& Y,
                    Standard_Real& Z,
                    Standard_Boolean& OK) const
 {
-  Standard_Real dn,dnx,dny,dnz;
-  Standard_Real d1,dx1,dy1,dz1;
-  Standard_Real d2,dx2,dy2,dz2;
-  Standard_Real d3,dx3,dy3,dz3;
-  const Standard_Address Tri2Indices =
-    ((HLRAlgo_Array1OfTData*)TData)->ChangeValue(iTri).Indices();
-  const Standard_Address Nod1RValues =
-    ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node1)->RValues();
-  const Standard_Address Nod2RValues =
-    ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node2)->RValues();
-  const Standard_Address Nod3RValues =
-    ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node3)->RValues();
-  dx1 = Nod2PntX - Nod1PntX;
-  dy1 = Nod2PntY - Nod1PntY;
-  dz1 = Nod2PntZ - Nod1PntZ;
-  d1 = sqrt(dx1 * dx1 + dy1 * dy1 + dz1 * dz1);
-  if (d1 < 1.e-10) {
-    if      (Tri2Node1 == iNode) jNode = Tri2Node2;
-    else if (Tri2Node2 == iNode) jNode = Tri2Node1;
+  HLRAlgo_TriangleData& aTriangle = TData->ChangeValue(iTri);
+  HLRAlgo_PolyInternalNode::NodeData& Nod1RValues =
+    PINod->ChangeValue(aTriangle.Node1)->Data();
+  HLRAlgo_PolyInternalNode::NodeData& Nod2RValues =
+    PINod->ChangeValue(aTriangle.Node2)->Data();
+  HLRAlgo_PolyInternalNode::NodeData& Nod3RValues =
+    PINod->ChangeValue(aTriangle.Node3)->Data();
+  const gp_XYZ aD1 = Nod2RValues.Point - Nod1RValues.Point;
+  const Standard_Real aD1Norm = aD1.Modulus();
+  if (aD1Norm < 1.e-10) {
+    if      (aTriangle.Node1 == iNode) jNode = aTriangle.Node2;
+    else if (aTriangle.Node2 == iNode) jNode = aTriangle.Node1;
   }
   else {
-    dx2 = Nod3PntX - Nod2PntX;
-    dy2 = Nod3PntY - Nod2PntY;
-    dz2 = Nod3PntZ - Nod2PntZ;
-    d2 = sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2);
-    if (d2 < 1.e-10) {
-      if      (Tri2Node2 == iNode) jNode = Tri2Node3;
-      else if (Tri2Node3 == iNode) jNode = Tri2Node2;
+    const gp_XYZ aD2 = Nod3RValues.Point - Nod2RValues.Point;
+    const Standard_Real aD2Norm = aD2.Modulus();
+    if (aD2Norm < 1.e-10) {
+      if      (aTriangle.Node2 == iNode) jNode = aTriangle.Node3;
+      else if (aTriangle.Node3 == iNode) jNode = aTriangle.Node2;
     }
     else {
-      dx3 = Nod1PntX - Nod3PntX;
-      dy3 = Nod1PntY - Nod3PntY;
-      dz3 = Nod1PntZ - Nod3PntZ;
-      d3 = sqrt(dx3 * dx3 + dy3 * dy3 + dz3 * dz3);
-      if (d3 < 1.e-10) {
-       if      (Tri2Node3 == iNode) jNode = Tri2Node1;
-       else if (Tri2Node1 == iNode) jNode = Tri2Node3;
+      const gp_XYZ aD3 = Nod1RValues.Point - Nod3RValues.Point;
+      const Standard_Real aD3Norm = aD3.Modulus();
+      if (aD3Norm < 1.e-10) {
+       if      (aTriangle.Node3 == iNode) jNode = aTriangle.Node1;
+       else if (aTriangle.Node1 == iNode) jNode = aTriangle.Node3;
       }
       else {
-       dn = 1 / (d1 * d2);
-       dnx = (dy1 * dz2 - dy2 * dz1) * dn;
-       dny = (dz1 * dx2 - dz2 * dx1) * dn;
-       dnz = (dx1 * dy2 - dx2 * dy1) * dn;
-       dn = sqrt(dnx * dnx + dny * dny + dnz * dnz);
-       if (dn > 1.e-10) {
+        const gp_XYZ aDN = (1 / (aD1Norm * aD2Norm)) * (aD1 ^ aD2);
+        const Standard_Real aDNNorm = aDN.Modulus();
+       if (aDNNorm > 1.e-10) {
          OK = Standard_True;
-         X += dnx;
-         Y += dny;
-         Z += dnz;
+         X += aDN.X();
+         Y += aDN.Y();
+         Z += aDN.Z();
        }
       }
     }
@@ -1251,78 +834,78 @@ InitBiPointsWithConnexity (const Standard_Integer e,
        const Handle(TColStd_HArray1OfReal)& par = HPol[0]->Parameters();
        const TColStd_Array1OfInteger&      Pol1 = HPol[0]->Nodes();
        nbPol = Pol1.Upper();
-       Standard_Address TData1 = &pid1->TData();
-       Standard_Address PISeg1 = &pid1->PISeg();
-       Standard_Address PINod1 = &pid1->PINod();
-       Standard_Address Nod11Indices,Nod12Indices;
-       Standard_Address Nod11RValues,Nod12RValues;
+       HLRAlgo_Array1OfTData* TData1 = &pid1->TData();
+       HLRAlgo_Array1OfPISeg* PISeg1 = &pid1->PISeg();
+       HLRAlgo_Array1OfPINod* PINod1 = &pid1->PINod();
+  HLRAlgo_PolyInternalNode::NodeIndices* aNode11Indices;
+  HLRAlgo_PolyInternalNode::NodeIndices* aNode12Indices;
        const Handle(HLRAlgo_PolyInternalNode)* pi1p1 =
          &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(Pol1(1    )));
-       Nod11Indices = (*pi1p1)->Indices();
-       Nod11RValues = (*pi1p1)->RValues();
+       aNode11Indices = &(*pi1p1)->Indices();
+  HLRAlgo_PolyInternalNode::NodeData* Nod11RValues = &(*pi1p1)->Data();
        const Handle(HLRAlgo_PolyInternalNode)* pi1p2 =
          &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(Pol1(nbPol)));
-       Nod12Indices = (*pi1p2)->Indices();
-       Nod12RValues = (*pi1p2)->RValues();
-       Nod11Flag |=  NMskVert;
-       Nod12Flag |=  NMskVert;
+       aNode12Indices = &(*pi1p2)->Indices();
+  HLRAlgo_PolyInternalNode::NodeData* Nod12RValues = &(*pi1p2)->Data();
+       aNode11Indices->Flag |=  NMsk_Vert;
+       aNode12Indices->Flag |=  NMsk_Vert;
        
        for (iPol = 1; iPol <= nbPol; iPol++) {
          const Handle(HLRAlgo_PolyInternalNode)* pi1pA =
            &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(Pol1(iPol)));
-         Standard_Address Nod1AIndices = (*pi1pA)->Indices();
-         Standard_Address Nod1ARValues = (*pi1pA)->RValues();
-         if (Nod1AEdg1 == 0 || Nod1AEdg1 == e) {
-           Nod1AEdg1 = e;
-           Nod1APCu1 = par->Value(iPol);
+         HLRAlgo_PolyInternalNode::NodeIndices& aNodeIndices1A = (*pi1pA)->Indices();
+         HLRAlgo_PolyInternalNode::NodeData& Nod1ARValues = (*pi1pA)->Data();
+         if (aNodeIndices1A.Edg1 == 0 || aNodeIndices1A.Edg1 == e) {
+           aNodeIndices1A.Edg1 = e;
+           Nod1ARValues.PCu1 = par->Value(iPol);
          }
          else {
-           Nod1AEdg2 = e;
-           Nod1APCu2 = par->Value(iPol);
+           aNodeIndices1A.Edg2 = e;
+           Nod1ARValues.PCu2 = par->Value(iPol);
          }
        }
        
        i1p2 = Pol1(1);
-       Nod12Indices = Nod11Indices;
+       aNode12Indices = aNode11Indices;
        Nod12RValues = Nod11RValues;
-       XTI2 = X2 = Nod12PntX;
-       YTI2 = Y2 = Nod12PntY;
-       ZTI2 = Z2 = Nod12PntZ;
-       if      (Nod12Edg1 == e) U2 = Nod12PCu1;
-       else if (Nod12Edg2 == e) U2 = Nod12PCu2;
+       XTI2 = X2 = Nod12RValues->Point.X();
+       YTI2 = Y2 = Nod12RValues->Point.Y();
+       ZTI2 = Z2 = Nod12RValues->Point.Z();
+       if      (aNode12Indices->Edg1 == e) U2 = Nod12RValues->PCu1;
+       else if (aNode12Indices->Edg2 == e) U2 = Nod12RValues->PCu2;
 #ifdef OCCT_DEBUG
        else {
          cout << " HLRBRep_PolyAlgo::InitBiPointsWithConnexity : ";
          cout << "Parameter error on Node " << i1p2 << endl;
        }
 #endif
-       Nod12Flag |= NMskEdge;
+       aNode12Indices->Flag |= NMsk_Edge;
        TIMultiply(XTI2,YTI2,ZTI2);
        if (Pol1(1) == Pol1(nbPol) && myPC.IsPeriodic())
          U2 = U2 - myPC.Period();
        
        if (nbPol == 2 && BRep_Tool::Degenerated(E)) {
-         CheckDegeneratedSegment(Nod11Indices,Nod11RValues,
-                                 Nod12Indices,Nod12RValues);
-         UpdateAroundNode(Pol1(1    ),Nod11Indices,TData1,PISeg1,PINod1);
-         UpdateAroundNode(Pol1(nbPol),Nod12Indices,TData1,PISeg1,PINod1);
+         CheckDegeneratedSegment(*aNode11Indices,*Nod11RValues,
+                                 *aNode12Indices,*Nod12RValues);
+         UpdateAroundNode(Pol1(1    ),*aNode11Indices,TData1,PISeg1,PINod1);
+         UpdateAroundNode(Pol1(nbPol),*aNode12Indices,TData1,PISeg1,PINod1);
        }
        else {
 
          for (iPol = 2; iPol <= nbPol; iPol++) {
            i1p1 = i1p2;
-           Nod11Indices = Nod12Indices;
+           aNode11Indices = aNode12Indices;
            Nod11RValues = Nod12RValues;
            i1p2 = Pol1(iPol);
            const Handle(HLRAlgo_PolyInternalNode)* pi1p2iPol =
              &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(Pol1(iPol)));
-           Nod12Indices = (*pi1p2iPol)->Indices();
-           Nod12RValues = (*pi1p2iPol)->RValues();
+           aNode12Indices = &(*pi1p2iPol)->Indices();
+           Nod12RValues = &(*pi1p2iPol)->Data();
 #ifdef OCCT_DEBUG
            if (DoError) {
-             if (Nod11NrmX*Nod12NrmX +
-                 Nod11NrmY*Nod12NrmY +
-                 Nod11NrmZ*Nod12NrmZ < 0) {
+             if (Nod11RValues->Normal.X()*Nod12RValues->Normal.X() +
+                 Nod11RValues->Normal.Y()*Nod12RValues->Normal.Y() +
+                 Nod11RValues->Normal.Z()*Nod12RValues->Normal.Z() < 0) {
                cout << " HLRBRep_PolyAlgo::InitBiPointsWithConnexity : ";
                cout << "Too big angle between " << i1p1 << setw(6);
                cout << " and " << i1p2 << setw(6);
@@ -1337,25 +920,25 @@ InitBiPointsWithConnexity (const Standard_Integer e,
            YTI1 = YTI2;
            ZTI1 = ZTI2;
            U1   = U2;
-           XTI2 = X2 = Nod12PntX;
-           YTI2 = Y2 = Nod12PntY;
-           ZTI2 = Z2 = Nod12PntZ;
-           if      (Nod12Edg1 == e) U2 = Nod12PCu1;
-           else if (Nod12Edg2 == e) U2 = Nod12PCu2;
+           XTI2 = X2 = Nod12RValues->Point.X();
+           YTI2 = Y2 = Nod12RValues->Point.Y();
+           ZTI2 = Z2 = Nod12RValues->Point.Z();
+           if      (aNode12Indices->Edg1 == e) U2 = Nod12RValues->PCu1;
+           else if (aNode12Indices->Edg2 == e) U2 = Nod12RValues->PCu2;
 #ifdef OCCT_DEBUG
            else {
              cout << " HLRBRep_PolyAlgo::InitBiPointsWithConnexity : ";
              cout << "Parameter error on Node " << i1p2 << endl;
            }
 #endif
-           Nod12Flag |= NMskEdge;
+           aNode12Indices->Flag |= NMsk_Edge;
            TIMultiply(XTI2,YTI2,ZTI2);
            Interpolation(List,
                          X1  ,Y1  ,Z1  ,X2  ,Y2  ,Z2  ,
                          XTI1,YTI1,ZTI1,XTI2,YTI2,ZTI2,
                          e,U1,U2,
-                         Nod11Indices,Nod11RValues,
-                         Nod12Indices,Nod12RValues,
+                         *aNode11Indices,*Nod11RValues,
+                         *aNode12Indices,*Nod12RValues,
                          i1p1,i1p2,i1,pid1,TData1,PISeg1,PINod1);
          }
        }
@@ -1390,130 +973,126 @@ InitBiPointsWithConnexity (const Standard_Integer e,
        const TColStd_Array1OfInteger&      Pol2 = HPol[1]->Nodes();
        const Handle(TColStd_HArray1OfReal)& par = HPol[0]->Parameters();
        Standard_Integer nbPol1 = Pol1.Upper();
-       Standard_Address TData1 = &pid1->TData();
-       Standard_Address PISeg1 = &pid1->PISeg();
-       Standard_Address PINod1 = &pid1->PINod();
-       Standard_Address TData2 = &pid2->TData();
-       Standard_Address PISeg2 = &pid2->PISeg();
-       Standard_Address PINod2 = &pid2->PINod();
-       Standard_Address Nod11Indices,Nod11RValues;
-       Standard_Address Nod12Indices,Nod12RValues;
-       Standard_Address Nod21Indices,Nod21RValues;
-       Standard_Address Nod22Indices,Nod22RValues;
+       HLRAlgo_Array1OfTData* TData1 = &pid1->TData();
+       HLRAlgo_Array1OfPISeg* PISeg1 = &pid1->PISeg();
+       HLRAlgo_Array1OfPINod* PINod1 = &pid1->PINod();
+       HLRAlgo_Array1OfTData* TData2 = &pid2->TData();
+       HLRAlgo_Array1OfPISeg* PISeg2 = &pid2->PISeg();
+       HLRAlgo_Array1OfPINod* PINod2 = &pid2->PINod();
        const Handle(HLRAlgo_PolyInternalNode)* pi1p1 =
-         &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(Pol1(1    )));
-       Nod11Indices = (*pi1p1)->Indices();
-       Nod11RValues = (*pi1p1)->RValues();
+         &PINod1->ChangeValue(Pol1(1));
+       HLRAlgo_PolyInternalNode::NodeIndices* aNode11Indices = &(*pi1p1)->Indices();
+  HLRAlgo_PolyInternalNode::NodeData* Nod11RValues = &(*pi1p1)->Data();
        const Handle(HLRAlgo_PolyInternalNode)* pi1p2nbPol1 =
-         &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(Pol1(nbPol1)));
-       Nod12Indices = (*pi1p2nbPol1)->Indices();
-       Nod12RValues = (*pi1p2nbPol1)->RValues();
+         &PINod1->ChangeValue(Pol1(nbPol1));
+       HLRAlgo_PolyInternalNode::NodeIndices* aNode12Indices = &(*pi1p2nbPol1)->Indices();
+  HLRAlgo_PolyInternalNode::NodeData* Nod12RValues = &(*pi1p2nbPol1)->Data();
        const Handle(HLRAlgo_PolyInternalNode)* pi2p1 =
-         &(((HLRAlgo_Array1OfPINod*)PINod2)->ChangeValue(Pol2(1    )));
-       Nod21Indices = (*pi2p1)->Indices();
-       Nod21RValues = (*pi2p1)->RValues();
+         &PINod2->ChangeValue(Pol2(1));
+       HLRAlgo_PolyInternalNode::NodeIndices* Nod21Indices = &(*pi2p1)->Indices();
+  HLRAlgo_PolyInternalNode::NodeData* Nod21RValues = &(*pi2p1)->Data();
        const Handle(HLRAlgo_PolyInternalNode)* pi2p2 =
-         &(((HLRAlgo_Array1OfPINod*)PINod2)->ChangeValue(Pol2(nbPol1)));
-       Nod22Indices = (*pi2p2)->Indices();
-       Nod22RValues = (*pi2p2)->RValues();
-       Nod11Flag |=  NMskVert;
-       Nod12Flag |=  NMskVert;
-       Nod21Flag |=  NMskVert;
-       Nod22Flag |=  NMskVert;
+    &PINod2->ChangeValue(Pol2(nbPol1));
+       HLRAlgo_PolyInternalNode::NodeIndices* Nod22Indices = &(*pi2p2)->Indices();
+  HLRAlgo_PolyInternalNode::NodeData* Nod22RValues = &(*pi2p2)->Data();
+       aNode11Indices->Flag |=  NMsk_Vert;
+       aNode12Indices->Flag |=  NMsk_Vert;
+       Nod21Indices->Flag |=  NMsk_Vert;
+       Nod22Indices->Flag |=  NMsk_Vert;
        
        for (iPol = 1; iPol <= nbPol1; iPol++) {
          const Handle(HLRAlgo_PolyInternalNode)* pi1pA =
-           &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(Pol1(iPol)));
-         Standard_Address Nod1AIndices = (*pi1pA)->Indices();
-         Standard_Address Nod1ARValues = (*pi1pA)->RValues();
+           &PINod1->ChangeValue(Pol1(iPol));
+         HLRAlgo_PolyInternalNode::NodeIndices* Nod1AIndices = &(*pi1pA)->Indices();
+    HLRAlgo_PolyInternalNode::NodeData* Nod1ARValues = &(*pi1pA)->Data();
          const Handle(HLRAlgo_PolyInternalNode)* pi2pA =
-           &(((HLRAlgo_Array1OfPINod*)PINod2)->ChangeValue(Pol2(iPol)));
-         Standard_Address Nod2AIndices = (*pi2pA)->Indices();
-         Standard_Address Nod2ARValues = (*pi2pA)->RValues();
+      &PINod2->ChangeValue(Pol2(iPol));
+         HLRAlgo_PolyInternalNode::NodeIndices* Nod2AIndices = &(*pi2pA)->Indices();
+    HLRAlgo_PolyInternalNode::NodeData* Nod2ARValues = &(*pi2pA)->Data();
          Standard_Real PCu = par->Value(iPol);
-         if (Nod1AEdg1 == 0 || Nod1AEdg1 == e) {
-           Nod1AEdg1 = e;
-           Nod1APCu1 = PCu;
+         if (Nod1AIndices->Edg1 == 0 || Nod1AIndices->Edg1 == e) {
+           Nod1AIndices->Edg1 = e;
+           Nod1ARValues->PCu1 = PCu;
          }
          else {
-           Nod1AEdg2 = e;
-           Nod1APCu2 = PCu;
+           Nod1AIndices->Edg2 = e;
+           Nod1ARValues->PCu2 = PCu;
          }
-         if (Nod2AEdg1 == 0 || Nod2AEdg1 == e) {
-           Nod2AEdg1 = e;
-           Nod2APCu1 = PCu;
+         if (Nod2AIndices->Edg1 == 0 || Nod2AIndices->Edg1 == e) {
+           Nod2AIndices->Edg1 = e;
+           Nod2ARValues->PCu1 = PCu;
          }
          else {
-           Nod2AEdg2 = e;
-           Nod2APCu2 = PCu;
+           Nod2AIndices->Edg2 = e;
+           Nod2ARValues->PCu2 = PCu;
          }
        }
 
        i1p2 = Pol1(1);
-       Nod12Indices = Nod11Indices;
+       aNode12Indices = aNode11Indices;
        Nod12RValues = Nod11RValues;
        i2p2 = Pol2(1);
        Nod22Indices = Nod21Indices;
        Nod22RValues = Nod21RValues;
-       XTI2 = X2 = Nod12PntX;
-       YTI2 = Y2 = Nod12PntY;
-       ZTI2 = Z2 = Nod12PntZ;
-       if      (Nod12Edg1 == e) U2 = Nod12PCu1;
-       else if (Nod12Edg2 == e) U2 = Nod12PCu2;
+       XTI2 = X2 = Nod12RValues->Point.X();
+       YTI2 = Y2 = Nod12RValues->Point.Y();
+       ZTI2 = Z2 = Nod12RValues->Point.Z();
+       if      (aNode12Indices->Edg1 == e) U2 = Nod12RValues->PCu1;
+       else if (aNode12Indices->Edg2 == e) U2 = Nod12RValues->PCu2;
 #ifdef OCCT_DEBUG
        else {
          cout << " HLRBRep_PolyAlgo::InitBiPointsWithConnexity : ";
          cout << "Parameter error on Node " << i1p2 << endl;
        }
 #endif
-       Nod12Flag |= NMskEdge;
-       Nod22Flag |= NMskEdge;
+       aNode12Indices->Flag |= NMsk_Edge;
+       Nod22Indices->Flag |= NMsk_Edge;
        TIMultiply(XTI2,YTI2,ZTI2);
        if (Pol1(1) == Pol1(nbPol1) && myPC.IsPeriodic())
          U2 = U2 - myPC.Period();
        
        if (nbPol1 == 2 && BRep_Tool::Degenerated(E)) {
-         CheckDegeneratedSegment(Nod11Indices,Nod11RValues,
-                                 Nod12Indices,Nod12RValues);
-         CheckDegeneratedSegment(Nod21Indices,Nod21RValues,
-                                 Nod22Indices,Nod22RValues);
-         UpdateAroundNode(Pol1(1    ),Nod11Indices,TData1,PISeg1,PINod1);
-         UpdateAroundNode(Pol1(nbPol1),Nod12Indices,TData1,PISeg1,PINod1);
-         UpdateAroundNode(Pol2(1    ),Nod21Indices,TData2,PISeg2,PINod2);
-         UpdateAroundNode(Pol2(nbPol1),Nod22Indices,TData2,PISeg2,PINod2);
+         CheckDegeneratedSegment(*aNode11Indices,*Nod11RValues,
+                                 *aNode12Indices,*Nod12RValues);
+         CheckDegeneratedSegment(*Nod21Indices,*Nod21RValues,
+                                 *Nod22Indices,*Nod22RValues);
+         UpdateAroundNode(Pol1(1    ),*aNode11Indices,TData1,PISeg1,PINod1);
+         UpdateAroundNode(Pol1(nbPol1),*aNode12Indices,TData1,PISeg1,PINod1);
+         UpdateAroundNode(Pol2(1    ),*Nod21Indices,TData2,PISeg2,PINod2);
+         UpdateAroundNode(Pol2(nbPol1),*Nod22Indices,TData2,PISeg2,PINod2);
        }
        else {
 
          for (iPol = 2; iPol <= nbPol1; iPol++) {
            i1p1 = i1p2;
-           Nod11Indices = Nod12Indices;
+           aNode11Indices = aNode12Indices;
            Nod11RValues = Nod12RValues;
            i2p1 = i2p2;
            Nod21Indices = Nod22Indices;
            Nod21RValues = Nod22RValues;
            i1p2 = Pol1(iPol);
            const Handle(HLRAlgo_PolyInternalNode)* pi1p2iPol =
-             &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(Pol1(iPol)));
-           Nod12Indices = (*pi1p2iPol)->Indices();
-           Nod12RValues = (*pi1p2iPol)->RValues();
+             &PINod1->ChangeValue(Pol1(iPol));
+           aNode12Indices = &(*pi1p2iPol)->Indices();
+      Nod12RValues = &(*pi1p2iPol)->Data();
            i2p2 = Pol2(iPol);
            const Handle(HLRAlgo_PolyInternalNode)* pi2p2iPol =
-             &(((HLRAlgo_Array1OfPINod*)PINod2)->ChangeValue(Pol2(iPol)));
-           Nod22Indices = (*pi2p2iPol)->Indices();
-           Nod22RValues = (*pi2p2iPol)->RValues();
+        &PINod2->ChangeValue(Pol2(iPol));
+           Nod22Indices = &(*pi2p2iPol)->Indices();
+      Nod22RValues = &(*pi2p2iPol)->Data();
 #ifdef OCCT_DEBUG
            if (DoError) {
-             if (Nod11NrmX*Nod12NrmX +
-                 Nod11NrmY*Nod12NrmY +
-                 Nod11NrmZ*Nod12NrmZ < 0) {
+             if (Nod11RValues->Normal.X()*Nod12RValues->Normal.X() +
+                 Nod11RValues->Normal.Y()*Nod12RValues->Normal.Y() +
+                 Nod11RValues->Normal.Z()*Nod12RValues->Normal.Z() < 0) {
                cout << " HLRBRep_PolyAlgo::InitBiPointsWithConnexity : ";
                cout << "To big angle between " << i1p1 << setw(6);
                cout << " and " << i1p2 << setw(6);
                cout << " in face " << i1 << endl;
              }
-             if (Nod21NrmX*Nod22NrmX +
-                 Nod21NrmY*Nod22NrmY +
-                 Nod21NrmZ*Nod22NrmZ < 0) {
+             if (Nod21RValues->Normal.X()*Nod22RValues->Normal.X() +
+                 Nod21RValues->Normal.Y()*Nod22RValues->Normal.Y() +
+                 Nod21RValues->Normal.Z()*Nod22RValues->Normal.Z() < 0) {
                cout << " HLRBRep_PolyAlgo::InitBiPointsWithConnexity : ";
                cout << "To big angle between " << i2p1 << setw(6);
                cout << " and " << i2p2 << setw(6);
@@ -1528,29 +1107,29 @@ InitBiPointsWithConnexity (const Standard_Integer e,
            YTI1 = YTI2;
            ZTI1 = ZTI2;
            U1   = U2;
-           XTI2 = X2 = Nod12PntX;
-           YTI2 = Y2 = Nod12PntY;
-           ZTI2 = Z2 = Nod12PntZ;
-           if      (Nod12Edg1 == e) U2 = Nod12PCu1;
-           else if (Nod12Edg2 == e) U2 = Nod12PCu2;
+           XTI2 = X2 = Nod12RValues->Point.X();
+           YTI2 = Y2 = Nod12RValues->Point.Y();
+           ZTI2 = Z2 = Nod12RValues->Point.Z();
+           if      (aNode12Indices->Edg1 == e) U2 = Nod12RValues->PCu1;
+           else if (aNode12Indices->Edg2 == e) U2 = Nod12RValues->PCu2;
 #ifdef OCCT_DEBUG
            else {
              cout << " HLRBRep_PolyAlgo::InitBiPointsWithConnexity : ";
              cout << "Parameter error on Node " << i1p2 << endl;
            }
 #endif
-           Nod12Flag |= NMskEdge;
-           Nod22Flag |= NMskEdge;
+           aNode12Indices->Flag |= NMsk_Edge;
+           aNode12Indices->Flag |= NMsk_Edge;
            TIMultiply(XTI2,YTI2,ZTI2);
            Interpolation(List,
                          X1  ,Y1  ,Z1  ,X2  ,Y2  ,Z2  ,
                          XTI1,YTI1,ZTI1,XTI2,YTI2,ZTI2,
                          e,U1,U2,rg,
-                         Nod11Indices,Nod11RValues,
-                         Nod12Indices,Nod12RValues,
+                         *aNode11Indices,*Nod11RValues,
+                         *aNode12Indices,*Nod12RValues,
                          i1p1,i1p2,i1,pid1,TData1,PISeg1,PINod1,
-                         Nod21Indices,Nod21RValues,
-                         Nod22Indices,Nod22RValues,
+                         *Nod21Indices,*Nod21RValues,
+                         *Nod22Indices,*Nod22RValues,
                          i2p1,i2p2,i2,pid2,TData2,PISeg2,PINod2);
          }
        }
@@ -1649,17 +1228,17 @@ Interpolation (HLRAlgo_ListOfBPoint& List,
               const Standard_Integer e,
               Standard_Real& U1,
               Standard_Real& U2,
-              Standard_Address& Nod11Indices,
-              Standard_Address& Nod11RValues,
-              Standard_Address& Nod12Indices,
-              Standard_Address& Nod12RValues,
+              HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices,
+              HLRAlgo_PolyInternalNode::NodeData& Nod11RValues,
+              HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices,
+              HLRAlgo_PolyInternalNode::NodeData& Nod12RValues,
               const Standard_Integer i1p1,
               const Standard_Integer i1p2,
               const Standard_Integer i1,
               const Handle(HLRAlgo_PolyInternalData)& pid1,
-              Standard_Address& TData1,
-              Standard_Address& PISeg1,
-              Standard_Address& PINod1) const
+              HLRAlgo_Array1OfTData*& TData1,
+              HLRAlgo_Array1OfPISeg*& PISeg1,
+              HLRAlgo_Array1OfPINod*& PINod1) const
 {
   Standard_Boolean insP3,mP3P1;
   Standard_Real X3,Y3,Z3,XTI3,YTI3,ZTI3,coef3,U3;
@@ -1700,28 +1279,28 @@ Interpolation (HLRAlgo_ListOfBPoint& List,
               Standard_Real& U1,
               Standard_Real& U2,
               const GeomAbs_Shape rg,
-              Standard_Address& Nod11Indices,
-              Standard_Address& Nod11RValues,
-              Standard_Address& Nod12Indices,
-              Standard_Address& Nod12RValues,
+              HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices,
+              HLRAlgo_PolyInternalNode::NodeData& Nod11RValues,
+              HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices,
+              HLRAlgo_PolyInternalNode::NodeData& Nod12RValues,
               const Standard_Integer i1p1,
               const Standard_Integer i1p2,
               const Standard_Integer i1,
               const Handle(HLRAlgo_PolyInternalData)& pid1,
-              Standard_Address& TData1,
-              Standard_Address& PISeg1,
-              Standard_Address& PINod1,
-              Standard_Address& Nod21Indices,
-              Standard_Address& Nod21RValues,
-              Standard_Address& Nod22Indices,
-              Standard_Address& Nod22RValues,
+              HLRAlgo_Array1OfTData*& TData1,
+              HLRAlgo_Array1OfPISeg*& PISeg1,
+              HLRAlgo_Array1OfPINod*& PINod1,
+              HLRAlgo_PolyInternalNode::NodeIndices& Nod21Indices,
+              HLRAlgo_PolyInternalNode::NodeData& Nod21RValues,
+              HLRAlgo_PolyInternalNode::NodeIndices& Nod22Indices,
+              HLRAlgo_PolyInternalNode::NodeData& Nod22RValues,
               const Standard_Integer i2p1,
               const Standard_Integer i2p2,
               const Standard_Integer i2,
               const Handle(HLRAlgo_PolyInternalData)& pid2,
-              Standard_Address& TData2,
-              Standard_Address& PISeg2,
-              Standard_Address& PINod2) const
+              HLRAlgo_Array1OfTData*& TData2,
+              HLRAlgo_Array1OfPISeg*& PISeg2,
+              HLRAlgo_Array1OfPINod*& PINod2) const
 {
   Standard_Boolean insP3,mP3P1,insP4,mP4P1;
   Standard_Real X3,Y3,Z3,XTI3,YTI3,ZTI3,coef3,U3;
@@ -1815,8 +1394,8 @@ Standard_Boolean
 HLRBRep_PolyAlgo::
 Interpolation (const Standard_Real U1,
               const Standard_Real U2,
-              const Standard_Address Nod1RValues,
-              const Standard_Address Nod2RValues,
+              HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
+              HLRAlgo_PolyInternalNode::NodeData& Nod2RValues,
               Standard_Real& X3,
               Standard_Real& Y3,
               Standard_Real& Z3,
@@ -1863,17 +1442,17 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
                   const Standard_Integer e,
                   Standard_Real& U1,
                   Standard_Real& U2,
-                  Standard_Address& Nod11Indices,
-                  Standard_Address& Nod11RValues,
-                  Standard_Address& Nod12Indices,
-                  Standard_Address& Nod12RValues,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod11RValues,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod12RValues,
                   const Standard_Integer i1p1,
                   const Standard_Integer i1p2,
                   const Standard_Integer i1,
                   const Handle(HLRAlgo_PolyInternalData)& pid1,
-                  Standard_Address& TData1,
-                  Standard_Address& PISeg1,
-                  Standard_Address& PINod1,
+                  HLRAlgo_Array1OfTData*& TData1,
+                  HLRAlgo_Array1OfPISeg*& PISeg1,
+                  HLRAlgo_Array1OfPINod*& PINod1,
                   const Standard_Real X3,
                   const Standard_Real Y3,
                   const Standard_Real Z3,
@@ -1886,12 +1465,12 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
                   const Standard_Boolean mP3P1,
                   const Standard_Integer flag) const
 {
-  Standard_Address TData2 = 0;
-  Standard_Address PISeg2 = 0;
-  Standard_Address PINod2 = 0;
+  HLRAlgo_Array1OfTData* TData2 = 0;
+  HLRAlgo_Array1OfPISeg* PISeg2 = 0;
+  HLRAlgo_Array1OfPINod* PINod2 = 0;
   Standard_Boolean ins3 = insP3;
   if (ins3 && mP3P1) {                             // P1 ---> P3
-    if (!(Nod11Flag & NMskVert) && coef3 < myTolSta) {
+    if (!(Nod11Indices.Flag & NMsk_Vert) && coef3 < myTolSta) {
       ins3 = Standard_False;
       ChangeNode(i1p1,i1p2,
                 Nod11Indices,Nod11RValues,
@@ -1905,31 +1484,25 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
       YTI1 = YTI3;
       ZTI1 = ZTI3;
       U1   = U3;
-      Nod11PntX = X3;
-      Nod11PntY = Y3;
-      Nod11PntZ = Z3;
-      if      (Nod11Edg1 == e) Nod11PCu1 = U3;
-      else if (Nod11Edg2 == e) Nod11PCu2 = U3;
+      Nod11RValues.Point = gp_XYZ(X3, Y3, Z3);
+      if      (Nod11Indices.Edg1 == e) Nod11RValues.PCu1 = U3;
+      else if (Nod11Indices.Edg2 == e) Nod11RValues.PCu2 = U3;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i1p1 << endl;
       }
 #endif
-      Nod11Scal  = 0;
-      Nod11Flag |= NMskOutL;
+      Nod11RValues.Scal  = 0;
+      Nod11Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i1p1,Nod11Indices,TData1,PISeg1,PINod1);
-      Standard_Address Coordinates = List.First().Coordinates();
-      PntX2   = X3;
-      PntY2   = Y3;
-      PntZ2   = Z3;
-      PntXTI2 = XTI3;
-      PntYTI2 = YTI3;
-      PntZTI2 = ZTI3;
+      HLRAlgo_BiPoint::PointsT& aPoints = List.First().Points();
+      aPoints.PntP2 = gp_XYZ(X3, Y3, Z3);
+      aPoints.Pnt2 = gp_XYZ(XTI3, YTI3, ZTI3);
     }
   }
   if (ins3 && !mP3P1) {                            // P2 ---> P3
-    if (!(Nod12Flag & NMskVert) && coef3 > myTolEnd) {
+    if (!(Nod12Indices.Flag & NMsk_Vert) && coef3 > myTolEnd) {
       ins3 = Standard_False;
       ChangeNode(i1p1,i1p2,
                 Nod11Indices,Nod11RValues,
@@ -1943,19 +1516,17 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
       YTI2 = YTI3;
       ZTI2 = ZTI3;
       U2   = U3;
-      Nod12PntX = X3;
-      Nod12PntY = Y3;
-      Nod12PntZ = Z3;
-      if      (Nod12Edg1 == e) Nod12PCu1 = U3;
-      else if (Nod12Edg2 == e) Nod12PCu2 = U3;
+      Nod12RValues.Point = gp_XYZ(X3, Y3, Z3);
+      if      (Nod12Indices.Edg1 == e) Nod12RValues.PCu1 = U3;
+      else if (Nod12Indices.Edg2 == e) Nod12RValues.PCu2 = U3;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i1p2 << endl;
       }
 #endif
-      Nod12Scal  = 0;
-      Nod12Flag |= NMskOutL;
+      Nod12RValues.Scal  = 0;
+      Nod12Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i1p2,Nod12Indices,TData1,PISeg1,PINod1);
     }
   }
@@ -1964,13 +1535,13 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
       (Nod11RValues,Nod12RValues,PINod1,PINod2,coef3,X3,Y3,Z3);
     const Handle(HLRAlgo_PolyInternalNode)* pi1p3 =
       &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(i1p3));
-    const Standard_Address Nod13Indices = (*pi1p3)->Indices();
-    const Standard_Address Nod13RValues = (*pi1p3)->RValues();
-    Nod13Edg1  = e;
-    Nod13PCu1  = U3;
-    Nod13Scal  = 0;
-    Nod13Flag |= NMskOutL;
-    Nod13Flag |= NMskEdge;
+    HLRAlgo_PolyInternalNode::NodeIndices& Nod13Indices = (*pi1p3)->Indices();
+    HLRAlgo_PolyInternalNode::NodeData& Nod13RValues = (*pi1p3)->Data();
+    Nod13Indices.Edg1  = e;
+    Nod13RValues.PCu1  = U3;
+    Nod13RValues.Scal  = 0;
+    Nod13Indices.Flag |= NMsk_OutL;
+    Nod13Indices.Flag |= NMsk_Edge;
     pid1->UpdateLinks(i1p1,i1p2,i1p3,
                      TData1,TData2,PISeg1,PISeg2,PINod1,PINod2);
     UpdateAroundNode(i1p3,Nod13Indices,TData1,PISeg1,PINod1);
@@ -2013,28 +1584,28 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
                   const Standard_Integer e,
                   Standard_Real& U1,
                   Standard_Real& U2,
-                  Standard_Address& Nod11Indices,
-                  Standard_Address& Nod11RValues,
-                  Standard_Address& Nod12Indices,
-                  Standard_Address& Nod12RValues,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod11RValues,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod12RValues,
                   const Standard_Integer i1p1,
                   const Standard_Integer i1p2,
                   const Standard_Integer i1,
                   const Handle(HLRAlgo_PolyInternalData)& pid1,
-                  Standard_Address& TData1,
-                  Standard_Address& PISeg1,
-                  Standard_Address& PINod1,
-                  Standard_Address& Nod21Indices,
-                  Standard_Address& Nod21RValues,
-                  Standard_Address& Nod22Indices,
-                  Standard_Address& Nod22RValues,
+                  HLRAlgo_Array1OfTData*& TData1,
+                  HLRAlgo_Array1OfPISeg*& PISeg1,
+                  HLRAlgo_Array1OfPINod*& PINod1,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod21Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod21RValues,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod22Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod22RValues,
                   const Standard_Integer i2p1,
                   const Standard_Integer i2p2,
                   const Standard_Integer i2,
                   const Handle(HLRAlgo_PolyInternalData)& pid2,
-                  Standard_Address& TData2,
-                  Standard_Address& PISeg2,
-                  Standard_Address& PINod2,
+                  HLRAlgo_Array1OfTData*& TData2,
+                  HLRAlgo_Array1OfPISeg*& PISeg2,
+                  HLRAlgo_Array1OfPINod*& PINod2,
                   const Standard_Real X3,
                   const Standard_Real Y3,
                   const Standard_Real Z3,
@@ -2049,7 +1620,7 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
 {
   Standard_Boolean ins3 = insP3;
   if (ins3 && mP3P1) {                             // P1 ---> P3
-    if (!(Nod11Flag & NMskVert) && coef3 < myTolSta) {
+    if (!(Nod11Indices.Flag & NMsk_Vert) && coef3 < myTolSta) {
       ins3 = Standard_False;
       ChangeNode(i1p1,i1p2,
                 Nod11Indices,Nod11RValues,
@@ -2068,45 +1639,37 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
       YTI1 = YTI3;
       ZTI1 = ZTI3;
       U1   = U3;
-      Nod11PntX = X3;
-      Nod11PntY = Y3;
-      Nod11PntZ = Z3;
-      if      (Nod11Edg1 == e) Nod11PCu1 = U3;
-      else if (Nod11Edg2 == e) Nod11PCu2 = U3;
+      Nod11RValues.Point = gp_XYZ(X3, Y3, Z3);
+      if      (Nod11Indices.Edg1 == e) Nod11RValues.PCu1 = U3;
+      else if (Nod11Indices.Edg2 == e) Nod11RValues.PCu2 = U3;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i1p1 << endl;
       }
 #endif
-      Nod11Scal  = 0;
-      Nod11Flag |= NMskOutL;
+      Nod11RValues.Scal  = 0;
+      Nod11Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i1p1,Nod11Indices,TData1,PISeg1,PINod1);
-      Nod21PntX  = X3;
-      Nod21PntY  = Y3;
-      Nod21PntZ  = Z3;
-      if      (Nod21Edg1 == e) Nod21PCu1 = U3;
-      else if (Nod21Edg2 == e) Nod21PCu2 = U3;
+      Nod21RValues.Point = gp_XYZ(X3, Y3, Z3);
+      if      (Nod21Indices.Edg1 == e) Nod21RValues.PCu1 = U3;
+      else if (Nod21Indices.Edg2 == e) Nod21RValues.PCu2 = U3;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i2p1 << endl;
       }
 #endif
-      Nod21Scal  = 0;
-      Nod21Flag |= NMskOutL;
+      Nod21RValues.Scal  = 0;
+      Nod21Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i2p1,Nod21Indices,TData2,PISeg2,PINod2);
-      Standard_Address Coordinates = List.First().Coordinates();
-      PntX2   = X3;
-      PntY2   = Y3;
-      PntZ2   = Z3;
-      PntXTI2 = XTI3;
-      PntYTI2 = YTI3;
-      PntZTI2 = ZTI3;
+      HLRAlgo_BiPoint::PointsT& aPoints = List.First().Points();
+      aPoints.PntP2 = gp_XYZ(X3, Y3, Z3);
+      aPoints.Pnt2 = gp_XYZ(XTI3, YTI3, ZTI3);
     }
   }
   if (ins3 && !mP3P1) {                            // P2 ---> P3
-    if (!(Nod12Flag & NMskVert) && coef3 > myTolEnd) {
+    if (!(Nod12Indices.Flag & NMsk_Vert) && coef3 > myTolEnd) {
       ins3 = Standard_False;
       ChangeNode(i1p1,i1p2,
                 Nod11Indices,Nod11RValues,
@@ -2125,33 +1688,29 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
       YTI2 = YTI3;
       ZTI2 = ZTI3;
       U2   = U3;
-      Nod12PntX = X3;
-      Nod12PntY = Y3;
-      Nod12PntZ = Z3;
-      if      (Nod12Edg1 == e) Nod12PCu1 = U3;
-      else if (Nod12Edg2 == e) Nod12PCu2 = U3;
+      Nod12RValues.Point = gp_XYZ(X3, Y3, Z3);
+      if      (Nod12Indices.Edg1 == e) Nod12RValues.PCu1 = U3;
+      else if (Nod12Indices.Edg2 == e) Nod12RValues.PCu2 = U3;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i1p2 << endl;
       }
 #endif
-      Nod12Scal  = 0;
-      Nod12Flag |= NMskOutL;
+      Nod12RValues.Scal  = 0;
+      Nod12Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i1p2,Nod12Indices,TData1,PISeg1,PINod1);
-      Nod22PntX  = X3;
-      Nod22PntY  = Y3;
-      Nod22PntZ  = Z3;
-      if      (Nod22Edg1 == e) Nod22PCu1 = U3;
-      else if (Nod22Edg2 == e) Nod22PCu2 = U3;
+      Nod22RValues.Point = gp_XYZ(X3, Y3, Z3);
+      if      (Nod22Indices.Edg1 == e) Nod22RValues.PCu1 = U3;
+      else if (Nod22Indices.Edg2 == e) Nod22RValues.PCu2 = U3;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i2p2 << endl;
       }
 #endif
-      Nod22Scal = 0;
-      Nod22Flag |=  NMskOutL;
+      Nod22RValues.Scal = 0;
+      Nod22Indices.Flag |=  NMsk_OutL;
       UpdateAroundNode(i2p2,Nod22Indices,TData2,PISeg2,PINod2);
     }
   }
@@ -2162,22 +1721,22 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
       (Nod21RValues,Nod22RValues,PINod2,PINod1,coef3,X3,Y3,Z3); 
     const Handle(HLRAlgo_PolyInternalNode)* pi1p3 =
       &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(i1p3));
-    const Standard_Address Nod13Indices = (*pi1p3)->Indices();
-    const Standard_Address Nod13RValues = (*pi1p3)->RValues();
+    HLRAlgo_PolyInternalNode::NodeIndices& Nod13Indices = (*pi1p3)->Indices();
+    HLRAlgo_PolyInternalNode::NodeData& Nod13RValues = (*pi1p3)->Data();
     const Handle(HLRAlgo_PolyInternalNode)* pi2p3 =
       &(((HLRAlgo_Array1OfPINod*)PINod2)->ChangeValue(i2p3));
-    const Standard_Address Nod23Indices = (*pi2p3)->Indices();
-    const Standard_Address Nod23RValues = (*pi2p3)->RValues();
-    Nod13Edg1  = e;
-    Nod13PCu1  = U3;
-    Nod13Scal  = 0;
-    Nod13Flag |= NMskOutL;
-    Nod13Flag |= NMskEdge;
-    Nod23Edg1  = e;
-    Nod23PCu1  = U3;
-    Nod23Scal  = 0;
-    Nod23Flag |= NMskOutL;
-    Nod23Flag |= NMskEdge;
+    HLRAlgo_PolyInternalNode::NodeIndices& Nod23Indices = (*pi2p3)->Indices();
+    HLRAlgo_PolyInternalNode::NodeData& Nod23RValues = (*pi2p3)->Data();
+    Nod13Indices.Edg1  = e;
+    Nod13RValues.PCu1  = U3;
+    Nod13RValues.Scal  = 0;
+    Nod13Indices.Flag |= NMsk_OutL;
+    Nod13Indices.Flag |= NMsk_Edge;
+    Nod23Indices.Edg1  = e;
+    Nod23RValues.PCu1  = U3;
+    Nod23RValues.Scal  = 0;
+    Nod23Indices.Flag |= NMsk_OutL;
+    Nod23Indices.Flag |= NMsk_Edge;
     pid1->UpdateLinks(i1p1,i1p2,i1p3,
                      TData1,TData2,PISeg1,PISeg2,PINod1,PINod2);
     pid2->UpdateLinks(i2p1,i2p2,i2p3,
@@ -2223,28 +1782,28 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
                   const Standard_Integer e,
                   Standard_Real& U1,
                   Standard_Real& U2,
-                  Standard_Address& Nod11Indices,
-                  Standard_Address& Nod11RValues,
-                  Standard_Address& Nod12Indices,
-                  Standard_Address& Nod12RValues,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod11RValues,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod12RValues,
                   const Standard_Integer i1p1,
                   const Standard_Integer i1p2,
                   const Standard_Integer i1,
                   const Handle(HLRAlgo_PolyInternalData)& pid1,
-                  Standard_Address& TData1,
-                  Standard_Address& PISeg1,
-                  Standard_Address& PINod1,
-                  Standard_Address& Nod21Indices,
-                  Standard_Address& Nod21RValues,
-                  Standard_Address& Nod22Indices,
-                  Standard_Address& Nod22RValues,
+                  HLRAlgo_Array1OfTData*& TData1,
+                  HLRAlgo_Array1OfPISeg*& PISeg1,
+                  HLRAlgo_Array1OfPINod*& PINod1,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod21Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod21RValues,
+                  HLRAlgo_PolyInternalNode::NodeIndices& Nod22Indices,
+                  HLRAlgo_PolyInternalNode::NodeData& Nod22RValues,
                   const Standard_Integer i2p1,
                   const Standard_Integer i2p2,
                   const Standard_Integer i2,
                   const Handle(HLRAlgo_PolyInternalData)& pid2,
-                  Standard_Address& TData2,
-                  Standard_Address& PISeg2,
-                  Standard_Address& PINod2,
+                  HLRAlgo_Array1OfTData*& TData2,
+                  HLRAlgo_Array1OfPISeg*& PISeg2,
+                  HLRAlgo_Array1OfPINod*& PINod2,
                   const Standard_Real X3,
                   const Standard_Real Y3,
                   const Standard_Real Z3,
@@ -2270,7 +1829,7 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
   Standard_Boolean ins3 = insP3;
   Standard_Boolean ins4 = insP4;
   if (ins3 && mP3P1) {                             // P1 ---> P3
-    if (!(Nod11Flag & NMskVert) && coef3 < myTolSta) {
+    if (!(Nod11Indices.Flag & NMsk_Vert) && coef3 < myTolSta) {
       ins3 = Standard_False;
       ChangeNode(i1p1,i1p2,
                 Nod11Indices,Nod11RValues,
@@ -2289,45 +1848,37 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
       YTI1 = YTI3;
       ZTI1 = ZTI3;
       U1   = U3;
-      Nod11PntX = X3;
-      Nod11PntY = Y3;
-      Nod11PntZ = Z3;
-      if      (Nod11Edg1 == e) Nod11PCu1 = U3;
-      else if (Nod11Edg2 == e) Nod11PCu2 = U3;
+      Nod11RValues.Point = gp_XYZ(X3, Y3, Z3);
+      if      (Nod11Indices.Edg1 == e) Nod11RValues.PCu1 = U3;
+      else if (Nod11Indices.Edg2 == e) Nod11RValues.PCu2 = U3;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i1p1 << endl;
       }
 #endif
-      Nod11Scal  = 0;
-      Nod11Flag |= NMskOutL;
+      Nod11RValues.Scal  = 0;
+      Nod11Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i1p1,Nod11Indices,TData1,PISeg1,PINod1);
-      Nod21PntX  = X3;
-      Nod21PntY  = Y3;
-      Nod21PntZ  = Z3;
-      if      (Nod21Edg1 == e) Nod21PCu1 = U3;
-      else if (Nod21Edg2 == e) Nod21PCu2 = U3;
+      Nod21RValues.Point = gp_XYZ(X3, Y3, Z3);
+      if      (Nod21Indices.Edg1 == e) Nod21RValues.PCu1 = U3;
+      else if (Nod21Indices.Edg2 == e) Nod21RValues.PCu2 = U3;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i2p1 << endl;
       }
 #endif
-      Nod21Scal  = 0;
-      Nod21Flag |= NMskOutL;
+      Nod21RValues.Scal  = 0;
+      Nod21Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i2p1,Nod21Indices,TData2,PISeg2,PINod2);
-      Standard_Address Coordinates = List.First().Coordinates();
-      PntX2   = X3;
-      PntY2   = Y3;
-      PntZ2   = Z3;
-      PntXTI2 = XTI3;
-      PntYTI2 = YTI3;
-      PntZTI2 = ZTI3;
+      HLRAlgo_BiPoint::PointsT& aPoints = List.First().Points();
+      aPoints.PntP2 = gp_XYZ(X3, Y3, Z3);
+      aPoints.Pnt2 = gp_XYZ(XTI3, YTI3, ZTI3);
     }
   }
   if (ins4 && !mP4P1) {                            // P2 ---> P4
-    if (!(Nod12Flag & NMskVert) && coef4 > myTolEnd) {
+    if (!(Nod12Indices.Flag & NMsk_Vert) && coef4 > myTolEnd) {
       ins4 = Standard_False;
       ChangeNode(i2p1,i2p2,
                 Nod21Indices,Nod21RValues,
@@ -2346,33 +1897,29 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
       YTI2 = YTI4;
       ZTI2 = ZTI4;
       U2   = U4;
-      Nod12PntX = X4;
-      Nod12PntY = Y4;
-      Nod12PntZ = Z4;
-      if      (Nod12Edg1 == e) Nod12PCu1 = U4;
-      else if (Nod12Edg2 == e) Nod12PCu2 = U4;
+      Nod12RValues.Point = gp_XYZ(X4, Y4, Z4);
+      if      (Nod12Indices.Edg1 == e) Nod12RValues.PCu1 = U4;
+      else if (Nod12Indices.Edg2 == e) Nod12RValues.PCu2 = U4;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i1p2 << endl;
       }
 #endif
-      Nod12Scal  = 0;
-      Nod12Flag |= NMskOutL;
+      Nod12RValues.Scal  = 0;
+      Nod12Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i1p2,Nod12Indices,TData1,PISeg1,PINod1);
-      Nod22PntX  = X4;
-      Nod22PntY  = Y4;
-      Nod22PntZ  = Z4;
-      if      (Nod22Edg1 == e) Nod22PCu1 = U4;
-      else if (Nod22Edg2 == e) Nod22PCu2 = U4;
+      Nod22RValues.Point = gp_XYZ(X4, Y4, Z4);
+      if      (Nod22Indices.Edg1 == e) Nod22RValues.PCu1 = U4;
+      else if (Nod22Indices.Edg2 == e) Nod22RValues.PCu2 = U4;
 #ifdef OCCT_DEBUG
       else {
        cout << " HLRBRep_PolyAlgo::MoveOrInsertPoint : ";
        cout << "Parameter error on Node " << i2p2 << endl;
       }
 #endif
-      Nod22Scal  = 0;
-      Nod22Flag |= NMskOutL;
+      Nod22RValues.Scal  = 0;
+      Nod22Indices.Flag |= NMsk_OutL;
       UpdateAroundNode(i2p2,Nod22Indices,TData2,PISeg2,PINod2);
     }
   }
@@ -2412,40 +1959,40 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
        (Nod21RValues,Nod22RValues,PINod2,PINod1,coef4,X4,Y4,Z4);
       const Handle(HLRAlgo_PolyInternalNode)* pi1p3 =
        &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(i1p3));
-      const Standard_Address Nod13Indices = (*pi1p3)->Indices();
-      const Standard_Address Nod13RValues = (*pi1p3)->RValues();
+      HLRAlgo_PolyInternalNode::NodeIndices& Nod13Indices = (*pi1p3)->Indices();
+      HLRAlgo_PolyInternalNode::NodeData& Nod13RValues = (*pi1p3)->Data();
       const Handle(HLRAlgo_PolyInternalNode)* pi1p4 =
        &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(i1p4));
-      const Standard_Address Nod14Indices = (*pi1p4)->Indices();
-      const Standard_Address Nod14RValues = (*pi1p4)->RValues();
+      HLRAlgo_PolyInternalNode::NodeIndices& Nod14Indices = (*pi1p4)->Indices();
+      HLRAlgo_PolyInternalNode::NodeData& Nod14RValues = (*pi1p4)->Data();
       const Handle(HLRAlgo_PolyInternalNode)* pi2p3 =
        &(((HLRAlgo_Array1OfPINod*)PINod2)->ChangeValue(i2p3));
-      const Standard_Address Nod23Indices = (*pi2p3)->Indices();
-      const Standard_Address Nod23RValues = (*pi2p3)->RValues();
+      HLRAlgo_PolyInternalNode::NodeIndices& Nod23Indices = (*pi2p3)->Indices();
+      HLRAlgo_PolyInternalNode::NodeData& Nod23RValues = (*pi2p3)->Data();
       const Handle(HLRAlgo_PolyInternalNode)* pi2p4 = 
        &(((HLRAlgo_Array1OfPINod*)PINod2)->ChangeValue(i2p4));
-      const Standard_Address Nod24Indices = (*pi2p4)->Indices();
-      const Standard_Address Nod24RValues = (*pi2p4)->RValues();
-      Nod13Edg1  = e;
-      Nod13PCu1  = U3;
-      Nod13Scal  = 0;
-      Nod13Flag |= NMskOutL;
-      Nod13Flag |= NMskEdge;
-      Nod23Edg1  = e;
-      Nod23PCu1  = U3;
-      Nod23Scal  = 0;
-      Nod23Flag |= NMskOutL;
-      Nod23Flag |= NMskEdge;
-      Nod14Edg1  = e;
-      Nod14PCu1  = U4;
-      Nod14Scal  = 0;
-      Nod14Flag |= NMskOutL;
-      Nod14Flag |= NMskEdge;
-      Nod24Edg1  = e;
-      Nod24PCu1  = U4;
-      Nod24Scal  = 0;
-      Nod24Flag |= NMskOutL;
-      Nod24Flag |= NMskEdge;
+      HLRAlgo_PolyInternalNode::NodeIndices& Nod24Indices = (*pi2p4)->Indices();
+      HLRAlgo_PolyInternalNode::NodeData& Nod24RValues = (*pi2p4)->Data();
+      Nod13Indices.Edg1  = e;
+      Nod13RValues.PCu1  = U3;
+      Nod13RValues.Scal  = 0;
+      Nod13Indices.Flag |= NMsk_OutL;
+      Nod13Indices.Flag |= NMsk_Edge;
+      Nod23Indices.Edg1  = e;
+      Nod23RValues.PCu1  = U3;
+      Nod23RValues.Scal  = 0;
+      Nod23Indices.Flag |= NMsk_OutL;
+      Nod23Indices.Flag |= NMsk_Edge;
+      Nod14Indices.Edg1  = e;
+      Nod14RValues.PCu1  = U4;
+      Nod14RValues.Scal  = 0;
+      Nod14Indices.Flag |= NMsk_OutL;
+      Nod14Indices.Flag |= NMsk_Edge;
+      Nod24Indices.Edg1  = e;
+      Nod24RValues.PCu1  = U4;
+      Nod24RValues.Scal  = 0;
+      Nod24Indices.Flag |= NMsk_OutL;
+      Nod24Indices.Flag |= NMsk_Edge;
       pid1->UpdateLinks(i1p1,i1p2,i1p3,
                        TData1,TData2,PISeg1,PISeg2,PINod1,PINod2);
       pid2->UpdateLinks(i2p1,i2p2,i2p3,
@@ -2487,12 +2034,9 @@ MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List,
 void
 HLRBRep_PolyAlgo::InsertOnOutLine (TColStd_Array1OfTransient& PID)
 {
-  Standard_Address TData2 = 0;
-  Standard_Address PISeg2 = 0;
-  Standard_Address PINod2 = 0;
-  Standard_Address Seg1Indices;
-  Standard_Address Nod1Indices,Nod1RValues;
-  Standard_Address Nod2Indices,Nod2RValues;
+  HLRAlgo_Array1OfTData* TData2 = 0;
+  HLRAlgo_Array1OfPISeg* PISeg2 = 0;
+  HLRAlgo_Array1OfPINod* PINod2 = 0;
   Handle(HLRAlgo_PolyInternalData)* pid = 
     (Handle(HLRAlgo_PolyInternalData)*) (&(PID.ChangeValue(1)));
 
@@ -2508,9 +2052,9 @@ HLRBRep_PolyAlgo::InsertOnOutLine (TColStd_Array1OfTransient& PID)
 
     if (!((*pid).IsNull())) {
       IntOutL = Standard_False;
-      Standard_Address TData1= &((*pid)->TData());
-      Standard_Address PISeg1= &((*pid)->PISeg());
-      Standard_Address PINod1= &((*pid)->PINod());
+      HLRAlgo_Array1OfTData* TData1= &((*pid)->TData());
+      HLRAlgo_Array1OfPISeg* PISeg1= &(*pid)->PISeg();
+      HLRAlgo_Array1OfPINod* PINod1= &((*pid)->PINod());
       TopoDS_Shape LocalShape = myFMap(f);
       const TopoDS_Face& F = TopoDS::Face(LocalShape);
       myBSurf.Initialize(F,Standard_False);
@@ -2543,26 +2087,23 @@ HLRBRep_PolyAlgo::InsertOnOutLine (TColStd_Array1OfTransient& PID)
       Standard_Integer iseg,nbS;
       nbS = (*pid)->NbPISeg();
       for (iseg = 1; iseg <= nbS; iseg++) {
-       Seg1Indices =
-         ((HLRAlgo_Array1OfPISeg*)PISeg1)->ChangeValue(iseg).Indices();
+        HLRAlgo_PolyInternalSegment& aSegIndices = PISeg1->ChangeValue(iseg);
 //     Standard_Boolean Cutted = Standard_False;
-       if (Seg1Conex1 != 0 && Seg1Conex2 != 0) {
-         ip1 = Seg1LstSg1;
-         ip2 = Seg1LstSg2;
-         const Handle(HLRAlgo_PolyInternalNode)* pip1 =
-           &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip1));
-         Nod1Indices = (*pip1)->Indices();
-         Nod1RValues = (*pip1)->RValues();
-         const Handle(HLRAlgo_PolyInternalNode)* pip2 =
-           &(((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip2));
-         Nod2Indices = (*pip2)->Indices();
-         Nod2RValues = (*pip2)->RValues();
-         if (Nod1Flag & NMskOutL && Nod2Flag & NMskOutL)
+       if (aSegIndices.Conex1 != 0 && aSegIndices.Conex2 != 0) {
+         ip1 = aSegIndices.LstSg1;
+         ip2 = aSegIndices.LstSg2;
+         const Handle(HLRAlgo_PolyInternalNode)* pip1 = &PINod1->ChangeValue(ip1);
+         HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices = (*pip1)->Indices();
+         HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*pip1)->Data();
+         const Handle(HLRAlgo_PolyInternalNode)* pip2 = &PINod1->ChangeValue(ip2);
+         HLRAlgo_PolyInternalNode::NodeIndices& Nod2Indices = (*pip2)->Indices();
+         HLRAlgo_PolyInternalNode::NodeData& Nod2RValues = (*pip2)->Data();
+         if (Nod1Indices.Flag & NMsk_OutL && Nod2Indices.Flag & NMsk_OutL)
            IntOutL = Standard_True;
-         else if ((Nod1Scal >=  myTolAngular &&
-                   Nod2Scal <= -myTolAngular) ||
-                  (Nod2Scal >=  myTolAngular &&
-                   Nod1Scal <= -myTolAngular)) {
+         else if ((Nod1RValues.Scal >=  myTolAngular &&
+                   Nod2RValues.Scal <= -myTolAngular) ||
+                  (Nod2RValues.Scal >=  myTolAngular &&
+                   Nod1RValues.Scal <= -myTolAngular)) {
            IntOutL = Standard_True;
            insP3 = NewNode(Nod1RValues,Nod2RValues,coef3,mP3P1);
            if (insP3) {
@@ -2575,27 +2116,27 @@ HLRBRep_PolyAlgo::InsertOnOutLine (TColStd_Array1OfTransient& PID)
            }
            
            if (insP3 && mP3P1) {                        // P1 ---> P3
-             if ((Nod1Flag & NMskEdge) == 0 && coef3 < myTolSta) {
+             if ((Nod1Indices.Flag & NMsk_Edge) == 0 && coef3 < myTolSta) {
                insP3 = Standard_False;
                ChangeNode(ip1,ip2,
                           Nod1Indices,Nod1RValues,
                           Nod2Indices,Nod2RValues,
                           coef3,X3,Y3,Z3,Standard_True,
                           TData1,PISeg1,PINod1);
-               Nod1Scal  = 0;
-               Nod1Flag |= NMskOutL;
+               Nod1RValues.Scal  = 0;
+               Nod1Indices.Flag |= NMsk_OutL;
              }
            }
            if (insP3 && !mP3P1) {                       // P2 ---> P3
-             if ((Nod2Flag & NMskEdge) == 0 && coef3 > myTolEnd) {
+             if ((Nod2Indices.Flag & NMsk_Edge) == 0 && coef3 > myTolEnd) {
                insP3 = Standard_False;
                ChangeNode(ip1,ip2,
                           Nod1Indices,Nod1RValues,
                           Nod2Indices,Nod2RValues,
                           coef3,X3,Y3,Z3,Standard_False,
                           TData1,PISeg1,PINod1);
-               Nod2Scal  = 0;
-               Nod2Flag |= NMskOutL;
+               Nod2RValues.Scal  = 0;
+               Nod2Indices.Flag |= NMsk_OutL;
              }
            }
            if (insP3) {                                 // p1 ip3 p2
@@ -2603,13 +2144,13 @@ HLRBRep_PolyAlgo::InsertOnOutLine (TColStd_Array1OfTransient& PID)
                                    coef3,X3,Y3,Z3);
              const Handle(HLRAlgo_PolyInternalNode)* pip3 =
                (&((HLRAlgo_Array1OfPINod*)PINod1)->ChangeValue(ip3));
-             const Standard_Address Nod3Indices = (*pip3)->Indices();
-             const Standard_Address Nod3RValues = (*pip3)->RValues();
+             HLRAlgo_PolyInternalNode::NodeIndices& Nod3Indices = (*pip3)->Indices();
+             HLRAlgo_PolyInternalNode::NodeData& Nod3RValues = (*pip3)->Data();
              (*pid)->UpdateLinks(ip1,ip2,ip3,
                                  TData1,TData2,PISeg1,PISeg2,PINod1,PINod2);
              UpdateAroundNode(ip3,Nod3Indices,TData1,PISeg1,PINod1);
-             Nod3Scal  = 0;
-             Nod3Flag |= NMskOutL;
+             Nod3RValues.Scal  = 0;
+             Nod3Indices.Flag |= NMsk_OutL;
            }
          }
        }
@@ -2645,24 +2186,35 @@ HLRBRep_PolyAlgo::CheckFrBackTriangles (HLRAlgo_ListOfBPoint& List,
   Standard_Real D1,D2,D3;
   Standard_Real dd,dX,dY,nX,nY;
   Standard_Boolean FrBackInList;
-  Standard_Address TData ,PISeg ,PINod ;
-/*  Standard_Address IndexPtr = NULL; 
-  const Handle(HLRAlgo_PolyInternalData)& pid1 =
-    *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F1Index));
-  Standard_Address TData1 = &pid1->TData(),
-  PISeg1 = &pid1->PISeg(),
-  PINod1 = &pid1->PINod();
-
-  const Handle(HLRAlgo_PolyInternalData)& pid2 =
-    *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F2Index));
-  Standard_Address TData2 = &pid2->TData(),
-  PISeg2 = &pid2->PISeg(),
-  PINod2 = &pid2->PISeg();*/
-  Standard_Address TData1 = NULL,PISeg1 = NULL,PINod1 = NULL;
-  Standard_Address TData2 = NULL,PISeg2 = NULL,PINod2 = NULL;
-  Standard_Address Nod11Indices,Nod12Indices,Nod13Indices;
-  Standard_Address Nod11RValues,Nod12RValues,Nod13RValues;
-  Standard_Address Tri1Indices;
+  HLRAlgo_Array1OfTData* TData;
+  HLRAlgo_Array1OfPISeg* PISeg;
+  HLRAlgo_Array1OfPINod* PINod;
+
+  //Standard_Address IndexPtr = NULL; 
+  //const Handle(HLRAlgo_PolyInternalData)& pid1 =
+  //  *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F1Index));
+  //Standard_Address TData1 = &pid1->TData(),
+  //PISeg1 = &pid1->PISeg(),
+  //PINod1 = &pid1->PINod();
+
+  //const Handle(HLRAlgo_PolyInternalData)& pid2 =
+  //  *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F2Index));
+  //Standard_Address TData2 = &pid2->TData(),
+  //PISeg2 = &pid2->PISeg(),
+  //PINod2 = &pid2->PISeg();
+
+  HLRAlgo_Array1OfTData* TData1 = NULL;
+  HLRAlgo_Array1OfPISeg* PISeg1 = NULL;
+  HLRAlgo_Array1OfPINod* PINod1 = NULL;
+  HLRAlgo_Array1OfTData* TData2 = NULL;
+  HLRAlgo_Array1OfPISeg* PISeg2 = NULL;
+  HLRAlgo_Array1OfPINod* PINod2 = NULL;
+  HLRAlgo_PolyInternalNode::NodeIndices* Nod11Indices;
+  HLRAlgo_PolyInternalNode::NodeIndices* Nod12Indices;
+  HLRAlgo_PolyInternalNode::NodeIndices* Nod13Indices;
+  HLRAlgo_PolyInternalNode::NodeData* Nod11RValues;
+  HLRAlgo_PolyInternalNode::NodeData* Nod12RValues;
+  HLRAlgo_PolyInternalNode::NodeData* Nod13RValues;
 
   Handle(HLRAlgo_PolyInternalData)* pid;
 
@@ -2682,102 +2234,109 @@ HLRBRep_PolyAlgo::CheckFrBackTriangles (HLRAlgo_ListOfBPoint& List,
        TData = &(*pid)->TData();
        PISeg = &(*pid)->PISeg();
        PINod = &(*pid)->PINod();
-       HLRAlgo_TriangleData* tdata =
-         &(((HLRAlgo_Array1OfTData*)TData)->ChangeValue(1));
+       HLRAlgo_TriangleData* tdata = &TData->ChangeValue(1);
        
        for (i = 1; i <= nbT; i++) {
-         Tri1Indices = tdata->Indices();
-         if ((Tri1Flags & FMskSide) == 0 &&
-             (Tri1Flags & FMskFrBack)) {
+         if ((tdata->Flags & HLRAlgo_PolyMask_FMskSide) == 0 &&
+             (tdata->Flags & HLRAlgo_PolyMask_FMskFrBack)) {
 #ifdef OCCT_DEBUG
            if (DoTrace)
              cout << " face : " << f << " , triangle " << i << endl;
 #endif
            Modif        = Standard_True;
            const Handle(HLRAlgo_PolyInternalNode)* pi1p1 =
-             &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node1));
-           Nod11Indices = (*pi1p1)->Indices();
-           Nod11RValues = (*pi1p1)->RValues();
+             &PINod->ChangeValue(tdata->Node1);
+           Nod11Indices = &(*pi1p1)->Indices();
+           Nod11RValues = &(*pi1p1)->Data();
            const Handle(HLRAlgo_PolyInternalNode)* pi1p2 =
-             &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node2));
-           Nod12Indices = (*pi1p2)->Indices();
-           Nod12RValues = (*pi1p2)->RValues();
+             &PINod->ChangeValue(tdata->Node2);
+           Nod12Indices = &(*pi1p2)->Indices();
+           Nod12RValues = &(*pi1p2)->Data();
            const Handle(HLRAlgo_PolyInternalNode)* pi1p3 =
-             &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node3));
-           Nod13Indices = (*pi1p3)->Indices();
-           Nod13RValues = (*pi1p3)->RValues();
+        &PINod->ChangeValue(tdata->Node3);
+           Nod13Indices = &(*pi1p3)->Indices();
+           Nod13RValues = &(*pi1p3)->Data();
            D1 = 0.; D2 = 0.; D3 = 0.;
-           if (((Nod11Flag & NMskEdge) == 0 || iLoop > 1) &&
-               ((Nod11Flag & NMskOutL) == 0 || iLoop > 1) &&
-               ((Nod11Flag & NMskVert) == 0)) {
-             dX = Nod13PntX - Nod12PntX; dY = Nod13PntY - Nod12PntY;
+           if (((Nod11Indices->Flag & NMsk_Edge) == 0 || iLoop > 1) &&
+               ((Nod11Indices->Flag & NMsk_OutL) == 0 || iLoop > 1) &&
+               ((Nod11Indices->Flag & NMsk_Vert) == 0)) {
+        dX = Nod13RValues->Point.X() - Nod12RValues->Point.X();
+        dY = Nod13RValues->Point.Y() - Nod12RValues->Point.Y();
              D1 = dX * dX + dY * dY;
              D1 = sqrt(D1);
              nX = - dY / D1; nY =   dX / D1;
-             dX = Nod11PntX - Nod12PntX; dY = Nod11PntY - Nod12PntY;
+             dX = Nod11RValues->Point.X() - Nod12RValues->Point.X();
+        dY = Nod11RValues->Point.Y() - Nod12RValues->Point.Y();
              dd = - (dX * nX + dY * nY);
              if (dd < 0) dd -= D1 * 0.01;
              else        dd += D1 * 0.01;
              X1 = nX * dd; Y1 = nY * dd;
            }
-           if (((Nod12Flag & NMskEdge) == 0 || iLoop > 1) &&
-               ((Nod12Flag & NMskOutL) == 0 || iLoop > 1) &&
-               ((Nod12Flag & NMskVert) == 0)) {
-             dX = Nod11PntX - Nod13PntX; dY = Nod11PntY - Nod13PntY;
+           if (((Nod12Indices->Flag & NMsk_Edge) == 0 || iLoop > 1) &&
+               ((Nod12Indices->Flag & NMsk_OutL) == 0 || iLoop > 1) &&
+               ((Nod12Indices->Flag & NMsk_Vert) == 0)) {
+        dX = Nod11RValues->Point.X() - Nod13RValues->Point.X();
+        dY = Nod11RValues->Point.Y() - Nod13RValues->Point.Y();
              D2 = dX * dX + dY * dY;
              D2 = sqrt(D2);
              nX = - dY / D2; nY =   dX / D2;
-             dX = Nod12PntX - Nod13PntX; dY = Nod12PntY - Nod13PntY;
+        dX = Nod12RValues->Point.X() - Nod13RValues->Point.X();
+        dY = Nod12RValues->Point.Y() - Nod13RValues->Point.Y();
              dd = - (dX * nX + dY * nY);
              if (dd < 0) dd -= D2 * 0.01;
              else        dd += D2 * 0.01;
              X2 = nX * dd; Y2 = nY * dd;
            }
-           if (((Nod13Flag & NMskEdge) == 0 || iLoop > 1) &&
-               ((Nod13Flag & NMskOutL) == 0 || iLoop > 1) &&
-               ((Nod13Flag & NMskVert) == 0)) {
-             dX = Nod12PntX - Nod11PntX; dY = Nod12PntY - Nod11PntY;
+           if (((Nod13Indices->Flag & NMsk_Edge) == 0 || iLoop > 1) &&
+               ((Nod13Indices->Flag & NMsk_OutL) == 0 || iLoop > 1) &&
+               ((Nod13Indices->Flag & NMsk_Vert) == 0)) {
+        dX = Nod12RValues->Point.X() - Nod11RValues->Point.X();
+        dY = Nod12RValues->Point.Y() - Nod11RValues->Point.Y();
              D3 = dX * dX + dY * dY;
              D3 = sqrt(D3);
              nX = - dY / D3; nY =   dX / D3;
-             dX = Nod13PntX - Nod11PntX; dY = Nod13PntY - Nod11PntY;
+        dX = Nod13RValues->Point.X() - Nod11RValues->Point.X();
+        dY = Nod13RValues->Point.Y() - Nod11RValues->Point.Y();
              dd = - (dX * nX + dY * nY);
              if (dd < 0) dd -= D3 * 0.01;
              else        dd += D3 * 0.01;
              X3 = nX * dd; Y3 = nY * dd;
            }
            if      (D1 > D2 && D1 > D3) {
-             Nod11PntX += X1; Nod11PntY += Y1;
-             Nod11Flag |= NMskMove;
-             UpdateAroundNode(Tri1Node1,Nod11Indices,TData,PISeg,PINod);
+        Nod11RValues->Point.ChangeCoord(1) += X1;
+        Nod11RValues->Point.ChangeCoord(2) += Y1;
+             Nod11Indices->Flag |= NMsk_Move;
+             UpdateAroundNode(tdata->Node1,*Nod11Indices,TData,PISeg,PINod);
              FrBackInList = Standard_True;
 #ifdef OCCT_DEBUG
              if (DoTrace) {
-               cout << Tri1Node1 << " modifies  : DX,DY ";
+               cout << tdata->Node1 << " modifies  : DX,DY ";
                cout << X1 << " , " << Y1 << endl;
              }
 #endif
            }
            else if (D2 > D3 && D2 > D1) {
-             Nod12PntX += X2; Nod12PntY += Y2;
-             Nod12Flag |= NMskMove;
-             UpdateAroundNode(Tri1Node2,Nod12Indices,TData,PISeg,PINod);
+        Nod12RValues->Point.ChangeCoord(1) += X2;
+        Nod12RValues->Point.ChangeCoord(2) += Y2;
+             Nod12Indices->Flag |= NMsk_Move;
+             UpdateAroundNode(tdata->Node2,*Nod12Indices,TData,PISeg,PINod);
              FrBackInList = Standard_True;
 #ifdef OCCT_DEBUG
              if (DoTrace) {
-               cout << Tri1Node2 << " modifies  : DX,DY ";
+               cout << tdata->Node2 << " modifies  : DX,DY ";
                cout << X2 << " , " << Y2 << endl;
              }
 #endif
            }
            else if (D3 > D1 && D3 > D2) {
-             Nod13PntX += X3; Nod13PntY += Y3;
-             Nod13Flag |= NMskMove;
-             UpdateAroundNode(Tri1Node3,Nod13Indices,TData,PISeg,PINod);
+        Nod13RValues->Point.ChangeCoord(1) += X3;
+        Nod13RValues->Point.ChangeCoord(2) += Y3;
+             Nod13Indices->Flag |= NMsk_Move;
+             UpdateAroundNode(tdata->Node3,*Nod13Indices,TData,PISeg,PINod);
              FrBackInList = Standard_True;
 #ifdef OCCT_DEBUG
              if (DoTrace) {
-               cout << Tri1Node3 << " modifies  : DX,DY ";
+               cout << tdata->Node3 << " modifies  : DX,DY ";
                cout << X3 << " , " << Y3 << endl;
              }
 #endif
@@ -2793,136 +2352,111 @@ HLRBRep_PolyAlgo::CheckFrBackTriangles (HLRAlgo_ListOfBPoint& List,
       pid++;
     }
     if (FrBackInList) {
-      Standard_Address IndexPtr,Coordinates;
       HLRAlgo_ListIteratorOfListOfBPoint it;
       
       for (it.Initialize(List); it.More(); it.Next()) {      
        HLRAlgo_BiPoint& BP = it.Value();
-       IndexPtr = BP.Indices();
-       if (F1Index != 0) {
+       HLRAlgo_BiPoint::IndicesT& theIndices = BP.Indices();
+       if (theIndices.FaceConex1 != 0) {
          const Handle(HLRAlgo_PolyInternalData)& pid1 =
-           *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F1Index));
+           *(Handle(HLRAlgo_PolyInternalData)*)&(PID(theIndices.FaceConex1));
          TData1 = &pid1->TData();
          PISeg1 = &pid1->PISeg();
          PINod1 = &pid1->PINod();
        }
-       if (F2Index != 0) {
-         if (F1Index == F2Index) {
+       if (theIndices.FaceConex2 != 0) {
+         if (theIndices.FaceConex1 == theIndices.FaceConex2) {
            TData2 = TData1;
            PISeg2 = PISeg1;
            PINod2 = PINod1;
          }
          else {
            const Handle(HLRAlgo_PolyInternalData)& pid2 =
-             *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F2Index));
+             *(Handle(HLRAlgo_PolyInternalData)*)&(PID(theIndices.FaceConex2));
            TData2 = &pid2->TData();
            PISeg2 = &pid2->PISeg();
            PINod2 = &pid2->PINod();
          }
        }
-       if (F1Index != 0) {
-         Nod11Indices = (((HLRAlgo_Array1OfPINod*)PINod1)->
-                         ChangeValue(F1Pt1Index))->Indices();
-         if (Nod11Flag & NMskMove) {
+       if (theIndices.FaceConex1 != 0) {
+         Nod11Indices = &PINod1->ChangeValue(theIndices.Face1Pt1)->Indices();
+         if (Nod11Indices->Flag & NMsk_Move) {
 #ifdef OCCT_DEBUG
            if (DoTrace)
-             cout << F1Pt1Index << " modifies 11" << endl;
+             cout << theIndices.Face1Pt1 << " modifies 11" << endl;
 #endif
-           Nod11RValues = (((HLRAlgo_Array1OfPINod*)PINod1)->
-                           ChangeValue(F1Pt1Index))->RValues();
-           Coordinates = BP.Coordinates();
-           PntXTI1 = PntX1 = Nod11PntX;
-           PntYTI1 = PntY1 = Nod11PntY;
-           PntZTI1 = PntZ1 = Nod11PntZ;
-           TIMultiply(PntXTI1,PntYTI1,PntZTI1);
-           if (F2Index != 0) {
-             Nod12Indices = (((HLRAlgo_Array1OfPINod*)PINod2)->
-                             ChangeValue(F2Pt1Index))->Indices();
-             Nod12RValues = (((HLRAlgo_Array1OfPINod*)PINod2)->
-                             ChangeValue(F2Pt1Index))->RValues();
-             Nod12PntX    = Nod11PntX;
-             Nod12PntY    = Nod11PntY;
-             UpdateAroundNode(F2Pt1Index,Nod12Indices,
+           Nod11RValues = &PINod1->ChangeValue(theIndices.Face1Pt1)->Data();
+           HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+      aPoints.Pnt1 = aPoints.PntP1 = Nod11RValues->Point;
+           TIMultiply(aPoints.Pnt1);
+           if (theIndices.FaceConex2 != 0) {
+             Nod12Indices = &PINod2->ChangeValue(theIndices.Face2Pt1)->Indices();
+             Nod12RValues = &PINod2->ChangeValue(theIndices.Face2Pt1)->Data();
+        Nod12RValues->Point.ChangeCoord(1) = Nod11RValues->Point.X();
+        Nod12RValues->Point.ChangeCoord(2) = Nod11RValues->Point.Y();
+             UpdateAroundNode(theIndices.Face2Pt1,*Nod12Indices,
                               TData2,PISeg2,PINod2);
            }
          }
-         Nod11Indices = (((HLRAlgo_Array1OfPINod*)PINod1)->
-                         ChangeValue(F1Pt2Index))->Indices();
-         if (Nod11Flag & NMskMove) {
+         Nod11Indices = &PINod1->ChangeValue(theIndices.Face1Pt2)->Indices();
+         if (Nod11Indices->Flag & NMsk_Move) {
 #ifdef OCCT_DEBUG
            if (DoTrace)
-             cout << F1Pt2Index << " modifies 12" << endl;
+             cout << theIndices.Face1Pt2 << " modifies 12" << endl;
 #endif
-           Nod11RValues = (((HLRAlgo_Array1OfPINod*)PINod1)->
-                           ChangeValue(F1Pt2Index))->RValues();
-           Coordinates = BP.Coordinates();
-           PntXTI2 = PntX2 = Nod11PntX;
-           PntYTI2 = PntY2 = Nod11PntY;
-           PntZTI2 = PntZ2 = Nod11PntZ;
-           TIMultiply(PntXTI2,PntYTI2,PntZTI2);
-           if (F2Index != 0) {
-             Nod12Indices = (((HLRAlgo_Array1OfPINod*)PINod2)->
-                             ChangeValue(F2Pt2Index))->Indices();
-             Nod12RValues = (((HLRAlgo_Array1OfPINod*)PINod2)->
-                             ChangeValue(F2Pt2Index))->RValues();
-             Nod12PntX    = Nod11PntX;
-             Nod12PntY    = Nod11PntY;
-             UpdateAroundNode(F2Pt2Index,Nod12Indices,
+           Nod11RValues = &PINod1->ChangeValue(theIndices.Face1Pt2)->Data();
+           HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+           aPoints.Pnt2 = aPoints.PntP2 = Nod11RValues->Point;
+           TIMultiply(aPoints.Pnt2);
+           if (theIndices.FaceConex2 != 0) {
+             Nod12Indices = &PINod2->ChangeValue(theIndices.Face2Pt2)->Indices();
+             Nod12RValues = &PINod2->ChangeValue(theIndices.Face2Pt2)->Data();
+        Nod12RValues->Point.ChangeCoord(1) = Nod11RValues->Point.X();
+        Nod12RValues->Point.ChangeCoord(2) = Nod11RValues->Point.Y();
+             UpdateAroundNode(theIndices.Face2Pt2,*Nod12Indices,
                               TData2,PISeg2,PINod2);
            }
          }
        }
-       if (F2Index != 0) {
+       if (theIndices.FaceConex2 != 0) {
          const Handle(HLRAlgo_PolyInternalData)& pid2 =
-           *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F2Index));
+           *(Handle(HLRAlgo_PolyInternalData)*)&(PID(theIndices.FaceConex2));
          PINod2 = &pid2->PINod();
-         Nod11Indices = (((HLRAlgo_Array1OfPINod*)PINod2)->
-                         ChangeValue(F2Pt1Index))->Indices();
-         if (Nod11Flag & NMskMove) {
+         Nod11Indices = &PINod2->ChangeValue(theIndices.Face2Pt1)->Indices();
+         if (Nod11Indices->Flag & NMsk_Move) {
 #ifdef OCCT_DEBUG
            if (DoTrace)
-             cout << F2Pt1Index << " modifies 21" << endl;
+             cout << theIndices.Face2Pt1 << " modifies 21" << endl;
 #endif
-           Nod11RValues = (((HLRAlgo_Array1OfPINod*)PINod2)->
-                           ChangeValue(F2Pt1Index))->RValues();
-           Coordinates = BP.Coordinates();
-           PntXTI1 = PntX1 = Nod11PntX;
-           PntYTI1 = PntY1 = Nod11PntY;
-           PntZTI1 = PntZ1 = Nod11PntZ;
-           TIMultiply(PntXTI1,PntYTI1,PntZTI1);
-           if (F1Index != 0) {
-             Nod12Indices = (((HLRAlgo_Array1OfPINod*)PINod1)->
-                             ChangeValue(F1Pt1Index))->Indices();
-             Nod12RValues = (((HLRAlgo_Array1OfPINod*)PINod1)->
-                             ChangeValue(F1Pt1Index))->RValues();
-             Nod12PntX    = Nod11PntX;
-             Nod12PntY    = Nod11PntY;
-             UpdateAroundNode(F1Pt1Index,Nod12Indices,
+           Nod11RValues = &PINod2->ChangeValue(theIndices.Face2Pt1)->Data();
+           HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+      aPoints.Pnt1 = aPoints.PntP1 = Nod11RValues->Point;
+           TIMultiply(aPoints.Pnt1);
+           if (theIndices.FaceConex1 != 0) {
+             Nod12Indices = &PINod1->ChangeValue(theIndices.Face1Pt1)->Indices();
+             Nod12RValues = &PINod1->ChangeValue(theIndices.Face1Pt1)->Data();
+        Nod12RValues->Point.ChangeCoord(1) = Nod11RValues->Point.X();
+        Nod12RValues->Point.ChangeCoord(2) = Nod11RValues->Point.Y();
+             UpdateAroundNode(theIndices.Face1Pt1,*Nod12Indices,
                               TData1,PISeg1,PINod1);
            }
          }
-         Nod11Indices = (((HLRAlgo_Array1OfPINod*)PINod2)->
-                         ChangeValue(F2Pt2Index))->Indices();
-         if (Nod11Flag & NMskMove) {
+         Nod11Indices = &PINod2->ChangeValue(theIndices.Face2Pt2)->Indices();
+         if (Nod11Indices->Flag & NMsk_Move) {
 #ifdef OCCT_DEBUG
            if (DoTrace)
-             cout << F2Pt2Index << " modifies 22" << endl;
+             cout << theIndices.Face2Pt2 << " modifies 22" << endl;
 #endif
-           Nod11RValues = (((HLRAlgo_Array1OfPINod*)PINod2)->
-                           ChangeValue(F2Pt2Index))->RValues();
-           Coordinates = BP.Coordinates();
-           PntXTI2 = PntX2 = Nod11PntX;
-           PntYTI2 = PntY2 = Nod11PntY;
-           PntZTI2 = PntZ2 = Nod11PntZ;
-           TIMultiply(PntXTI2,PntYTI2,PntZTI2);
-           if (F1Index != 0) {
-             Nod12Indices = (((HLRAlgo_Array1OfPINod*)PINod1)->
-                             ChangeValue(F1Pt2Index))->Indices();
-             Nod12RValues = (((HLRAlgo_Array1OfPINod*)PINod1)->
-                             ChangeValue(F1Pt2Index))->RValues();
-             Nod12PntX    = Nod11PntX;
-             Nod12PntY    = Nod11PntY;
-             UpdateAroundNode(F1Pt2Index,Nod12Indices,
+           Nod11RValues = &PINod2->ChangeValue(theIndices.Face2Pt2)->Data();
+           HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+      aPoints.Pnt2 = aPoints.PntP2 = Nod11RValues->Point;
+           TIMultiply(aPoints.Pnt2);
+           if (theIndices.FaceConex1 != 0) {
+             Nod12Indices = &PINod1->ChangeValue(theIndices.Face1Pt2)->Indices();
+             Nod12RValues = &PINod1->ChangeValue(theIndices.Face1Pt2)->Data();
+        Nod12RValues->Point.ChangeCoord(1) = Nod11RValues->Point.X();
+        Nod12RValues->Point.ChangeCoord(2) = Nod11RValues->Point.Y();
+             UpdateAroundNode(theIndices.Face1Pt2,*Nod12Indices,
                               TData1,PISeg1,PINod1);
            }
          }
@@ -2934,13 +2468,11 @@ HLRBRep_PolyAlgo::CheckFrBackTriangles (HLRAlgo_ListOfBPoint& List,
        if (!(*pid).IsNull()) {
          nbN   =  (*pid)->NbPINod();
          PINod = &(*pid)->PINod();
-         Handle(HLRAlgo_PolyInternalNode)* NN = 
-           &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(1));
 
-         for (i = 1; i <= nbN; i++) {
-           Nod11Indices = (*NN)->Indices();
-           Nod11Flag   &= ~NMskMove;
-           NN++;
+    for (i = 1; i <= nbN; i++)
+    {
+      Nod11Indices = &PINod->ChangeValue(i)->Indices();
+           Nod11Indices->Flag   &= ~NMsk_Move;
          }
        }
        pid++;
@@ -2956,15 +2488,15 @@ HLRBRep_PolyAlgo::CheckFrBackTriangles (HLRAlgo_ListOfBPoint& List,
 
 void
 HLRBRep_PolyAlgo::
-FindEdgeOnTriangle (const Standard_Address Tri1Indices,
+FindEdgeOnTriangle (const HLRAlgo_TriangleData& theTriangle,
                    const Standard_Integer ip1,
                    const Standard_Integer ip2,
                    Standard_Integer& jtrouv,
                    Standard_Boolean& isDirect) const
 {
-  Standard_Integer n1 = Tri1Node1;
-  Standard_Integer n2 = Tri1Node2;
-  Standard_Integer n3 = Tri1Node3;
+  Standard_Integer n1 = theTriangle.Node1;
+  Standard_Integer n2 = theTriangle.Node2;
+  Standard_Integer n3 = theTriangle.Node3;
   if      (ip1 == n1 && ip2 == n2) {
     jtrouv = 0;
     isDirect = Standard_True;
@@ -3004,40 +2536,31 @@ FindEdgeOnTriangle (const Standard_Address Tri1Indices,
 
 void HLRBRep_PolyAlgo::ChangeNode (const Standard_Integer ip1,
                                   const Standard_Integer ip2,
-                                  const Standard_Address Nod1Indices,
-                                  const Standard_Address Nod1RValues,
-                                  const Standard_Address Nod2Indices,
-                                  const Standard_Address Nod2RValues,
+                                  HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices,
+                                  HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
+                                  HLRAlgo_PolyInternalNode::NodeIndices& Nod2Indices,
+                                  HLRAlgo_PolyInternalNode::NodeData& Nod2RValues,
                                   const Standard_Real coef1,
                                   const Standard_Real X3,
                                   const Standard_Real Y3,
                                   const Standard_Real Z3,
                                   const Standard_Boolean first,
-                                  Standard_Address& TData,
-                                  Standard_Address& PISeg,
-                                  Standard_Address& PINod) const
+                                  HLRAlgo_Array1OfTData*& TData,
+                                  HLRAlgo_Array1OfPISeg*& PISeg,
+                                  HLRAlgo_Array1OfPINod*& PINod) const
 {
   Standard_Real coef2 = 1 - coef1;
   if (first) {
-    Nod1PntX = X3;
-    Nod1PntY = Y3;
-    Nod1PntZ = Z3;
-    Nod1PntU = Nod1PntU * coef2 + Nod2PntU * coef1;
-    Nod1PntV = Nod1PntV * coef2 + Nod2PntV * coef1; 
-    Nod1Scal = Nod1Scal * coef2 + Nod2Scal * coef1;
-    Standard_Real x = Nod1NrmX * coef2 + Nod2NrmX * coef1;
-    Standard_Real y = Nod1NrmY * coef2 + Nod2NrmY * coef1;
-    Standard_Real z = Nod1NrmZ * coef2 + Nod2NrmZ * coef1;
-    Standard_Real D = sqrt (x * x + y * y + z * z);
-    if (D > 0) {
-      Nod1NrmX = x / D;
-      Nod1NrmY = y / D;
-      Nod1NrmZ = z / D;
+    Nod1RValues.Point = gp_XYZ(X3, Y3, Z3);
+    Nod1RValues.UV = coef2 * Nod1RValues.UV + coef1 * Nod2RValues.UV;
+    Nod1RValues.Scal = Nod1RValues.Scal * coef2 + Nod2RValues.Scal * coef1;
+    const gp_XYZ aXYZ = coef2 * Nod1RValues.Normal + coef1 * Nod2RValues.Normal;
+    const Standard_Real aNorm = aXYZ.Modulus();
+    if (aNorm > 0) {
+      Nod1RValues.Normal = (1 / aNorm) * aXYZ;
     }
     else {
-      Nod1NrmX = 1;
-      Nod1NrmY = 0;
-      Nod1NrmZ = 0;
+      Nod1RValues.Normal = gp_XYZ(1., 0., 0.);
 #ifdef OCCT_DEBUG
       if (DoError) {
        cout << "HLRBRep_PolyAlgo::ChangeNode between " << ip1;
@@ -3048,26 +2571,16 @@ void HLRBRep_PolyAlgo::ChangeNode (const Standard_Integer ip1,
     UpdateAroundNode(ip1,Nod1Indices,TData,PISeg,PINod);
   }
   else {
-    Nod2PntX = X3;
-    Nod2PntY = Y3;
-    Nod2PntZ = Z3;
-    Nod2PntU = Nod1PntU * coef2 + Nod2PntU * coef1;
-    Nod2PntV = Nod1PntV * coef2 + Nod2PntV * coef1; 
-    Nod2Scal = Nod1Scal * coef2 + Nod2Scal * coef1;
-    Standard_Real x = Nod1NrmX * coef2 + Nod2NrmX * coef1;
-    Standard_Real y = Nod1NrmY * coef2 + Nod2NrmY * coef1;
-    Standard_Real z = Nod1NrmZ * coef2 + Nod2NrmZ * coef1;
-    Standard_Real D = sqrt (x * x + y * y + z * z);
-    if (D > 0) {
-      D = 1 / D;
-      Nod2NrmX = x * D;
-      Nod2NrmY = y * D;
-      Nod2NrmZ = z * D;
+    Nod2RValues.Point = gp_XYZ(X3, Y3, Z3);
+    Nod2RValues.UV = coef2 * Nod1RValues.UV + coef1 * Nod2RValues.UV;
+    Nod2RValues.Scal = Nod1RValues.Scal * coef2 + Nod2RValues.Scal * coef1;
+    const gp_XYZ aXYZ = coef2 * Nod1RValues.Normal + coef1 * Nod2RValues.Normal;
+    const Standard_Real aNorm = aXYZ.Modulus();
+    if (aNorm > 0) {
+      Nod2RValues.Normal = (1 / aNorm) * aXYZ;
     }
     else {
-      Nod2NrmX = 1;
-      Nod2NrmY = 0;
-      Nod2NrmZ = 0;
+      Nod2RValues.Normal = gp_XYZ(1., 0., 0.);
 #ifdef OCCT_DEBUG
       if (DoError) {
        cout << "HLRBRep_PolyAlgo::ChangeNode between " << ip2;
@@ -3086,61 +2599,58 @@ void HLRBRep_PolyAlgo::ChangeNode (const Standard_Integer ip1,
 
 void HLRBRep_PolyAlgo::
 UpdateAroundNode (const Standard_Integer iNode,
-                 const Standard_Address Nod1Indices,
-                 const Standard_Address TData,
-                 const Standard_Address PISeg,
-                 const Standard_Address PINod) const
+                 HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices,
+      HLRAlgo_Array1OfTData* TData,
+      HLRAlgo_Array1OfPISeg* PISeg,
+      HLRAlgo_Array1OfPINod* PINod) const
 {
   Standard_Integer iiii,iTri1,iTri2;
-  iiii = Nod1NdSg;
+  iiii = Nod1Indices.NdSg;
   
   while (iiii != 0) {
-    const Standard_Address Seg1Indices =
-      ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-    iTri1 = Seg1Conex1;
-    iTri2 = Seg1Conex2;
+    HLRAlgo_PolyInternalSegment& aSegIndices = PISeg->ChangeValue(iiii);
+    iTri1 = aSegIndices.Conex1;
+    iTri2 = aSegIndices.Conex2;
     if ( iTri1 != 0) {
-      const Standard_Address Tri1Indices =
-       ((HLRAlgo_Array1OfTData*)TData)->ChangeValue(iTri1).Indices();
+      HLRAlgo_TriangleData& aTriangle = TData->ChangeValue(iTri1);
       const Handle(HLRAlgo_PolyInternalNode)* PN1 = 
-       &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node1));
+        &PINod->ChangeValue(aTriangle.Node1);
       const Handle(HLRAlgo_PolyInternalNode)* PN2 = 
-       &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node2));
+        &PINod->ChangeValue(aTriangle.Node2);
       const Handle(HLRAlgo_PolyInternalNode)* PN3 = 
-       &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri1Node3));
-      const Standard_Address aNod1Indices = (*PN1)->Indices();
-      const Standard_Address aNod2Indices = (*PN2)->Indices();
-      const Standard_Address aNod3Indices = (*PN3)->Indices();
-      const Standard_Address aNod1RValues = (*PN1)->RValues();
-      const Standard_Address aNod2RValues = (*PN2)->RValues();
-      const Standard_Address aNod3RValues = (*PN3)->RValues();
-      OrientTriangle(iTri1,Tri1Indices,
+        &PINod->ChangeValue(aTriangle.Node3);
+      HLRAlgo_PolyInternalNode::NodeIndices& aNod1Indices = (*PN1)->Indices();
+      HLRAlgo_PolyInternalNode::NodeIndices& aNod2Indices = (*PN2)->Indices();
+      HLRAlgo_PolyInternalNode::NodeIndices& aNod3Indices = (*PN3)->Indices();
+      HLRAlgo_PolyInternalNode::NodeData& aNod1RValues = (*PN1)->Data();
+      HLRAlgo_PolyInternalNode::NodeData& aNod2RValues = (*PN2)->Data();
+      HLRAlgo_PolyInternalNode::NodeData& aNod3RValues = (*PN3)->Data();
+      OrientTriangle(iTri1,aTriangle,
                     aNod1Indices,aNod1RValues,
                     aNod2Indices,aNod2RValues,
                     aNod3Indices,aNod3RValues);
     }
     if ( iTri2 != 0) {
-      const Standard_Address Tri2Indices =
-       ((HLRAlgo_Array1OfTData*)TData)->ChangeValue(iTri2).Indices();
+      HLRAlgo_TriangleData& aTriangle2 = TData->ChangeValue(iTri2);
       const Handle(HLRAlgo_PolyInternalNode)* PN1 = 
-       &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node1));
+        &PINod->ChangeValue(aTriangle2.Node1);
       const Handle(HLRAlgo_PolyInternalNode)* PN2 = 
-       &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node2));
+        &PINod->ChangeValue(aTriangle2.Node2);
       const Handle(HLRAlgo_PolyInternalNode)* PN3 = 
-       &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(Tri2Node3));
-      const Standard_Address aNod1Indices = (*PN1)->Indices();
-      const Standard_Address aNod2Indices = (*PN2)->Indices();
-      const Standard_Address aNod3Indices = (*PN3)->Indices();
-      const Standard_Address aNod1RValues = (*PN1)->RValues();
-      const Standard_Address aNod2RValues = (*PN2)->RValues();
-      const Standard_Address aNod3RValues = (*PN3)->RValues();
-      OrientTriangle(iTri2,Tri2Indices,
+        &PINod->ChangeValue(aTriangle2.Node3);
+      HLRAlgo_PolyInternalNode::NodeIndices& aNod1Indices = (*PN1)->Indices();
+      HLRAlgo_PolyInternalNode::NodeIndices& aNod2Indices = (*PN2)->Indices();
+      HLRAlgo_PolyInternalNode::NodeIndices& aNod3Indices = (*PN3)->Indices();
+      HLRAlgo_PolyInternalNode::NodeData& aNod1RValues = (*PN1)->Data();
+      HLRAlgo_PolyInternalNode::NodeData& aNod2RValues = (*PN2)->Data();
+      HLRAlgo_PolyInternalNode::NodeData& aNod3RValues = (*PN3)->Data();
+      OrientTriangle(iTri2,aTriangle2,
                     aNod1Indices,aNod1RValues,
                     aNod2Indices,aNod2RValues,
                     aNod3Indices,aNod3RValues);
     }
-    if (Seg1LstSg1 == iNode) iiii = Seg1NxtSg1;
-    else                     iiii = Seg1NxtSg2;
+    if (aSegIndices.LstSg1 == iNode) iiii = aSegIndices.NxtSg1;
+    else                     iiii = aSegIndices.NxtSg2;
   }
 }
 
@@ -3155,23 +2665,23 @@ HLRBRep_PolyAlgo::OrientTriangle(const Standard_Integer iTri,
 #else
 HLRBRep_PolyAlgo::OrientTriangle(const Standard_Integer,
 #endif
-                                const Standard_Address Tri1Indices,
-                                const Standard_Address Nod1Indices,
-                                const Standard_Address Nod1RValues,
-                                const Standard_Address Nod2Indices,
-                                const Standard_Address Nod2RValues,
-                                const Standard_Address Nod3Indices,
-                                const Standard_Address Nod3RValues) const
+                                HLRAlgo_TriangleData& theTriangle,
+                                HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices,
+                                HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
+                                HLRAlgo_PolyInternalNode::NodeIndices& Nod2Indices,
+                                HLRAlgo_PolyInternalNode::NodeData& Nod2RValues,
+                                HLRAlgo_PolyInternalNode::NodeIndices& Nod3Indices,
+                                HLRAlgo_PolyInternalNode::NodeData& Nod3RValues) const
 {
-  Standard_Boolean o1 = (Nod1Flag & NMskOutL) != 0;
-  Standard_Boolean o2 = (Nod2Flag & NMskOutL) != 0;
-  Standard_Boolean o3 = (Nod3Flag & NMskOutL) != 0;
-  Tri1Flags &= ~FMskFlat;
-  Tri1Flags &= ~FMskOnOutL;
+  Standard_Boolean o1 = (Nod1Indices.Flag & NMsk_OutL) != 0;
+  Standard_Boolean o2 = (Nod2Indices.Flag & NMsk_OutL) != 0;
+  Standard_Boolean o3 = (Nod3Indices.Flag & NMsk_OutL) != 0;
+  theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskFlat;
+  theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskOnOutL;
   if (o1 && o2 && o3) {
-    Tri1Flags |=  FMskSide;
-    Tri1Flags &= ~FMskBack;
-    Tri1Flags |=  FMskOnOutL;
+    theTriangle.Flags |=  HLRAlgo_PolyMask_FMskSide;
+    theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskBack;
+    theTriangle.Flags |=  HLRAlgo_PolyMask_FMskOnOutL;
 #ifdef OCCT_DEBUG
     if (DoTrace) {
       cout << "HLRBRep_PolyAlgo::OrientTriangle : OnOutL";
@@ -3180,9 +2690,9 @@ HLRBRep_PolyAlgo::OrientTriangle(const Standard_Integer,
 #endif
   }
   else {
-    Standard_Real s1 = Nod1Scal;
-    Standard_Real s2 = Nod2Scal;
-    Standard_Real s3 = Nod3Scal;
+    Standard_Real s1 = Nod1RValues.Scal;
+    Standard_Real s2 = Nod2RValues.Scal;
+    Standard_Real s3 = Nod3RValues.Scal;
     Standard_Real as1 = s1;
     Standard_Real as2 = s2;
     Standard_Real as3 = s3;
@@ -3195,115 +2705,98 @@ HLRBRep_PolyAlgo::OrientTriangle(const Standard_Integer,
     if (!o2 && as < as2) {s = s2; as = as2;}
     if (!o3 && as < as3) {s = s3; as = as3;}
     if (s > 0) {
-      Tri1Flags &= ~FMskSide;
-      Tri1Flags |=  FMskBack;
+      theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskSide;
+      theTriangle.Flags |=  HLRAlgo_PolyMask_FMskBack;
     }
     else {
-      Tri1Flags &= ~FMskSide;
-      Tri1Flags &= ~FMskBack;
+      theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskSide;
+      theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskBack;
     }
-    Standard_Real dx12 = Nod2PntX - Nod1PntX;
-    Standard_Real dy12 = Nod2PntY - Nod1PntY;
-    Standard_Real dz12 = Nod2PntZ - Nod1PntZ;
-    Standard_Real  d12 = sqrt(dx12 * dx12 + dy12 * dy12 + dz12 * dz12);
-    if (d12 <= 1.e-10) {
+    gp_XYZ aD12 = Nod2RValues.Point - Nod1RValues.Point;
+    const Standard_Real aD12Norm = aD12.Modulus();
+    if (aD12Norm <= 1.e-10) {
 #ifdef OCCT_DEBUG
       if (DoTrace) {
        cout << "HLRBRep_PolyAlgo::OrientTriangle : Flat";
        cout << " triangle " << iTri << endl;
       }
 #endif
-      Tri1Flags |=  FMskFlat;
-      Tri1Flags |=  FMskSide;
-      Tri1Flags &= ~FMskBack;
+      theTriangle.Flags |=  HLRAlgo_PolyMask_FMskFlat;
+      theTriangle.Flags |=  HLRAlgo_PolyMask_FMskSide;
+      theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskBack;
     }
     else {
-      Standard_Real dx23 = Nod3PntX - Nod2PntX;
-      Standard_Real dy23 = Nod3PntY - Nod2PntY;
-      Standard_Real dz23 = Nod3PntZ - Nod2PntZ;
-      Standard_Real  d23 = sqrt(dx23 * dx23 + dy23 * dy23 + dz23 * dz23);
-      if (d23 < 1.e-10) {
+      gp_XYZ aD23 = Nod3RValues.Point - Nod2RValues.Point;
+      const Standard_Real aD23Norm = aD23.Modulus();
+      if (aD23Norm < 1.e-10) {
 #ifdef OCCT_DEBUG
        if (DoTrace) {
          cout << "HLRBRep_PolyAlgo::OrientTriangle : Flat";
          cout << " triangle " << iTri << endl;
        }
 #endif
-       Tri1Flags |=  FMskFlat;
-       Tri1Flags |=  FMskSide;
-       Tri1Flags &= ~FMskBack;
+       theTriangle.Flags |=  HLRAlgo_PolyMask_FMskFlat;
+       theTriangle.Flags |=  HLRAlgo_PolyMask_FMskSide;
+       theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskBack;
       }
       else {
-       Standard_Real  dx31  = Nod1PntX - Nod3PntX;
-       Standard_Real  dy31  = Nod1PntY - Nod3PntY;
-       Standard_Real  dz31  = Nod1PntZ - Nod3PntZ;
-       Standard_Real   d31  = sqrt(dx31 * dx31 + dy31 * dy31 + dz31 * dz31);
-       if (d31 < 1.e-10) {
+        const gp_XYZ aD31 = Nod1RValues.Point - Nod3RValues.Point;
+        const Standard_Real aD31Norm = aD31.Modulus();
+        if (aD31Norm < 1.e-10) {
 #ifdef OCCT_DEBUG
          if (DoTrace) {
            cout << "HLRBRep_PolyAlgo::OrientTriangle : Flat";
            cout << " triangle " << iTri << endl;
          }
 #endif
-         Tri1Flags |=  FMskFlat;
-         Tri1Flags |=  FMskSide;
-         Tri1Flags &= ~FMskBack;
+         theTriangle.Flags |=  HLRAlgo_PolyMask_FMskFlat;
+         theTriangle.Flags |=  HLRAlgo_PolyMask_FMskSide;
+         theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskBack;
        }
        else {
-         dx12 /= d12;
-         dy12 /= d12;
-         dz12 /= d12;
-         dx23 /= d23;
-         dy23 /= d23;
-         dz23 /= d23;
-          Standard_Real  dx = dy12 * dz23 - dz12 * dy23;
-          Standard_Real  dy = dz12 * dx23 - dx12 * dz23;
-          Standard_Real  dz = dx12 * dy23 - dy12 * dx23;
-         Standard_Real  d  = sqrt(dx * dx + dy * dy + dz * dz);
-         if (d < 1.e-5) {
+    aD12 *= 1 / aD12Norm;
+    aD23 *= 1 / aD23Norm;
+    gp_XYZ aD = aD12 ^ aD23;
+    const Standard_Real aDNorm = aD.Modulus();
+         if (aDNorm < 1.e-5) {
 #ifdef OCCT_DEBUG
            if (DoTrace) {
              cout << "HLRBRep_PolyAlgo::OrientTriangle : Flat";
              cout << " triangle " << iTri << endl;
            }
 #endif
-           Tri1Flags |=  FMskFlat;
-           Tri1Flags |=  FMskSide;
-           Tri1Flags &= ~FMskBack;
+           theTriangle.Flags |=  HLRAlgo_PolyMask_FMskFlat;
+           theTriangle.Flags |=  HLRAlgo_PolyMask_FMskSide;
+           theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskBack;
          }
          else {
            Standard_Real o;
            if (myProj.Perspective()) {
-             dx /= d;
-             dy /= d;
-             dz /= d;
-             o = (  dz * myProj.Focus()
-                  - dx * Nod1PntX
-                  - dy * Nod1PntY
-                  - dz * Nod1PntZ);
+        aD *= 1 / aDNorm;
+             o = aD.Z() * myProj.Focus() - aD * Nod1RValues.Point;
            }
            else
-             o = dz / d;
+             o = aD.Z() / aDNorm;
            if (o < 0) {
-             Tri1Flags |=  FMskOrBack;
+             theTriangle.Flags |=  HLRAlgo_PolyMask_FMskOrBack;
              o = -o;
            }
            else
-             Tri1Flags &= ~FMskOrBack;
+             theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskOrBack;
            if (o < 1.e-10) {
-             Tri1Flags |=  FMskSide;
-             Tri1Flags &= ~FMskBack;
+             theTriangle.Flags |=  HLRAlgo_PolyMask_FMskSide;
+             theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskBack;
            }
          }
        }
       }
     }
   }
-  if ((!(Tri1Flags & FMskBack) &&  (Tri1Flags & FMskOrBack)) ||
-      ( (Tri1Flags & FMskBack) && !(Tri1Flags & FMskOrBack)))
-    Tri1Flags |=  FMskFrBack;
+  if ((!(theTriangle.Flags & HLRAlgo_PolyMask_FMskBack) &&  (theTriangle.Flags & HLRAlgo_PolyMask_FMskOrBack)) ||
+      ( (theTriangle.Flags & HLRAlgo_PolyMask_FMskBack) && !(theTriangle.Flags & HLRAlgo_PolyMask_FMskOrBack)))
+    theTriangle.Flags |=  HLRAlgo_PolyMask_FMskFrBack;
   else 
-    Tri1Flags &= ~FMskFrBack;
+    theTriangle.Flags &= ~HLRAlgo_PolyMask_FMskFrBack;
 }
 
 //=======================================================================
@@ -3314,32 +2807,31 @@ HLRBRep_PolyAlgo::OrientTriangle(const Standard_Integer,
 Standard_Boolean
 HLRBRep_PolyAlgo::Triangles(const Standard_Integer ip1,
                            const Standard_Integer ip2,
-                           const Standard_Address Nod1Indices,
-                           Standard_Address& PISeg,
+                           HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices,
+                           HLRAlgo_Array1OfPISeg*& PISeg,
                            Standard_Integer& iTri1,
                            Standard_Integer& iTri2) const
 {
-  Standard_Address Seg1Indices;
-  Standard_Integer iiii = Nod1NdSg;
+  Standard_Integer iiii = Nod1Indices.NdSg;
   
   while (iiii != 0) {
-    Seg1Indices =
-      ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii).Indices();
-    if (Seg1LstSg1 == ip1) {
-      if (Seg1LstSg2 == ip2) {
-       iTri1 = Seg1Conex1;
-       iTri2 = Seg1Conex2;
+    HLRAlgo_PolyInternalSegment& aSegIndices =
+      ((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(iiii);
+    if (aSegIndices.LstSg1 == ip1) {
+      if (aSegIndices.LstSg2 == ip2) {
+       iTri1 = aSegIndices.Conex1;
+       iTri2 = aSegIndices.Conex2;
        return Standard_True;
       }
-      else iiii = Seg1NxtSg1;
+      else iiii = aSegIndices.NxtSg1;
     }
     else {
-      if (Seg1LstSg1 == ip2) {
-       iTri1 = Seg1Conex1;
-       iTri2 = Seg1Conex2;
+      if (aSegIndices.LstSg1 == ip2) {
+       iTri1 = aSegIndices.Conex1;
+       iTri2 = aSegIndices.Conex2;
        return Standard_True;
       }
-      else iiii = Seg1NxtSg2;
+      else iiii = aSegIndices.NxtSg2;
     }
   }
   iTri1 = 0;
@@ -3360,15 +2852,16 @@ HLRBRep_PolyAlgo::Triangles(const Standard_Integer ip1,
 
 Standard_Boolean
 HLRBRep_PolyAlgo::
-NewNode (const Standard_Address Nod1RValues,
-        const Standard_Address Nod2RValues,
-        Standard_Real& coef1,
-        Standard_Boolean& moveP1) const
+NewNode (
+  HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
+  HLRAlgo_PolyInternalNode::NodeData& Nod2RValues,
+  Standard_Real& coef1,
+  Standard_Boolean& moveP1) const
 {
   Standard_Real TolAng = myTolAngular * 0.5;
-  if ((Nod1Scal >= TolAng && Nod2Scal <= -TolAng) ||
-      (Nod2Scal >= TolAng && Nod1Scal <= -TolAng)) {
-    coef1 = Nod1Scal / ( Nod2Scal - Nod1Scal );
+  if ((Nod1RValues.Scal >= TolAng && Nod2RValues.Scal <= -TolAng) ||
+      (Nod2RValues.Scal >= TolAng && Nod1RValues.Scal <= -TolAng)) {
+    coef1 = Nod1RValues.Scal / ( Nod2RValues.Scal - Nod1RValues.Scal );
     if (coef1 < 0) coef1 = - coef1;
     moveP1 = coef1 < 0.5;
     return Standard_True;
@@ -3382,15 +2875,17 @@ NewNode (const Standard_Address Nod1RValues,
 //=======================================================================
 
 void
-HLRBRep_PolyAlgo::UVNode (const Standard_Address Nod1RValues,
-                         const Standard_Address Nod2RValues,
-                         const Standard_Real coef1,
-                         Standard_Real& U3,
-                         Standard_Real& V3) const
+HLRBRep_PolyAlgo::UVNode (
+  HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
+  HLRAlgo_PolyInternalNode::NodeData& Nod2RValues,
+  const Standard_Real coef1,
+  Standard_Real& U3,
+  Standard_Real& V3) const
 {
   Standard_Real coef2 = 1 - coef1;
-  U3 = Nod1PntU * coef2 + Nod2PntU * coef1;
-  V3 = Nod1PntV * coef2 + Nod2PntV * coef1;
+  const gp_XY aUV3 = coef2 * Nod1RValues.UV + coef1 * Nod2RValues.UV;
+  U3 = aUV3.X();
+  V3 = aUV3.Y();
 }
 
 //=======================================================================
@@ -3400,19 +2895,20 @@ HLRBRep_PolyAlgo::UVNode (const Standard_Address Nod1RValues,
 
 void
 HLRBRep_PolyAlgo::
-CheckDegeneratedSegment(const Standard_Address Nod1Indices,
-                       const Standard_Address Nod1RValues,
-                       const Standard_Address Nod2Indices,
-                       const Standard_Address Nod2RValues) const
+CheckDegeneratedSegment(
+  HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices,
+  HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
+  HLRAlgo_PolyInternalNode::NodeIndices& Nod2Indices,
+  HLRAlgo_PolyInternalNode::NodeData& Nod2RValues) const
 {
-  Nod1Flag |=  NMskFuck;
-  Nod2Flag |=  NMskFuck;
-  if ((Nod1Scal >= myTolAngular && Nod2Scal <= -myTolAngular) ||
-      (Nod2Scal >= myTolAngular && Nod1Scal <= -myTolAngular)) {
-    Nod1Scal  = 0.;
-    Nod1Flag |= NMskOutL;
-    Nod2Scal  = 0.;
-    Nod2Flag |= NMskOutL;
+  Nod1Indices.Flag |=  NMsk_Fuck;
+  Nod2Indices.Flag |=  NMsk_Fuck;
+  if ((Nod1RValues.Scal >= myTolAngular && Nod2RValues.Scal <= -myTolAngular) ||
+      (Nod2RValues.Scal >= myTolAngular && Nod1RValues.Scal <= -myTolAngular)) {
+    Nod1RValues.Scal  = 0.;
+    Nod1Indices.Flag |= NMsk_OutL;
+    Nod2RValues.Scal  = 0.;
+    Nod2Indices.Flag |= NMsk_OutL;
   }
 }
 
@@ -3436,87 +2932,83 @@ HLRBRep_PolyAlgo::UpdateOutLines (HLRAlgo_ListOfBPoint& List,
   for (f = 1; f <= nbFace; f++) { 
     if (!(*pid).IsNull()) {
       if ((*pid)->IntOutL()) {
-       Standard_Address TData = &((*pid)->TData());
-       Standard_Address PISeg = &((*pid)->PISeg());
-       Standard_Address PINod = &((*pid)->PINod());
+  HLRAlgo_Array1OfTData* TData = &(*pid)->TData();
+  HLRAlgo_Array1OfPISeg* PISeg = &(*pid)->PISeg();
+       HLRAlgo_Array1OfPINod* PINod = &(*pid)->PINod();
        Standard_Integer i,j,it1,it2,tn1,tn2,tn3,pd,pf;
-       Standard_Address Seg2Indices,Tri1Indices,Tri2Indices;
        Standard_Boolean outl;
        Standard_Integer nbS = (*pid)->NbPISeg();
-       HLRAlgo_PolyInternalSegment* psg =
-         &(((HLRAlgo_Array1OfPISeg*)PISeg)->ChangeValue(1));
-       
-       for (i = 1; i <= nbS; i++) {
-         Seg2Indices = psg->Indices();
-         it1 = Seg2Conex1;
-         it2 = Seg2Conex2;
+
+       for (i = 1; i <= nbS; i++)
+  {
+    HLRAlgo_PolyInternalSegment* psg = &PISeg->ChangeValue(i);
+         it1 = psg->Conex1;
+         it2 = psg->Conex2;
          if (it1 != 0 && it2 != 0 && it1 != it2) {  // debile but sure !
-           Tri1Indices = ((HLRAlgo_Array1OfTData*)TData)->
-             ChangeValue(it1).Indices();
-           Tri2Indices = ((HLRAlgo_Array1OfTData*)TData)->
-             ChangeValue(it2).Indices();
-           if      (!(Tri1Flags & FMskSide) && !(Tri2Flags & FMskSide))
-             outl =  (Tri1Flags & FMskBack) !=  (Tri2Flags & FMskBack);
-           else if ( (Tri1Flags & FMskSide) &&  (Tri2Flags & FMskSide))
+           HLRAlgo_TriangleData& aTriangle = TData->ChangeValue(it1);
+           HLRAlgo_TriangleData& aTriangle2 = TData->ChangeValue(it2);
+           if      (!(aTriangle.Flags & HLRAlgo_PolyMask_FMskSide) && !(aTriangle2.Flags & HLRAlgo_PolyMask_FMskSide))
+             outl =  (aTriangle.Flags & HLRAlgo_PolyMask_FMskBack) !=  (aTriangle2.Flags & HLRAlgo_PolyMask_FMskBack);
+           else if ( (aTriangle.Flags & HLRAlgo_PolyMask_FMskSide) &&  (aTriangle2.Flags & HLRAlgo_PolyMask_FMskSide))
              outl = Standard_False;
-           else if (  Tri1Flags & FMskSide)
-             outl = !(Tri1Flags & FMskFlat) && !(Tri2Flags & FMskBack);
+           else if (  aTriangle.Flags & HLRAlgo_PolyMask_FMskSide)
+             outl = !(aTriangle.Flags & HLRAlgo_PolyMask_FMskFlat) && !(aTriangle2.Flags & HLRAlgo_PolyMask_FMskBack);
            else
-             outl = !(Tri2Flags & FMskFlat) && !(Tri1Flags & FMskBack);
+             outl = !(aTriangle2.Flags & HLRAlgo_PolyMask_FMskFlat) && !(aTriangle.Flags & HLRAlgo_PolyMask_FMskBack);
            
            if (outl) {
-             pd = Seg2LstSg1;
-             pf = Seg2LstSg2;
-             tn1 = Tri1Node1;
-             tn2 = Tri1Node2;
-             tn3 = Tri1Node3;
-             if (!(Tri1Flags & FMskSide) && (Tri1Flags & FMskOrBack)) {
+             pd = psg->LstSg1;
+             pf = psg->LstSg2;
+             tn1 = aTriangle.Node1;
+             tn2 = aTriangle.Node2;
+             tn3 = aTriangle.Node3;
+             if (!(aTriangle.Flags & HLRAlgo_PolyMask_FMskSide) && (aTriangle.Flags & HLRAlgo_PolyMask_FMskOrBack)) {
                j   = tn1;
                tn1 = tn3;
                tn3 = j;
              }
              if      ((tn1 == pd && tn2 == pf) || (tn1 == pf && tn2 == pd))
-               Tri1Flags |=  EMskOutLin1;
+               aTriangle.Flags |=  HLRAlgo_PolyMask_EMskOutLin1;
              else if ((tn2 == pd && tn3 == pf) || (tn2 == pf && tn3 == pd))
-               Tri1Flags |=  EMskOutLin2;
+               aTriangle.Flags |=  HLRAlgo_PolyMask_EMskOutLin2;
              else if ((tn3 == pd && tn1 == pf) || (tn3 == pf && tn1 == pd))
-               Tri1Flags |=  EMskOutLin3;
+               aTriangle.Flags |=  HLRAlgo_PolyMask_EMskOutLin3;
 #ifdef OCCT_DEBUG
              else if (DoError) {
                cout << "HLRAlgo_PolyInternalData::UpdateOutLines";
                cout << " : segment not found" << endl;
              }
 #endif
-             tn1 = Tri2Node1;
-             tn2 = Tri2Node2;
-             tn3 = Tri2Node3;
-             if (!(Tri2Flags & FMskSide) && (Tri2Flags & FMskOrBack)) {
+             tn1 = aTriangle2.Node1;
+             tn2 = aTriangle2.Node2;
+             tn3 = aTriangle2.Node3;
+             if (!(aTriangle2.Flags & HLRAlgo_PolyMask_FMskSide) && (aTriangle2.Flags & HLRAlgo_PolyMask_FMskOrBack)) {
                j   = tn1;
                tn1 = tn3;
                tn3 = j;
              }
              if      ((tn1 == pd && tn2 == pf) || (tn1 == pf && tn2 == pd))
-               Tri2Flags |=  EMskOutLin1;
+               aTriangle2.Flags |=  HLRAlgo_PolyMask_EMskOutLin1;
              else if ((tn2 == pd && tn3 == pf) || (tn2 == pf && tn3 == pd))
-               Tri2Flags |=  EMskOutLin2;
+               aTriangle2.Flags |=  HLRAlgo_PolyMask_EMskOutLin2;
              else if ((tn3 == pd && tn1 == pf) || (tn3 == pf && tn1 == pd))
-               Tri2Flags |=  EMskOutLin3;
+               aTriangle2.Flags |=  HLRAlgo_PolyMask_EMskOutLin3;
 #ifdef OCCT_DEBUG
              else if (DoError) {
                cout << "HLRAlgo_PolyInternalData::UpdateOutLines";
                cout << " : segment not found" << endl;
              }
 #endif
-             Standard_Address Nod1RValues =
-               ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(pd)->RValues();
-             Standard_Address Nod2RValues =
-               ((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(pf)->RValues();
-             XTI1 = X1 = Nod1PntX;
-             YTI1 = Y1 = Nod1PntY;
-             ZTI1 = Z1 = Nod1PntZ;
-             XTI2 = X2 = Nod2PntX;
-             YTI2 = Y2 = Nod2PntY;
-             ZTI2 = Z2 = Nod2PntZ;
+             HLRAlgo_PolyInternalNode::NodeData& Nod1RValues =
+          PINod->ChangeValue(pd)->Data();
+             HLRAlgo_PolyInternalNode::NodeData& Nod2RValues =
+          PINod->ChangeValue(pf)->Data();
+             XTI1 = X1 = Nod1RValues.Point.X();
+             YTI1 = Y1 = Nod1RValues.Point.Y();
+             ZTI1 = Z1 = Nod1RValues.Point.Z();
+             XTI2 = X2 = Nod2RValues.Point.X();
+             YTI2 = Y2 = Nod2RValues.Point.Y();
+             ZTI2 = Z2 = Nod2RValues.Point.Z();
              TIMultiply(XTI1,YTI1,ZTI1);
              TIMultiply(XTI2,YTI2,ZTI2);
              List.Append(HLRAlgo_BiPoint(XTI1,YTI1,ZTI1,XTI2,YTI2,ZTI2,
@@ -3524,7 +3016,6 @@ HLRBRep_PolyAlgo::UpdateOutLines (HLRAlgo_ListOfBPoint& List,
                                          f,f,pd,pf,f,pd,pf,12));
            }
          }
-         psg++;
        }
       }
     }
@@ -3548,53 +3039,51 @@ UpdateEdgesBiPoints (HLRAlgo_ListOfBPoint& List,
   for (it.Initialize(List); it.More(); it.Next()) {      
     HLRAlgo_BiPoint& BP = it.Value();
 //    Standard_Integer i[5];
-    Standard_Address IndexPtr = BP.Indices();
-    if (F1Index != 0 && F2Index != 0) {
+    HLRAlgo_BiPoint::IndicesT& aIndices = BP.Indices();
+    if (aIndices.FaceConex1 != 0 && aIndices.FaceConex2 != 0) {
       const Handle(HLRAlgo_PolyInternalData)& pid1 =
-       *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F1Index));
+       *(Handle(HLRAlgo_PolyInternalData)*)&(PID(aIndices.FaceConex1));
       const Handle(HLRAlgo_PolyInternalData)& pid2 =
-       *(Handle(HLRAlgo_PolyInternalData)*)&(PID(F2Index));
-      Standard_Address PISeg1 = &pid1->PISeg();
-      Standard_Address PISeg2 = &pid2->PISeg();
-      Standard_Address Nod11Indices = 
-       pid1->PINod().ChangeValue(F1Pt1Index)->Indices();
-      Standard_Address Nod21Indices = 
-       pid2->PINod().ChangeValue(F2Pt1Index)->Indices();
-      Triangles(F1Pt1Index,F1Pt2Index,Nod11Indices,PISeg1,itri1,tbid);
-      Triangles(F2Pt1Index,F2Pt2Index,Nod21Indices,PISeg2,itri2,tbid);
+       *(Handle(HLRAlgo_PolyInternalData)*)&(PID(aIndices.FaceConex2));
+      HLRAlgo_Array1OfPISeg* PISeg1 = &pid1->PISeg();
+      HLRAlgo_Array1OfPISeg* PISeg2 = &pid2->PISeg();
+      HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices = 
+       pid1->PINod().ChangeValue(aIndices.Face1Pt1)->Indices();
+      HLRAlgo_PolyInternalNode::NodeIndices& Nod21Indices = 
+       pid2->PINod().ChangeValue(aIndices.Face2Pt1)->Indices();
+      Triangles(aIndices.Face1Pt1,aIndices.Face1Pt2,Nod11Indices,PISeg1,itri1,tbid);
+      Triangles(aIndices.Face2Pt1,aIndices.Face2Pt2,Nod21Indices,PISeg2,itri2,tbid);
 
       if (itri1 != 0 && itri2 != 0) {
-       if (F1Index != F2Index || itri1 != itri2) {
-         Standard_Address TData1 = &pid1->TData();
-         Standard_Address TData2 = &pid2->TData();
-         Standard_Address Tri1Indices =
-           ((HLRAlgo_Array1OfTData*)TData1)->ChangeValue(itri1).Indices();
-         Standard_Address Tri2Indices =
-           ((HLRAlgo_Array1OfTData*)TData2)->ChangeValue(itri2).Indices();
+       if (aIndices.FaceConex1 != aIndices.FaceConex2 || itri1 != itri2) {
+         HLRAlgo_Array1OfTData* TData1 = &pid1->TData();
+         HLRAlgo_Array1OfTData* TData2 = &pid2->TData();
+         HLRAlgo_TriangleData& aTriangle = TData1->ChangeValue(itri1);
+         HLRAlgo_TriangleData& aTriangle2 = TData2->ChangeValue(itri2);
          if (closed) {
-           if (((Tri1Flags & FMskBack) && (Tri2Flags & FMskBack)) ||
-               ((Tri1Flags & FMskSide) && (Tri2Flags & FMskSide)) ||
-               ((Tri1Flags & FMskBack) && (Tri2Flags & FMskSide)) ||
-               ((Tri1Flags & FMskSide) && (Tri2Flags & FMskBack)))
+           if (((aTriangle.Flags & HLRAlgo_PolyMask_FMskBack) && (aTriangle2.Flags & HLRAlgo_PolyMask_FMskBack)) ||
+               ((aTriangle.Flags & HLRAlgo_PolyMask_FMskSide) && (aTriangle2.Flags & HLRAlgo_PolyMask_FMskSide)) ||
+               ((aTriangle.Flags & HLRAlgo_PolyMask_FMskBack) && (aTriangle2.Flags & HLRAlgo_PolyMask_FMskSide)) ||
+               ((aTriangle.Flags & HLRAlgo_PolyMask_FMskSide) && (aTriangle2.Flags & HLRAlgo_PolyMask_FMskBack)))
              BP.Hidden(Standard_True);
          }
          Standard_Boolean outl;
-         if      (!(Tri1Flags & FMskSide) && !(Tri2Flags & FMskSide))
-           outl =  (Tri1Flags & FMskBack) !=  (Tri2Flags & FMskBack);
-         else if ( (Tri1Flags & FMskSide) &&  (Tri2Flags & FMskSide))
+         if      (!(aTriangle.Flags & HLRAlgo_PolyMask_FMskSide) && !(aTriangle2.Flags & HLRAlgo_PolyMask_FMskSide))
+           outl =  (aTriangle.Flags & HLRAlgo_PolyMask_FMskBack) !=  (aTriangle2.Flags & HLRAlgo_PolyMask_FMskBack);
+         else if ( (aTriangle.Flags & HLRAlgo_PolyMask_FMskSide) &&  (aTriangle2.Flags & HLRAlgo_PolyMask_FMskSide))
            outl = Standard_False;
-         else if ( (Tri1Flags & FMskSide))
-           outl = !(Tri1Flags & FMskFlat) && !(Tri2Flags & FMskBack);
+         else if ( (aTriangle.Flags & HLRAlgo_PolyMask_FMskSide))
+           outl = !(aTriangle.Flags & HLRAlgo_PolyMask_FMskFlat) && !(aTriangle2.Flags & HLRAlgo_PolyMask_FMskBack);
          else
-           outl = !(Tri2Flags & FMskFlat) && !(Tri1Flags & FMskBack);
+           outl = !(aTriangle2.Flags & HLRAlgo_PolyMask_FMskFlat) && !(aTriangle.Flags & HLRAlgo_PolyMask_FMskBack);
          BP.OutLine(outl);
        }
       }
 #ifdef OCCT_DEBUG
       else if (DoError) {
        cout << "HLRBRep_PolyAlgo::UpdateEdgesBiPoints : error ";
-       cout << " between " << F1Index << setw(6);
-       cout << " and " << F2Index << endl;
+       cout << " between " << aIndices.FaceConex1 << setw(6);
+       cout << " and " << aIndices.FaceConex2 << endl;
       }
 #endif
     }
@@ -3629,59 +3118,47 @@ HLRBRep_PolyAlgo::UpdatePolyData (TColStd_Array1OfTransient& PD,
       HTData = new HLRAlgo_HArray1OfTData(1,nbT);
       TColgp_Array1OfXYZ&    Nodes = HNodes->ChangeArray1();
       HLRAlgo_Array1OfTData& Trian = HTData->ChangeArray1();
-      Standard_Address TData = &(*pid)->TData();
-      Standard_Address PINod = &(*pid)->PINod();
+      HLRAlgo_Array1OfTData* TData = &(*pid)->TData();
+      HLRAlgo_Array1OfPINod* PINod = &(*pid)->PINod();
       Standard_Integer nbHide = 0;
-      Handle(HLRAlgo_PolyInternalNode)* ON = 
-       &(((HLRAlgo_Array1OfPINod*)PINod)->ChangeValue(1));
-      gp_XYZ                          * NN = &(Nodes.ChangeValue(1));
-      
+
       for (i = 1; i <= nbN; i++) {
-       const Standard_Address Nod1RValues = (*ON)->RValues();
-       NN->SetCoord(Nod1PntX,Nod1PntY,Nod1PntZ);
-       ON++;
-       NN++;
+        HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = PINod->ChangeValue(i)->Data();
+        Nodes.ChangeValue(i) = Nod1RValues.Point;
       }
       
-      HLRAlgo_TriangleData* OT =
-       &(((HLRAlgo_Array1OfTData*)TData)->ChangeValue(1));
-      HLRAlgo_TriangleData* NT = &(Trian.ChangeValue(1));
-      Standard_Address Tri1Indices,Tri2Indices;
-      
       for (i = 1; i <= nbT; i++) {
-       Tri1Indices = OT->Indices();
-       Tri2Indices = NT->Indices();
-       if (!(Tri1Flags & FMskSide)) {
+        HLRAlgo_TriangleData* OT = &TData->ChangeValue(i);
+        HLRAlgo_TriangleData* NT = &(Trian.ChangeValue(i));
+       if (!(OT->Flags & HLRAlgo_PolyMask_FMskSide)) {
 #ifdef OCCT_DEBUG
-         if ((Tri1Flags & FMskFrBack) && DoTrace) {
+         if ((OT->Flags & HLRAlgo_PolyMask_FMskFrBack) && DoTrace) {
            cout << "HLRBRep_PolyAlgo::ReverseBackTriangle :";
            cout << " face " << f << setw(6);
            cout << " triangle " << i << endl;
          }
 #endif
-         if (Tri1Flags & FMskOrBack) {
-           Standard_Integer j = Tri1Node1;
-           Tri1Node1          = Tri1Node3;
-           Tri1Node3          = j;
-           Tri1Flags |=  FMskBack;
+         if (OT->Flags & HLRAlgo_PolyMask_FMskOrBack) {
+           Standard_Integer j = OT->Node1;
+           OT->Node1          = OT->Node3;
+           OT->Node3          = j;
+           OT->Flags |=  HLRAlgo_PolyMask_FMskBack;
          }
          else
-           Tri1Flags &= ~FMskBack;
-           //Tri1Flags |= FMskBack;//OCC349
+           OT->Flags &= ~HLRAlgo_PolyMask_FMskBack;
+           //Tri1Flags |= HLRAlgo_PolyMask_FMskBack;//OCC349
        }
-       Tri2Node1 = Tri1Node1;
-       Tri2Node2 = Tri1Node2;
-       Tri2Node3 = Tri1Node3;
-       Tri2Flags = Tri1Flags;
-       if (!(Tri2Flags & FMskSide) &&
-           (!(Tri2Flags & FMskBack) || !closed)) {
-         Tri2Flags |=  FMskHiding;
+       NT->Node1 = OT->Node1;
+       NT->Node2 = OT->Node2;
+       NT->Node3 = OT->Node3;
+       NT->Flags = OT->Flags;
+       if (!(NT->Flags & HLRAlgo_PolyMask_FMskSide) &&
+           (!(NT->Flags & HLRAlgo_PolyMask_FMskBack) || !closed)) {
+         NT->Flags |=  HLRAlgo_PolyMask_FMskHiding;
          nbHide++;
        }
        else
-         Tri2Flags &= ~FMskHiding;
-       OT++;
-       NT++;
+         NT->Flags &= ~HLRAlgo_PolyMask_FMskHiding;
       }
       if (nbHide > 0) HPHDat = new HLRAlgo_HArray1OfPHDat(1,nbHide);
       else            HPHDat.Nullify();
@@ -3754,7 +3231,7 @@ HLRBRep_PolyAlgo::TIMultiply (Standard_Real& X,
 //purpose  : 
 //=======================================================================
 
-void HLRBRep_PolyAlgo::Hide (Standard_Address& Coordinates,
+HLRAlgo_BiPoint::PointsT& HLRBRep_PolyAlgo::Hide (
                             HLRAlgo_EdgeStatus& status,
                             TopoDS_Shape& S,
                             Standard_Boolean& reg1,
@@ -3763,9 +3240,10 @@ void HLRBRep_PolyAlgo::Hide (Standard_Address& Coordinates,
                             Standard_Boolean& intl)
 {
   Standard_Integer index;
-  myAlgo->Hide(Coordinates,status,index,reg1,regn,outl,intl);
+  HLRAlgo_BiPoint::PointsT& aPoints = myAlgo->Hide(status,index,reg1,regn,outl,intl);
   if (intl) S = myFMap(index);
   else      S = myEMap(index);
+  return aPoints;
 }
 
 //=======================================================================
@@ -3773,7 +3251,7 @@ void HLRBRep_PolyAlgo::Hide (Standard_Address& Coordinates,
 //purpose  : 
 //=======================================================================
 
-void HLRBRep_PolyAlgo::Show (Standard_Address& Coordinates,
+HLRAlgo_BiPoint::PointsT& HLRBRep_PolyAlgo::Show (
                             TopoDS_Shape& S,
                             Standard_Boolean& reg1,
                             Standard_Boolean& regn,
@@ -3781,9 +3259,10 @@ void HLRBRep_PolyAlgo::Show (Standard_Address& Coordinates,
                             Standard_Boolean& intl)
 {
   Standard_Integer index;
-  myAlgo->Show(Coordinates,index,reg1,regn,outl,intl);
+  HLRAlgo_BiPoint::PointsT& aPoints = myAlgo->Show(index,reg1,regn,outl,intl);
   if (intl) S = myFMap(index);
   else      S = myEMap(index);
+  return aPoints;
 }
 
 //=======================================================================
@@ -3822,12 +3301,10 @@ HLRBRep_PolyAlgo::OutLinedShape (const TopoDS_Shape& S) const
        for (it.Initialize(List); it.More(); it.Next()) {
          HLRAlgo_BiPoint& BP = it.Value();
          if (BP.IntLine()) {
-           Standard_Address IndexPtr = BP.Indices();
-           if (Map.Contains(myFMap(ShapeIndex))) {
-             Standard_Address Coordinates = BP.Coordinates();
-             B.Add(Result,BRepLib_MakeEdge
-                   (gp_Pnt(PntXTI1,PntYTI1,PntZTI1),
-                    gp_Pnt(PntXTI2,PntYTI2,PntZTI2)));
+           HLRAlgo_BiPoint::IndicesT& aIndices = BP.Indices();
+           if (Map.Contains(myFMap(aIndices.ShapeIndex))) {
+             HLRAlgo_BiPoint::PointsT& aPoints = BP.Points();
+             B.Add(Result,BRepLib_MakeEdge(aPoints.Pnt1, aPoints.Pnt2));
            }
          }
        }
index b44507a..b0eeb51 100644 (file)
 #ifndef _HLRBRep_PolyAlgo_HeaderFile
 #define _HLRBRep_PolyAlgo_HeaderFile
 
+#include <HLRAlgo_PolyInternalNode.hxx>
+
+#include <HLRAlgo_Array1OfTData.hxx>
+#include <HLRAlgo_Array1OfPISeg.hxx>
+#include <HLRAlgo_Array1OfPINod.hxx>
 #include <Standard.hxx>
 #include <Standard_Type.hxx>
 
 #include <TColStd_Array1OfTransient.hxx>
 #include <TColStd_Array1OfInteger.hxx>
 #include <TopTools_MapOfShape.hxx>
-#include <Standard_Address.hxx>
 #include <HLRAlgo_ListOfBPoint.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <GeomAbs_Shape.hxx>
+
 class HLRAlgo_PolyAlgo;
 class Geom_Surface;
 class Standard_OutOfRange;
@@ -45,6 +50,7 @@ class HLRAlgo_Projector;
 class TopoDS_Edge;
 class HLRAlgo_PolyInternalData;
 class HLRAlgo_EdgeStatus;
+struct HLRAlgo_TriangleData;
 
 
 class HLRBRep_PolyAlgo;
@@ -163,7 +169,13 @@ public:
   
     void NextHide();
   
-  Standard_EXPORT void Hide (Standard_Address& Coordinates, HLRAlgo_EdgeStatus& status, TopoDS_Shape& S, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
+  Standard_EXPORT HLRAlgo_BiPoint::PointsT& Hide (
+    HLRAlgo_EdgeStatus& status,
+    TopoDS_Shape& S,
+    Standard_Boolean& reg1,
+    Standard_Boolean& regn,
+    Standard_Boolean& outl,
+    Standard_Boolean& intl);
   
     void InitShow();
   
@@ -171,7 +183,7 @@ public:
   
     void NextShow();
   
-  Standard_EXPORT void Show (Standard_Address& Coordinates, TopoDS_Shape& S, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
+  Standard_EXPORT HLRAlgo_BiPoint::PointsT& Show (TopoDS_Shape& S, Standard_Boolean& reg1, Standard_Boolean& regn, Standard_Boolean& outl, Standard_Boolean& intl);
   
   //! Make a shape  with  the internal outlines in  each
   //! face.
@@ -200,45 +212,50 @@ private:
   
   Standard_EXPORT void StoreShell (const TopoDS_Shape& Shape, Standard_Integer& iShell, TColStd_Array1OfTransient& Shell, const Standard_Boolean IsoledF, const Standard_Boolean IsoledE, TColStd_Array1OfInteger& ES, TColStd_Array1OfTransient& PD, TColStd_Array1OfTransient& PID, TopTools_MapOfShape& ShapeMap1, TopTools_MapOfShape& ShapeMap2);
   
-  Standard_EXPORT Standard_Boolean Normal (const Standard_Integer iNode, const Standard_Address Nod1Indices, const Standard_Address Nod1RValues, Standard_Address& TData, Standard_Address& PISeg, Standard_Address& PINod, const Standard_Boolean orient) const;
-  
-  Standard_EXPORT Standard_Boolean AverageNormal (const Standard_Integer iNode, const Standard_Address Nod1Indices, Standard_Address& TData, Standard_Address& PISeg, Standard_Address& PINod, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
+  Standard_EXPORT Standard_Boolean Normal (const Standard_Integer iNode, HLRAlgo_PolyInternalNode::NodeIndices& theNodIndices, HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_Array1OfTData*& TData, HLRAlgo_Array1OfPISeg*& PISeg, HLRAlgo_Array1OfPINod*& PINod, const Standard_Boolean orient) const;
   
-  Standard_EXPORT void AddNormalOnTriangle (const Standard_Integer iTri, const Standard_Integer iNode, Standard_Integer& jNode, Standard_Address& TData, Standard_Address& PINod, Standard_Real& X, Standard_Real& Y, Standard_Real& Z, Standard_Boolean& OK) const;
+  Standard_EXPORT Standard_Boolean AverageNormal (const Standard_Integer iNode, HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices, HLRAlgo_Array1OfTData*& TData, HLRAlgo_Array1OfPISeg*& PISeg, HLRAlgo_Array1OfPINod*& PINod, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
+
+  Standard_Boolean AverageNormal (const Standard_Integer iNode, HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices, HLRAlgo_Array1OfTData*& TData, HLRAlgo_Array1OfPISeg*& PISeg, HLRAlgo_Array1OfPINod*& PINod, gp_XYZ& theNormal) const
+  {
+    return AverageNormal (iNode, theNodeIndices, TData, PISeg, PINod, theNormal.ChangeCoord(1), theNormal.ChangeCoord(2), theNormal.ChangeCoord(3));
+  }
+
+  Standard_EXPORT void AddNormalOnTriangle (const Standard_Integer iTri, const Standard_Integer iNode, Standard_Integer& jNode, HLRAlgo_Array1OfTData*& TData, HLRAlgo_Array1OfPINod*& PINod, Standard_Real& X, Standard_Real& Y, Standard_Real& Z, Standard_Boolean& OK) const;
   
   Standard_EXPORT void InitBiPointsWithConnexity (const Standard_Integer e, TopoDS_Edge& E, HLRAlgo_ListOfBPoint& List, TColStd_Array1OfTransient& PID, TopTools_ListOfShape& LS, const Standard_Boolean connex);
   
-  Standard_EXPORT void Interpolation (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, Standard_Address& Nod11Indices, Standard_Address& Nod11RValues, Standard_Address& Nod12Indices, Standard_Address& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, Standard_Address& TData1, Standard_Address& PISeg1, Standard_Address& PINod1) const;
+  Standard_EXPORT void Interpolation (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices1, HLRAlgo_PolyInternalNode::NodeData& Nod11RValues, HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices2, HLRAlgo_PolyInternalNode::NodeData& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPINod*& PINod1) const;
   
-  Standard_EXPORT void Interpolation (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, const GeomAbs_Shape rg, Standard_Address& Nod11Indices, Standard_Address& Nod11RValues, Standard_Address& Nod12Indices, Standard_Address& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, Standard_Address& TData1, Standard_Address& PISeg1, Standard_Address& PINod1, Standard_Address& Nod21Indices, Standard_Address& Nod21RValues, Standard_Address& Nod22Indices, Standard_Address& Nod22RValues, const Standard_Integer i2p1, const Standard_Integer i2p2, const Standard_Integer i2, const Handle(HLRAlgo_PolyInternalData)& pid2, Standard_Address& TData2, Standard_Address& PISeg2, Standard_Address& PINod2) const;
+  Standard_EXPORT void Interpolation (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, const GeomAbs_Shape rg, HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices, HLRAlgo_PolyInternalNode::NodeData& Nod11RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices, HLRAlgo_PolyInternalNode::NodeData& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_PolyInternalNode::NodeIndices& Nod21Indices, HLRAlgo_PolyInternalNode::NodeData& Nod21RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod22Indices, HLRAlgo_PolyInternalNode::NodeData& Nod22RValues, const Standard_Integer i2p1, const Standard_Integer i2p2, const Standard_Integer i2, const Handle(HLRAlgo_PolyInternalData)& pid2, HLRAlgo_Array1OfTData*& TData2, HLRAlgo_Array1OfPISeg*& PISeg2, HLRAlgo_Array1OfPINod*& PINod2) const;
   
-  Standard_EXPORT Standard_Boolean Interpolation (const Standard_Real U1, const Standard_Real U2, const Standard_Address Nod1RValues, const Standard_Address Nod2RValues, Standard_Real& X3, Standard_Real& Y3, Standard_Real& Z3, Standard_Real& XT3, Standard_Real& YT3, Standard_Real& ZT3, Standard_Real& coef3, Standard_Real& U3, Standard_Boolean& mP3P1) const;
+  Standard_EXPORT Standard_Boolean Interpolation (const Standard_Real U1, const Standard_Real U2, HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_PolyInternalNode::NodeData& Nod2RValues, Standard_Real& X3, Standard_Real& Y3, Standard_Real& Z3, Standard_Real& XT3, Standard_Real& YT3, Standard_Real& ZT3, Standard_Real& coef3, Standard_Real& U3, Standard_Boolean& mP3P1) const;
   
-  Standard_EXPORT void MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, Standard_Address& Nod11Indices, Standard_Address& Nod11RValues, Standard_Address& Nod12Indices, Standard_Address& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, Standard_Address& TData1, Standard_Address& PISeg1, Standard_Address& PINod1, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3, const Standard_Real XT3, const Standard_Real YT3, const Standard_Real ZT3, const Standard_Real coef3, const Standard_Real U3, const Standard_Boolean insP3, const Standard_Boolean mP3P1, const Standard_Integer flag) const;
+  Standard_EXPORT void MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices, HLRAlgo_PolyInternalNode::NodeData& Nod11RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices, HLRAlgo_PolyInternalNode::NodeData& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPINod*& PINod1, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3, const Standard_Real XT3, const Standard_Real YT3, const Standard_Real ZT3, const Standard_Real coef3, const Standard_Real U3, const Standard_Boolean insP3, const Standard_Boolean mP3P1, const Standard_Integer flag) const;
   
-  Standard_EXPORT void MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, Standard_Address& Nod11Indices, Standard_Address& Nod11RValues, Standard_Address& Nod12Indices, Standard_Address& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, Standard_Address& TData1, Standard_Address& PISeg1, Standard_Address& PINod1, Standard_Address& Nod21Indices, Standard_Address& Nod21RValues, Standard_Address& Nod22Indices, Standard_Address& Nod22RValues, const Standard_Integer i2p1, const Standard_Integer i2p2, const Standard_Integer i2, const Handle(HLRAlgo_PolyInternalData)& pid2, Standard_Address& TData2, Standard_Address& PISeg2, Standard_Address& PINod2, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3, const Standard_Real XT3, const Standard_Real YT3, const Standard_Real ZT3, const Standard_Real coef3, const Standard_Real U3, const Standard_Boolean insP3, const Standard_Boolean mP3P1, const Standard_Integer flag) const;
+  Standard_EXPORT void MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices, HLRAlgo_PolyInternalNode::NodeData& Nod11RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices, HLRAlgo_PolyInternalNode::NodeData& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_PolyInternalNode::NodeIndices& Nod21Indices, HLRAlgo_PolyInternalNode::NodeData& Nod21RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod22Indices, HLRAlgo_PolyInternalNode::NodeData& Nod22RValues, const Standard_Integer i2p1, const Standard_Integer i2p2, const Standard_Integer i2, const Handle(HLRAlgo_PolyInternalData)& pid2, HLRAlgo_Array1OfTData*& TData2, HLRAlgo_Array1OfPISeg*& PISeg2, HLRAlgo_Array1OfPINod*& PINod2, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3, const Standard_Real XT3, const Standard_Real YT3, const Standard_Real ZT3, const Standard_Real coef3, const Standard_Real U3, const Standard_Boolean insP3, const Standard_Boolean mP3P1, const Standard_Integer flag) const;
   
-  Standard_EXPORT void MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, Standard_Address& Nod11Indices, Standard_Address& Nod11RValues, Standard_Address& Nod12Indices, Standard_Address& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, Standard_Address& TData1, Standard_Address& PISeg1, Standard_Address& PINod1, Standard_Address& Nod21Indices, Standard_Address& Nod21RValues, Standard_Address& Nod22Indices, Standard_Address& Nod22RValues, const Standard_Integer i2p1, const Standard_Integer i2p2, const Standard_Integer i2, const Handle(HLRAlgo_PolyInternalData)& pid2, Standard_Address& TData2, Standard_Address& PISeg2, Standard_Address& PINod2, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3, const Standard_Real XT3, const Standard_Real YT3, const Standard_Real ZT3, const Standard_Real coef3, const Standard_Real U3, const Standard_Boolean insP3, const Standard_Boolean mP3P1, const Standard_Real X4, const Standard_Real Y4, const Standard_Real Z4, const Standard_Real XT4, const Standard_Real YT4, const Standard_Real ZT4, const Standard_Real coef4, const Standard_Real U4, const Standard_Boolean insP4, const Standard_Boolean mP4P1, const Standard_Integer flag) const;
+  Standard_EXPORT void MoveOrInsertPoint (HLRAlgo_ListOfBPoint& List, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2, Standard_Real& XTI1, Standard_Real& YTI1, Standard_Real& ZTI1, Standard_Real& XTI2, Standard_Real& YTI2, Standard_Real& ZTI2, const Standard_Integer e, Standard_Real& U1, Standard_Real& U2, HLRAlgo_PolyInternalNode::NodeIndices& Nod11Indices, HLRAlgo_PolyInternalNode::NodeData& Nod11RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod12Indices, HLRAlgo_PolyInternalNode::NodeData& Nod12RValues, const Standard_Integer i1p1, const Standard_Integer i1p2, const Standard_Integer i1, const Handle(HLRAlgo_PolyInternalData)& pid1, HLRAlgo_Array1OfTData*& TData1, HLRAlgo_Array1OfPISeg*& PISeg1, HLRAlgo_Array1OfPINod*& PINod1, HLRAlgo_PolyInternalNode::NodeIndices& Nod21Indices, HLRAlgo_PolyInternalNode::NodeData& Nod21RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod22Indices, HLRAlgo_PolyInternalNode::NodeData& Nod22RValues, const Standard_Integer i2p1, const Standard_Integer i2p2, const Standard_Integer i2, const Handle(HLRAlgo_PolyInternalData)& pid2, HLRAlgo_Array1OfTData*& TData2, HLRAlgo_Array1OfPISeg*& PISeg2, HLRAlgo_Array1OfPINod*& PINod2, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3, const Standard_Real XT3, const Standard_Real YT3, const Standard_Real ZT3, const Standard_Real coef3, const Standard_Real U3, const Standard_Boolean insP3, const Standard_Boolean mP3P1, const Standard_Real X4, const Standard_Real Y4, const Standard_Real Z4, const Standard_Real XT4, const Standard_Real YT4, const Standard_Real ZT4, const Standard_Real coef4, const Standard_Real U4, const Standard_Boolean insP4, const Standard_Boolean mP4P1, const Standard_Integer flag) const;
   
   Standard_EXPORT void InsertOnOutLine (TColStd_Array1OfTransient& PID);
   
   Standard_EXPORT void CheckFrBackTriangles (HLRAlgo_ListOfBPoint& List, TColStd_Array1OfTransient& PID);
   
-  Standard_EXPORT void FindEdgeOnTriangle (const Standard_Address Tri1Indices, const Standard_Integer ip1, const Standard_Integer ip2, Standard_Integer& jtrouv, Standard_Boolean& isDirect) const;
+  Standard_EXPORT void FindEdgeOnTriangle (const HLRAlgo_TriangleData& theTriangle, const Standard_Integer ip1, const Standard_Integer ip2, Standard_Integer& jtrouv, Standard_Boolean& isDirect) const;
   
-  Standard_EXPORT void ChangeNode (const Standard_Integer ip1, const Standard_Integer ip2, const Standard_Address Nod1Indices, const Standard_Address Nod1RValues, const Standard_Address Nod2Indices, const Standard_Address Nod2RValues, const Standard_Real coef1, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3, const Standard_Boolean first, Standard_Address& TData, Standard_Address& PISeg, Standard_Address& PINod) const;
+  Standard_EXPORT void ChangeNode (const Standard_Integer ip1, const Standard_Integer ip2, HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices, HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod2Indices, HLRAlgo_PolyInternalNode::NodeData& Nod2RValues, const Standard_Real coef1, const Standard_Real X3, const Standard_Real Y3, const Standard_Real Z3, const Standard_Boolean first, HLRAlgo_Array1OfTData*& TData, HLRAlgo_Array1OfPISeg*& PISeg, HLRAlgo_Array1OfPINod*& PINod) const;
   
-  Standard_EXPORT void UpdateAroundNode (const Standard_Integer iNode, const Standard_Address Nod1Indices, const Standard_Address TData, const Standard_Address PISeg, const Standard_Address PINod) const;
+  Standard_EXPORT void UpdateAroundNode (const Standard_Integer iNode, HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices, HLRAlgo_Array1OfTData* TData, HLRAlgo_Array1OfPISeg* PISeg, HLRAlgo_Array1OfPINod* PINod) const;
   
-  Standard_EXPORT void OrientTriangle (const Standard_Integer iTri, const Standard_Address Tri1Indices, const Standard_Address Nod1Indices, const Standard_Address Nod1RValues, const Standard_Address Nod2Indices, const Standard_Address Nod2RValues, const Standard_Address Nod3Indices, const Standard_Address Nod3RValues) const;
+  Standard_EXPORT void OrientTriangle (const Standard_Integer iTri, HLRAlgo_TriangleData& theTriangle, HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices1, HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices2, HLRAlgo_PolyInternalNode::NodeData& Nod2RValues, HLRAlgo_PolyInternalNode::NodeIndices& theNodeIndices3, HLRAlgo_PolyInternalNode::NodeData& Nod3RValues) const;
   
-  Standard_EXPORT Standard_Boolean Triangles (const Standard_Integer ip1, const Standard_Integer ip2, const Standard_Address Nod1Indices, Standard_Address& PISeg, Standard_Integer& iTri1, Standard_Integer& iTri2) const;
+  Standard_EXPORT Standard_Boolean Triangles (const Standard_Integer ip1, const Standard_Integer ip2, HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices, HLRAlgo_Array1OfPISeg*& PISeg, Standard_Integer& iTri1, Standard_Integer& iTri2) const;
   
-  Standard_EXPORT Standard_Boolean NewNode (const Standard_Address Nod1RValues, const Standard_Address Nod2RValues, Standard_Real& coef1, Standard_Boolean& moveP1) const;
+  Standard_EXPORT Standard_Boolean NewNode (HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_PolyInternalNode::NodeData& Nod2RValues, Standard_Real& coef1, Standard_Boolean& moveP1) const;
   
-  Standard_EXPORT void UVNode (const Standard_Address Nod1RValues, const Standard_Address Nod2RValues, const Standard_Real coef1, Standard_Real& U3, Standard_Real& V3) const;
+  Standard_EXPORT void UVNode (HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_PolyInternalNode::NodeData& Nod2RValues, const Standard_Real coef1, Standard_Real& U3, Standard_Real& V3) const;
   
-  Standard_EXPORT void CheckDegeneratedSegment (const Standard_Address Nod1Indices, const Standard_Address Nod1RValues, const Standard_Address Nod2Indices, const Standard_Address Nod2RValues) const;
+  Standard_EXPORT void CheckDegeneratedSegment (HLRAlgo_PolyInternalNode::NodeIndices& Nod1Indices, HLRAlgo_PolyInternalNode::NodeData& Nod1RValues, HLRAlgo_PolyInternalNode::NodeIndices& Nod2Indices, HLRAlgo_PolyInternalNode::NodeData& Nod2RValues) const;
   
   Standard_EXPORT void UpdateOutLines (HLRAlgo_ListOfBPoint& List, TColStd_Array1OfTransient& PID);
   
@@ -247,11 +264,26 @@ private:
   Standard_EXPORT void UpdatePolyData (TColStd_Array1OfTransient& PD, TColStd_Array1OfTransient& PID, const Standard_Boolean closed);
   
   Standard_EXPORT void TMultiply (Standard_Real& X, Standard_Real& Y, Standard_Real& Z, const Standard_Boolean VecPartOnly = Standard_False) const;
-  
+
+  void TMultiply(gp_XYZ& thePoint, const Standard_Boolean VecPartOnly = Standard_False) const
+  {
+    TMultiply(thePoint.ChangeCoord(1), thePoint.ChangeCoord(2), thePoint.ChangeCoord(3), VecPartOnly);
+  }
+
   Standard_EXPORT void TTMultiply (Standard_Real& X, Standard_Real& Y, Standard_Real& Z, const Standard_Boolean VecPartOnly = Standard_False) const;
-  
+
+  void TTMultiply (gp_XYZ& thePoint, const Standard_Boolean VecPartOnly = Standard_False) const
+  {
+    TTMultiply(thePoint.ChangeCoord(1), thePoint.ChangeCoord(2), thePoint.ChangeCoord(3), VecPartOnly);\
+  }
+
   Standard_EXPORT void TIMultiply (Standard_Real& X, Standard_Real& Y, Standard_Real& Z, const Standard_Boolean VecPartOnly = Standard_False) const;
 
+  void TIMultiply (gp_XYZ& thePoint, const Standard_Boolean VecPartOnly = Standard_False) const
+  {
+    TIMultiply(thePoint.ChangeCoord(1), thePoint.ChangeCoord(2), thePoint.ChangeCoord(3), VecPartOnly);
+  }
+
   HLRAlgo_Projector myProj;
   Standard_Real TMat[3][3];
   Standard_Real TLoc[3];
index 007667a..b91d1e6 100644 (file)
 #include <TopoDS_Shape.hxx>
 #include <TopTools_MapOfShape.hxx>
 
-#define PntX1 ((Standard_Real*)Coordinates)[0]
-#define PntY1 ((Standard_Real*)Coordinates)[1]
-#define PntZ1 ((Standard_Real*)Coordinates)[2]
-#define PntX2 ((Standard_Real*)Coordinates)[3]
-#define PntY2 ((Standard_Real*)Coordinates)[4]
-#define PntZ2 ((Standard_Real*)Coordinates)[5]
-
 //=======================================================================
 //function : HLRBRep_PolyHLRToShape
 //purpose  : 
@@ -53,7 +46,7 @@ void HLRBRep_PolyHLRToShape::Update (const Handle(HLRBRep_PolyAlgo)& A)
 {
   myAlgo = A;
   myHideMode = Standard_True;
-  Standard_Real sta,end,XSta,YSta,ZSta,XEnd,YEnd,ZEnd,dx,dy;
+  Standard_Real sta,end;
   Standard_ShortReal tolsta,tolend;
   HLRAlgo_EdgeIterator It;
   myBiPntVis.Clear();
@@ -62,21 +55,17 @@ void HLRBRep_PolyHLRToShape::Update (const Handle(HLRBRep_PolyAlgo)& A)
   Standard_Boolean reg1,regn,outl,intl;
   const gp_Trsf& T = myAlgo->Projector().Transformation();
   HLRAlgo_EdgeStatus status;
-  Standard_Address Coordinates;
 
   for (myAlgo->InitHide(); myAlgo->MoreHide(); myAlgo->NextHide()) {
-    myAlgo->Hide(Coordinates,status,S,reg1,regn,outl,intl);
-    XSta = PntX1;
-    YSta = PntY1;
-    ZSta = PntZ1;
-    XEnd = PntX2;
-    YEnd = PntY2;
-    ZEnd = PntZ2;
-    T.Transforms(XSta,YSta,ZSta);
-    T.Transforms(XEnd,YEnd,ZEnd);
-    dx = XEnd - XSta;
-    dy = YEnd - YSta;
-    if (sqrt(dx * dx + dy * dy) > 1.e-10) {
+    HLRAlgo_BiPoint::PointsT& aPoints = myAlgo->Hide(status,S,reg1,regn,outl,intl);
+    gp_XYZ aSta = aPoints.Pnt1;
+    gp_XYZ aEnd = aPoints.Pnt2;
+    T.Transforms(aSta);
+    T.Transforms(aEnd);
+    const gp_XY aSta2D(aSta.X(), aSta.Y());
+    const gp_XY aEnd2D(aEnd.X(), aEnd.Y());
+    const gp_XY aD = aEnd2D - aSta2D;
+    if (aD.Modulus() > 1.e-10) {
     
       for (It.InitVisible(status);
           It.MoreVisible();
@@ -84,8 +73,7 @@ void HLRBRep_PolyHLRToShape::Update (const Handle(HLRBRep_PolyAlgo)& A)
        It.Visible(sta,tolsta,end,tolend);
        myBiPntVis.Append
          (HLRBRep_BiPnt2D
-          (XSta + sta * dx,YSta + sta * dy,
-           XSta + end * dx,YSta + end * dy,
+          (aSta2D + sta * aD, aSta2D + end * aD,
            S,reg1,regn,outl,intl));
       }
       
@@ -95,8 +83,7 @@ void HLRBRep_PolyHLRToShape::Update (const Handle(HLRBRep_PolyAlgo)& A)
        It.Hidden(sta,tolsta,end,tolend);
        myBiPntHid.Append
          (HLRBRep_BiPnt2D
-          (XSta + sta * dx,YSta + sta * dy,
-           XSta + end * dx,YSta + end * dy,
+          (aSta2D + sta * aD, aSta2D + end * aD,
            S,reg1,regn,outl,intl));
       }
     }
@@ -153,11 +140,9 @@ HLRBRep_PolyHLRToShape::InternalCompound (const Standard_Integer typ,
   else {
     const gp_Trsf& T = myAlgo->Projector().Transformation();
     TopoDS_Shape SBP;
-    Standard_Real XSta,YSta,ZSta,XEnd,YEnd,ZEnd,dx,dy;
-    Standard_Address Coordinates;
 
     for (myAlgo->InitShow(); myAlgo->MoreShow(); myAlgo->NextShow()) {
-      myAlgo->Show(Coordinates,SBP,reg1,regn,outl,intl);
+      HLRAlgo_BiPoint::PointsT& aPoints = myAlgo->Show(SBP,reg1,regn,outl,intl);
       if      (typ == 1) todraw =  intl;
       else if (typ == 2) todraw =  reg1 && !regn && !outl;
       else if (typ == 3) todraw =  regn && !outl;
@@ -165,19 +150,14 @@ HLRBRep_PolyHLRToShape::InternalCompound (const Standard_Integer typ,
       if (todraw)
        if (!S.IsNull()) todraw = Map.Contains(SBP);
       if (todraw) {
-       XSta = PntX1;
-       YSta = PntY1;
-       ZSta = PntZ1;
-       XEnd = PntX2;
-       YEnd = PntY2;
-       ZEnd = PntZ2;
-       T.Transforms(XSta,YSta,ZSta);
-       T.Transforms(XEnd,YEnd,ZEnd);
-       dx = XEnd - XSta;
-       dy = YEnd - YSta;
-       if (sqrt(dx * dx + dy * dy) > 1.e-10) {
-         B.Add(Result,BRepLib_MakeEdge2d(gp_Pnt2d(XSta,YSta),
-                                         gp_Pnt2d(XEnd,YEnd)));
+  gp_XYZ aSta = aPoints.Pnt1, aEnd = aPoints.Pnt2;
+       T.Transforms(aSta);
+       T.Transforms(aEnd);
+  const gp_XY aSta2D(aSta.X(), aSta.Y());
+  const gp_XY aEnd2D(aEnd.X(), aEnd.Y());
+  const gp_XY aD = aEnd2D - aSta2D;
+       if (aD.Modulus() > 1.e-10) {
+         B.Add(Result,BRepLib_MakeEdge2d(aSta2D, aEnd2D));
          added = Standard_True;
        }
       }
index 3de57c8..b29c6cf 100644 (file)
@@ -112,14 +112,3 @@ void HLRBRep_ShapeBounds::Bounds (Standard_Integer& V1,
   F1 = myFaceStart;
   F2 = myFaceEnd;
 }
-
-//=======================================================================
-//function : UpdateMinMax
-//purpose  : 
-//=======================================================================
-
-void HLRBRep_ShapeBounds::UpdateMinMax (const Standard_Address TotMinMax)
-{
-  for (Standard_Integer i = 0; i <= 15; i++)
-    myMinMax[i] = ((Standard_Integer*)TotMinMax)[i];
-}
index dfd532d..69ec055 100644 (file)
 #ifndef _HLRBRep_ShapeBounds_HeaderFile
 #define _HLRBRep_ShapeBounds_HeaderFile
 
+#include <HLRAlgo_EdgesBlock.hxx>
+
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
 #include <Standard_Integer.hxx>
-#include <Standard_Address.hxx>
 class HLRTopoBRep_OutLiner;
 class MMgt_TShared;
 
@@ -60,9 +61,15 @@ public:
   
   Standard_EXPORT void Bounds (Standard_Integer& V1, Standard_Integer& V2, Standard_Integer& E1, Standard_Integer& E2, Standard_Integer& F1, Standard_Integer& F2) const;
   
-  Standard_EXPORT void UpdateMinMax (const Standard_Address TotMinMax);
+  void UpdateMinMax (const HLRAlgo_EdgesBlock::MinMaxIndices& theTotMinMax)
+  {
+    myMinMax = theTotMinMax;
+  }
   
-    Standard_Address MinMax() const;
+  HLRAlgo_EdgesBlock::MinMaxIndices& MinMax()
+  {
+    return myMinMax;
+  }
 
 
 
@@ -86,7 +93,7 @@ private:
   Standard_Integer myEdgeEnd;
   Standard_Integer myFaceStart;
   Standard_Integer myFaceEnd;
-  Standard_Integer myMinMax[16];
+  HLRAlgo_EdgesBlock::MinMaxIndices myMinMax;
 
 
 };
index 0815aa0..9828d08 100644 (file)
@@ -72,11 +72,3 @@ inline void HLRBRep_ShapeBounds::NbOfIso (const Standard_Integer nbIso)
 
 inline Standard_Integer HLRBRep_ShapeBounds::NbOfIso () const
 { return myNbIso; }
-
-//=======================================================================
-//function : MinMax
-//purpose  : 
-//=======================================================================
-
-inline Standard_Address HLRBRep_ShapeBounds::MinMax () const
-{ return (Standard_Address)&myMinMax; }
index a23229e..346de80 100644 (file)
@@ -93,7 +93,7 @@ HLRBRep_Surface::SideRowsOfPoles (const Standard_Real tol,
   Standard_Real x0,y0,x,y,z;
   Standard_Boolean result;
   Standard_Real tole = (Standard_Real)tol;
-  const gp_Trsf& T = ((HLRAlgo_Projector*) myProj)->Transformation();
+  const gp_Trsf& T = myProj->Transformation();
 
   for (iu = 1; iu <= nbuPoles; iu++) {
     
@@ -160,34 +160,34 @@ HLRBRep_Surface::IsSide (const Standard_Real tolF,
     gp_Ax1 A  = Pl.Axis();
     Pt = A.Location();
     D  = A.Direction();
-    Pt.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
-    D .Transform(((HLRAlgo_Projector*) myProj)->Transformation());
-    if (((HLRAlgo_Projector*) myProj)->Perspective()) {
-      r = D.Z() * ((HLRAlgo_Projector*) myProj)->Focus() - 
+    Pt.Transform(myProj->Transformation());
+    D .Transform(myProj->Transformation());
+    if (myProj->Perspective()) {
+      r = D.Z() * myProj->Focus() - 
        ( D.X() * Pt.X() + D.Y() * Pt.Y() + D.Z() * Pt.Z() );
     }
     else r= D.Z();
     return Abs(r) < toler;
   }
   else if (myType == GeomAbs_Cylinder) {
-    if (((HLRAlgo_Projector*) myProj)->Perspective()) return Standard_False;
+    if (myProj->Perspective()) return Standard_False;
     gp_Cylinder Cyl = HLRBRep_BSurfaceTool::Cylinder(mySurf);
     gp_Ax1 A = Cyl.Axis();
     D  = A.Direction();
-    D .Transform(((HLRAlgo_Projector*) myProj)->Transformation());
+    D .Transform(myProj->Transformation());
     r = Sqrt(D.X() * D.X() + D.Y() * D.Y());
     return r < toler;
   }
   else if (myType == GeomAbs_Cone) {
-    if (!((HLRAlgo_Projector*) myProj)->Perspective()) return Standard_False;
+    if (!myProj->Perspective()) return Standard_False;
     gp_Cone Con = HLRBRep_BSurfaceTool::Cone(mySurf);
     Pt = Con.Apex();
-    Pt.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
+    Pt.Transform(myProj->Transformation());
     Standard_Real tol = 0.001;
-    return Pt.IsEqual(gp_Pnt(0,0,((HLRAlgo_Projector*) myProj)->Focus()),tol);
+    return Pt.IsEqual(gp_Pnt(0,0,myProj->Focus()),tol);
   }
   else if (myType == GeomAbs_BezierSurface) {
-    if (((HLRAlgo_Projector*) myProj)->Perspective()) return Standard_False;
+    if (myProj->Perspective()) return Standard_False;
     Standard_Integer nu = HLRBRep_BSurfaceTool::NbUPoles(mySurf);
     Standard_Integer nv = HLRBRep_BSurfaceTool::NbVPoles(mySurf);
     TColgp_Array2OfPnt Pnt(1,nu,1,nv);
@@ -195,7 +195,7 @@ HLRBRep_Surface::IsSide (const Standard_Real tolF,
     return SideRowsOfPoles (tolF,nu,nv,Pnt);
   }
   else if (myType == GeomAbs_BSplineSurface) {
-    if (((HLRAlgo_Projector*) myProj)->Perspective()) return Standard_False;
+    if (myProj->Perspective()) return Standard_False;
     Standard_Integer nu = HLRBRep_BSurfaceTool::NbUPoles(mySurf);
     Standard_Integer nv = HLRBRep_BSurfaceTool::NbVPoles(mySurf);
     TColgp_Array2OfPnt Pnt(1,nu,1,nv);
@@ -214,7 +214,7 @@ HLRBRep_Surface::IsSide (const Standard_Real tolF,
 
 Standard_Boolean  
 HLRBRep_Surface::IsAbove (const Standard_Boolean back,
-                         const Standard_Address A,
+                         const HLRBRep_Curve* A,
                          const Standard_Real tol) const
 { 
   Standard_Boolean planar = (myType == GeomAbs_Plane);
@@ -224,22 +224,20 @@ HLRBRep_Surface::IsAbove (const Standard_Boolean back,
     Pl.Coefficients(a,b,c,d);
     Standard_Real u,u1,u2,dd,x,y,z;
     gp_Pnt P;
-    u1 = ((HLRBRep_Curve*)A)->Parameter3d
-      (((HLRBRep_Curve*)A)->FirstParameter());
-    u2 = ((HLRBRep_Curve*)A)->Parameter3d
-      (((HLRBRep_Curve*)A)->LastParameter());
+    u1 = A->Parameter3d(A->FirstParameter());
+    u2 = A->Parameter3d(A->LastParameter());
     u=u1;
-    ((HLRBRep_Curve*)A)->D0(u,P);
+    A->D0(u,P);
     P.Coord(x,y,z);
     dd = a*x + b*y + c*z + d;
     if (back) dd = -dd;
     if (dd < -tol) return Standard_False;
-    if (((HLRBRep_Curve*)A)->GetType() != GeomAbs_Line) {
+    if (A->GetType() != GeomAbs_Line) {
       Standard_Integer nbPnt = 30;
       Standard_Real step = (u2-u1)/(nbPnt+1);
       for (Standard_Integer i = 1; i <= nbPnt; i++) {
        u += step;
-       ((HLRBRep_Curve*)A)->D0(u,P);
+       A->D0(u,P);
        P.Coord(x,y,z);
        dd = a*x + b*y + c*z + d;
        if (back) dd = -dd;
@@ -247,7 +245,7 @@ HLRBRep_Surface::IsAbove (const Standard_Boolean back,
       }
     }
     u = u2;
-    ((HLRBRep_Curve*)A)->D0(u,P);
+    A->D0(u,P);
     P.Coord(x,y,z);
     dd = a*x + b*y + c*z + d;
     if (back) dd = -dd;
index 2a8766e..5aa2933 100644 (file)
 #ifndef _HLRBRep_Surface_HeaderFile
 #define _HLRBRep_Surface_HeaderFile
 
+#include <HLRBRep_Curve.hxx>
+
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
 #include <BRepAdaptor_Surface.hxx>
 #include <GeomAbs_SurfaceType.hxx>
-#include <Standard_Address.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Real.hxx>
 #include <Standard_Integer.hxx>
@@ -56,7 +57,10 @@ public:
   //! Creates an undefined surface with no face loaded.
   Standard_EXPORT HLRBRep_Surface();
   
-    void Projector (const Standard_Address Proj);
+  void Projector (const HLRAlgo_Projector* Proj)
+  {
+    myProj = Proj;
+  }
   
   //! Returns the 3D Surface.
     BRepAdaptor_Surface& Surface();
@@ -67,7 +71,7 @@ public:
   //! returns true if it is a side face
   Standard_EXPORT Standard_Boolean IsSide (const Standard_Real tolf, const Standard_Real toler) const;
   
-  Standard_EXPORT Standard_Boolean IsAbove (const Standard_Boolean back, const Standard_Address A, const Standard_Real tolC) const;
+  Standard_EXPORT Standard_Boolean IsAbove (const Standard_Boolean back, const HLRBRep_Curve* A, const Standard_Real tolC) const;
   
     Standard_Real FirstUParameter() const;
   
@@ -187,7 +191,7 @@ private:
 
   BRepAdaptor_Surface mySurf;
   GeomAbs_SurfaceType myType;
-  Standard_Address myProj;
+  const HLRAlgo_Projector* myProj;
 
 
 };
index 2c94a83..04941e4 100644 (file)
 #include <BRepAdaptor_Surface.hxx>
 #include <HLRBRep_BSurfaceTool.hxx>
 
-//=======================================================================
-//function : Projector
-//purpose  : 
-//=======================================================================
-
-inline void 
-HLRBRep_Surface::Projector(const Standard_Address Proj)
-{ myProj = Proj; }
-
 //=======================================================================
 //function : Surface
 //purpose  : 
index 2be29eb..a78d4e1 100644 (file)
@@ -67,7 +67,7 @@ HLRTest_DrawablePolyEdgeTool (const Handle(HLRBRep_PolyAlgo)& Alg,
   Standard_Boolean reg1,regn,outl,intl;
 
   for (myAlgo->InitHide(); myAlgo->MoreHide(); myAlgo->NextHide()) {
-    myAlgo->Hide(Coordinates,status,S,reg1,regn,outl,intl);
+    Coordinates = &myAlgo->Hide(status,S,reg1,regn,outl,intl);
     dx = PntX2 - PntX1;
     dy = PntY2 - PntY1;
     dz = PntZ2 - PntZ1;
@@ -151,7 +151,7 @@ void HLRTest_DrawablePolyEdgeTool::DrawOn (Draw_Display& D) const
       D.SetColor(Draw_vert);
 
       for (myAlgo->InitShow(); myAlgo->MoreShow(); myAlgo->NextShow()) {
-       myAlgo->Show(Coordinates,S,reg1,regn,outl,intl);
+       Coordinates = &myAlgo->Show(S,reg1,regn,outl,intl);
        Standard_Boolean todraw = Standard_True;
        if ((!myDispRg1 && reg1 && !outl) ||
            (!myDispRgN && regn && !outl))
index d451dc8..30e5f01 100644 (file)
 #include <TopoDS_Vertex.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
-#define INTERPOLATE 0
-#define BRISE       0
-#define APPROX      1
-
-
 //=======================================================================
 //function : Insert
 //purpose  : explore the faces and insert them
index 0e80c0d..d1ab8b4 100644 (file)
@@ -345,7 +345,7 @@ void HLRTopoBRep_Data::InsertBefore (const TopoDS_Vertex& V,
                                     const Standard_Real P)
 {
   HLRTopoBRep_VData VD(P,V);
-  ((HLRTopoBRep_ListOfVData*)myVList)->InsertBefore(VD,myVIterator);
+  myVList->InsertBefore(VD,myVIterator);
 }
 
 //=======================================================================
@@ -357,6 +357,6 @@ void HLRTopoBRep_Data::Append (const TopoDS_Vertex& V,
                               const Standard_Real P)
 {
   HLRTopoBRep_VData VD(P,V);
-  ((HLRTopoBRep_ListOfVData*)myVList)->Append(VD);
+  myVList->Append(VD);
 }
 
index dd9525c..7f3215b 100644 (file)
@@ -28,7 +28,6 @@
 #include <HLRTopoBRep_MapOfShapeListOfVData.hxx>
 #include <HLRTopoBRep_DataMapIteratorOfMapOfShapeListOfVData.hxx>
 #include <HLRTopoBRep_ListIteratorOfListOfVData.hxx>
-#include <Standard_Address.hxx>
 #include <Standard_Boolean.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <Standard_Real.hxx>
@@ -156,7 +155,7 @@ private:
   HLRTopoBRep_MapOfShapeListOfVData myEdgesVertices;
   HLRTopoBRep_DataMapIteratorOfMapOfShapeListOfVData myEIterator;
   HLRTopoBRep_ListIteratorOfListOfVData myVIterator;
-  Standard_Address myVList;
+  HLRTopoBRep_ListOfVData* myVList;
 
 
 };
index 79ee6ba..fb2e136 100644 (file)
@@ -95,7 +95,7 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
   
   for (hider->InitHide(); hider->MoreHide(); hider->NextHide())
   {
-    hider->Hide(Coordinates, status, S, reg1, regn, outl, intl);
+    Coordinates = &hider->Hide(status, S, reg1, regn, outl, intl);
     
     dx = PntX2 - PntX1;
     dy = PntY2 - PntY1;