OCC22145 Incorrect cutting BRepMesh_FastDiscretFace
authorOAN <>
Thu, 28 Apr 2011 14:31:51 +0000 (14:31 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:27:42 +0000 (19:27 +0400)
src/BRep/BRep_Tool.cxx
src/BRepMesh/BRepMesh.cdl
src/BRepMesh/BRepMesh_FastDiscret.cdl
src/BRepMesh/BRepMesh_FastDiscret.cxx
src/BRepMesh/BRepMesh_FastDiscret.lxx
src/BRepMesh/BRepMesh_FastDiscretFace.cdl
src/BRepMesh/BRepMesh_FastDiscretFace.cxx

index 8e77c1e..f5f3f0a 100755 (executable)
@@ -1,7 +1,7 @@
-// File:       BRep_Tool.cxx
-// Created:    Wed Jul  7 15:35:57 1993
-// Author:     Remi LEQUETTE
-//             <rle@phylox>
+// File:      BRep_Tool.cxx
+// Created:   Wed Jul  7 15:35:57 1993
+// Author:    Remi LEQUETTE
+//            <rle@phylox>
 
 
 #include <BRep_Tool.ixx>
@@ -54,7 +54,7 @@ static
 //=======================================================================
 
 const Handle(Geom_Surface)& BRep_Tool::Surface(const TopoDS_Face& F,
-                                              TopLoc_Location& L)
+                                               TopLoc_Location& L)
 {
   Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
   L = F.Location() * TF->Location();
@@ -92,7 +92,7 @@ Handle(Geom_Surface) BRep_Tool::Surface(const TopoDS_Face& F)
 
 const Handle(Poly_Triangulation)&
 BRep_Tool::Triangulation(const TopoDS_Face& F,
-                        TopLoc_Location&   L)
+                         TopLoc_Location&   L)
 {
   L = F.Location();
   return (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation();
@@ -132,9 +132,9 @@ static Handle(Geom_Curve) nullCurve;
 static Handle(Poly_Polygon3D) nullPolygon3D;
 
 const Handle(Geom_Curve)&  BRep_Tool::Curve(const TopoDS_Edge& E,
-                                           TopLoc_Location& L,
-                                           Standard_Real& First,
-                                           Standard_Real& Last)
+                                            TopLoc_Location& L,
+                                            Standard_Real& First,
+                                            Standard_Real& Last)
 {
   // find the representation
   BRep_ListIteratorOfListOfCurveRepresentation itcr
@@ -162,8 +162,8 @@ const Handle(Geom_Curve)&  BRep_Tool::Curve(const TopoDS_Edge& E,
 //=======================================================================
 
 Handle(Geom_Curve)  BRep_Tool::Curve(const TopoDS_Edge& E,
-                                    Standard_Real& First,
-                                    Standard_Real& Last)
+                                     Standard_Real& First,
+                                     Standard_Real& Last)
 {
   TopLoc_Location L;
   Handle(Geom_Curve) C = Curve(E,L,First,Last);
@@ -211,7 +211,7 @@ Standard_Boolean  BRep_Tool::IsGeometric(const TopoDS_Edge& E)
 //=======================================================================
 
 const Handle(Poly_Polygon3D)& BRep_Tool::Polygon3D(const TopoDS_Edge& E,
-                                                  TopLoc_Location&   L)
+                                                   TopLoc_Location&   L)
 {
   // find the representation
   BRep_ListIteratorOfListOfCurveRepresentation itcr
@@ -239,9 +239,9 @@ const Handle(Poly_Polygon3D)& BRep_Tool::Polygon3D(const TopoDS_Edge& E,
 //=======================================================================
 
 Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, 
-                                              const TopoDS_Face& F,
-                                              Standard_Real& First,
-                                              Standard_Real& Last)
+                                               const TopoDS_Face& F,
+                                               Standard_Real& First,
+                                               Standard_Real& Last)
 {
   TopLoc_Location l;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,l);
@@ -267,10 +267,10 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
 static Handle(Geom2d_Curve) nullPCurve;
 
 Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, 
-                                              const Handle(Geom_Surface)& S,
-                                              const TopLoc_Location& L,
-                                              Standard_Real& First,
-                                              Standard_Real& Last)
+                                               const Handle(Geom_Surface)& S,
+                                               const TopLoc_Location& L,
+                                               Standard_Real& First,
+                                               Standard_Real& Last)
 {
   TopLoc_Location loc = L.Predivided(E.Location());
   Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
@@ -285,9 +285,9 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
       const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
       GC->Range(First,Last);
       if (GC->IsCurveOnClosedSurface() && Eisreversed)
-       return GC->PCurve2();
+        return GC->PCurve2();
       else
-       return GC->PCurve();
+        return GC->PCurve();
     }
     itcr.Next();
   }
@@ -306,12 +306,11 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
 
   if (!GP.IsNull()) {
 
-    static Handle(GeomAdaptor_HCurve) HC;
-    static Handle(GeomAdaptor_HSurface) HS;
-    if (HC.IsNull()) {
-      HC = new GeomAdaptor_HCurve();
-      HS = new GeomAdaptor_HSurface();
-    }
+    Handle(GeomAdaptor_HCurve) HC;
+    Handle(GeomAdaptor_HSurface) HS;
+
+    HC = new GeomAdaptor_HCurve();
+    HS = new GeomAdaptor_HSurface();
 
     TopLoc_Location LC;
 
@@ -335,9 +334,9 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
     
     Handle(Geom_Curve) ProjOnPlane = 
       GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l),
-                                 Plane,
-                                 Plane->Position().Direction(),
-                                 Standard_True);
+                                  Plane,
+                                  Plane->Position().Direction(),
+                                  Standard_True);
     
     GeomAdaptor_Curve& GAC = HC->ChangeCurve();
     GAC.Load(ProjOnPlane);
@@ -347,7 +346,7 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
 
     if (pc->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
       Handle(Geom2d_TrimmedCurve) TC = 
-       (*((Handle(Geom2d_TrimmedCurve)*)&pc));
+        (*((Handle(Geom2d_TrimmedCurve)*)&pc));
       pc = TC->BasisCurve();
     }
     First = f; Last = l;
@@ -363,11 +362,11 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
 //=======================================================================
 
 void  BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, 
-                               Handle(Geom2d_Curve)& C, 
-                               Handle(Geom_Surface)& S, 
-                               TopLoc_Location& L,
-                               Standard_Real& First,
-                               Standard_Real& Last)
+                                Handle(Geom2d_Curve)& C, 
+                                Handle(Geom_Surface)& S, 
+                                TopLoc_Location& L,
+                                Standard_Real& First,
+                                Standard_Real& Last)
 {
   // find the representation
   BRep_ListIteratorOfListOfCurveRepresentation itcr
@@ -397,12 +396,12 @@ void  BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
 //=======================================================================
 
 void  BRep_Tool::CurveOnSurface(const TopoDS_Edge& E, 
-                               Handle(Geom2d_Curve)& C, 
-                               Handle(Geom_Surface)& S, 
-                               TopLoc_Location& L,
-                               Standard_Real& First,
-                               Standard_Real& Last,
-                               const Standard_Integer Index)
+                                Handle(Geom2d_Curve)& C, 
+                                Handle(Geom_Surface)& S, 
+                                TopLoc_Location& L,
+                                Standard_Real& First,
+                                Standard_Real& Last,
+                                const Standard_Integer Index)
 {
   Standard_Integer i = 0;
   Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
@@ -418,18 +417,18 @@ void  BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
       i++;
       if (i > Index) break;
       if (i == Index) {
-       // JMB le 21 Mai 1999
-       // on fait comme dans les autres methodes CurveOnSurface. c.a.d on tient
-       // compte de l'orientation dans le cas des aretes de coutures (renvoi de PCurve2)
-       // sinon on risque de louper des curves ou de ne pas obtenir la bonne.
-       if (GC->IsCurveOnClosedSurface() && Eisreversed)
-         C = GC->PCurve2();
-       else
-         C = GC->PCurve();
-       S = GC->Surface();
-       L = E.Location() * GC->Location();
-       GC->Range(First,Last);
-       return;
+        // JMB le 21 Mai 1999
+        // on fait comme dans les autres methodes CurveOnSurface. c.a.d on tient
+        // compte de l'orientation dans le cas des aretes de coutures (renvoi de PCurve2)
+        // sinon on risque de louper des curves ou de ne pas obtenir la bonne.
+        if (GC->IsCurveOnClosedSurface() && Eisreversed)
+          C = GC->PCurve2();
+        else
+          C = GC->PCurve();
+        S = GC->Surface();
+        L = E.Location() * GC->Location();
+        GC->Range(First,Last);
+        return;
       }
     }
     itcr.Next();
@@ -448,7 +447,7 @@ void  BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
 //=======================================================================
 
 Handle(Poly_Polygon2D) BRep_Tool::PolygonOnSurface(const TopoDS_Edge& E, 
-                                                  const TopoDS_Face& F)
+                                                   const TopoDS_Face& F)
 {
   TopLoc_Location l;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,l);
@@ -474,8 +473,8 @@ static Handle(Poly_Polygon2D) nullPolygon2D;
 
 Handle(Poly_Polygon2D) 
      BRep_Tool::PolygonOnSurface(const TopoDS_Edge& E, 
-                                const Handle(Geom_Surface)& S,
-                                const TopLoc_Location& L)
+                                 const Handle(Geom_Surface)& S,
+                                 const TopLoc_Location& L)
 {
   TopLoc_Location l = L.Predivided(E.Location());
   Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
@@ -488,9 +487,9 @@ Handle(Poly_Polygon2D)
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsPolygonOnSurface(S,l)) {
       if (cr->IsPolygonOnClosedSurface() && Eisreversed )
-       return cr->Polygon2();
+        return cr->Polygon2();
       else
-       return cr->Polygon();
+        return cr->Polygon();
     }
     itcr.Next();
   }
@@ -504,9 +503,9 @@ Handle(Poly_Polygon2D)
 //=======================================================================
 
 void BRep_Tool::PolygonOnSurface(const TopoDS_Edge&      E,
-                                Handle(Poly_Polygon2D)& P,
-                                Handle(Geom_Surface)&   S,
-                                TopLoc_Location&        L)
+                                 Handle(Poly_Polygon2D)& P,
+                                 Handle(Geom_Surface)&   S,
+                                 TopLoc_Location&        L)
 {
   // find the representation
   BRep_ListIteratorOfListOfCurveRepresentation itcr
@@ -516,7 +515,7 @@ void BRep_Tool::PolygonOnSurface(const TopoDS_Edge&      E,
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsPolygonOnSurface()) {
       const Handle(BRep_PolygonOnSurface)& PS = 
-       *((Handle(BRep_PolygonOnSurface)*)&cr);
+        *((Handle(BRep_PolygonOnSurface)*)&cr);
       P = PS->Polygon();
       S = PS->Surface();
       L = E.Location() * PS->Location();
@@ -536,10 +535,10 @@ void BRep_Tool::PolygonOnSurface(const TopoDS_Edge&      E,
 //=======================================================================
 
 void BRep_Tool::PolygonOnSurface(const TopoDS_Edge&      E,
-                                Handle(Poly_Polygon2D)& P,
-                                Handle(Geom_Surface)&   S,
-                                TopLoc_Location&        L,
-                                const Standard_Integer  Index)
+                                 Handle(Poly_Polygon2D)& P,
+                                 Handle(Geom_Surface)&   S,
+                                 TopLoc_Location&        L,
+                                 const Standard_Integer  Index)
 {
   Standard_Integer i = 0;
 
@@ -551,14 +550,14 @@ void BRep_Tool::PolygonOnSurface(const TopoDS_Edge&      E,
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsPolygonOnSurface()) {
       const Handle(BRep_PolygonOnSurface)& PS = 
-       *((Handle(BRep_PolygonOnSurface)*)&cr);
+        *((Handle(BRep_PolygonOnSurface)*)&cr);
       i++;
       if (i > Index) break;
       if (i == Index) {
-       P = PS->Polygon();
-       S = PS->Surface();
-       L = E.Location() * PS->Location();
-       return;
+        P = PS->Polygon();
+        S = PS->Surface();
+        L = E.Location() * PS->Location();
+        return;
       }
     }
     itcr.Next();
@@ -580,8 +579,8 @@ static Handle(Poly_PolygonOnTriangulation) nullArray;
 
 const Handle(Poly_PolygonOnTriangulation)&
 BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                E, 
-                                 const Handle(Poly_Triangulation)& T,
-                                 const TopLoc_Location&            L)
+                                  const Handle(Poly_Triangulation)& T,
+                                  const TopLoc_Location&            L)
 {
   TopLoc_Location l = L.Predivided(E.Location());
   Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
@@ -594,9 +593,9 @@ BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                E,
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if ( cr->IsPolygonOnTriangulation(T,l)) {
       if ( cr->IsPolygonOnClosedTriangulation() && Eisreversed )
-       return cr->PolygonOnTriangulation2();
+        return cr->PolygonOnTriangulation2();
       else
-       return cr->PolygonOnTriangulation();
+        return cr->PolygonOnTriangulation();
     }
     itcr.Next();
   }
@@ -611,9 +610,9 @@ BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                E,
 
 void 
 BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                   E,
-                                 Handle(Poly_PolygonOnTriangulation)& P,
-                                 Handle(Poly_Triangulation)&          T,
-                                 TopLoc_Location&                     L)
+                                  Handle(Poly_PolygonOnTriangulation)& P,
+                                  Handle(Poly_Triangulation)&          T,
+                                  TopLoc_Location&                     L)
 {
   // find the representation
   BRep_ListIteratorOfListOfCurveRepresentation itcr
@@ -623,7 +622,7 @@ BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                   E,
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsPolygonOnTriangulation()) {
       const Handle(BRep_PolygonOnTriangulation)& PT = 
-       *((Handle(BRep_PolygonOnTriangulation)*)&cr);
+        *((Handle(BRep_PolygonOnTriangulation)*)&cr);
       P = PT->PolygonOnTriangulation();
       T = PT->Triangulation();
       L = E.Location() * PT->Location();
@@ -644,10 +643,10 @@ BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                   E,
 
 void 
 BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                   E,
-                                 Handle(Poly_PolygonOnTriangulation)& P,
-                                 Handle(Poly_Triangulation)&          T,
-                                 TopLoc_Location&                     L,
-                                 const Standard_Integer               Index)
+                                  Handle(Poly_PolygonOnTriangulation)& P,
+                                  Handle(Poly_Triangulation)&          T,
+                                  TopLoc_Location&                     L,
+                                  const Standard_Integer               Index)
 {
   Standard_Integer i = 0;
 
@@ -659,14 +658,14 @@ BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                   E,
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsPolygonOnTriangulation()) {
       const Handle(BRep_PolygonOnTriangulation)& PT = 
-       *((Handle(BRep_PolygonOnTriangulation)*)&cr);
+        *((Handle(BRep_PolygonOnTriangulation)*)&cr);
       i++;
       if (i > Index) break;
       if (i == Index) {
-       T = PT->Triangulation();
-       P = PT->PolygonOnTriangulation();
-       L = E.Location() * PT->Location();
-       return;
+        T = PT->Triangulation();
+        P = PT->PolygonOnTriangulation();
+        L = E.Location() * PT->Location();
+        return;
       }
     }
     itcr.Next();
@@ -685,7 +684,7 @@ BRep_Tool::PolygonOnTriangulation(const TopoDS_Edge&                   E,
 //=======================================================================
 
 Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge& E, 
-                                    const TopoDS_Face& F)
+                                     const TopoDS_Face& F)
 {
   TopLoc_Location l;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,l);
@@ -701,8 +700,8 @@ Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge& E,
 //=======================================================================
 
 Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge& E,
-                                    const Handle(Geom_Surface)& S,
-                                    const TopLoc_Location& L)
+                                     const Handle(Geom_Surface)& S,
+                                     const TopLoc_Location& L)
 {
   //modified by NIZNHY-PKV Fri Oct 17 12:16:58 2008f
   if (IsPlane(S)) {
@@ -719,7 +718,7 @@ Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge& E,
   while (itcr.More()) {
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsCurveOnSurface(S,l) &&
-       cr->IsCurveOnClosedSurface())
+        cr->IsCurveOnClosedSurface())
       return Standard_True;
     itcr.Next();
   }
@@ -733,7 +732,7 @@ Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge& E,
 //=======================================================================
 
 Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge&                E, 
-                                    const Handle(Poly_Triangulation)& T)
+                                     const Handle(Poly_Triangulation)& T)
 {
   TopLoc_Location      l = E.Location();
 
@@ -744,7 +743,7 @@ Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge&                E,
   while (itcr.More()) {
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsPolygonOnTriangulation(T,l) &&
-       cr->IsPolygonOnClosedTriangulation()) 
+        cr->IsPolygonOnClosedTriangulation()) 
       return Standard_True;
     itcr.Next();
   }
@@ -800,8 +799,8 @@ Standard_Boolean  BRep_Tool::Degenerated(const TopoDS_Edge& E)
 //=======================================================================
 
 void  BRep_Tool::Range(const TopoDS_Edge& E, 
-                      Standard_Real& First, 
-                      Standard_Real& Last)
+                       Standard_Real& First, 
+                       Standard_Real& Last)
 {
   //  set the range to all the representations
   BRep_ListIteratorOfListOfCurveRepresentation itcr
@@ -812,9 +811,9 @@ void  BRep_Tool::Range(const TopoDS_Edge& E,
     if (cr->IsCurve3D()) {
       const Handle(BRep_Curve3D)& CR = *((Handle(BRep_Curve3D)*)&cr);
       if (!CR->Curve3D().IsNull()) {
-       First = CR->First(); 
-       Last = CR->Last();
-       break;
+        First = CR->First(); 
+        Last = CR->Last();
+        break;
       }
     }
     else if (cr->IsCurveOnSurface()) {
@@ -833,10 +832,10 @@ void  BRep_Tool::Range(const TopoDS_Edge& E,
 //=======================================================================
 
 void  BRep_Tool::Range(const TopoDS_Edge& E, 
-                      const Handle(Geom_Surface)& S,
-                      const TopLoc_Location& L,
-                      Standard_Real& First, 
-                      Standard_Real& Last)
+                       const Handle(Geom_Surface)& S,
+                       const TopLoc_Location& L,
+                       Standard_Real& First, 
+                       Standard_Real& Last)
 {
   TopLoc_Location l = L.Predivided(E.Location());
   
@@ -864,9 +863,9 @@ void  BRep_Tool::Range(const TopoDS_Edge& E,
 //=======================================================================
 
 void  BRep_Tool::Range(const TopoDS_Edge& E, 
-                      const TopoDS_Face& F, 
-                      Standard_Real& First, 
-                      Standard_Real& Last)
+                       const TopoDS_Face& F, 
+                       Standard_Real& First, 
+                       Standard_Real& Last)
 {
   TopLoc_Location L;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,L);
@@ -879,10 +878,10 @@ void  BRep_Tool::Range(const TopoDS_Edge& E,
 //=======================================================================
 
 void  BRep_Tool::UVPoints(const TopoDS_Edge& E, 
-                         const Handle(Geom_Surface)& S, 
-                         const TopLoc_Location& L, 
-                         gp_Pnt2d& PFirst, 
-                         gp_Pnt2d& PLast)
+                          const Handle(Geom_Surface)& S, 
+                          const TopLoc_Location& L, 
+                          gp_Pnt2d& PFirst, 
+                          gp_Pnt2d& PLast)
 {
   TopLoc_Location l = L.Predivided(E.Location());
   Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
@@ -895,9 +894,9 @@ void  BRep_Tool::UVPoints(const TopoDS_Edge& E,
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsCurveOnSurface(S,l)) {
       if (cr->IsCurveOnClosedSurface() && Eisreversed)
-       (*((Handle(BRep_CurveOnClosedSurface)*)&cr))->UVPoints2(PFirst,PLast);
+        (*((Handle(BRep_CurveOnClosedSurface)*)&cr))->UVPoints2(PFirst,PLast);
       else
-       (*((Handle(BRep_CurveOnSurface)*)&cr))->UVPoints(PFirst,PLast);
+        (*((Handle(BRep_CurveOnSurface)*)&cr))->UVPoints(PFirst,PLast);
       return;
     }
     itcr.Next();
@@ -946,9 +945,9 @@ void  BRep_Tool::UVPoints(const TopoDS_Edge& E,
 //=======================================================================
 
 void  BRep_Tool::UVPoints(const TopoDS_Edge& E,
-                         const TopoDS_Face& F, 
-                         gp_Pnt2d& PFirst, 
-                         gp_Pnt2d& PLast)
+                          const TopoDS_Face& F, 
+                          gp_Pnt2d& PFirst, 
+                          gp_Pnt2d& PLast)
 {
   TopLoc_Location L;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,L);
@@ -969,10 +968,10 @@ void  BRep_Tool::UVPoints(const TopoDS_Edge& E,
 //=======================================================================
 
 void  BRep_Tool::SetUVPoints(const TopoDS_Edge& E,
-                            const Handle(Geom_Surface)& S,
-                            const TopLoc_Location& L, 
-                            const gp_Pnt2d& PFirst, 
-                            const gp_Pnt2d& PLast)
+                             const Handle(Geom_Surface)& S,
+                             const TopLoc_Location& L, 
+                             const gp_Pnt2d& PFirst, 
+                             const gp_Pnt2d& PLast)
 {
   TopLoc_Location l = L.Predivided(E.Location());
   Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
@@ -985,11 +984,11 @@ void  BRep_Tool::SetUVPoints(const TopoDS_Edge& E,
     const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsCurveOnSurface(S,l)) {
       if (cr->IsCurveOnClosedSurface() && Eisreversed)
-       (*((Handle(BRep_CurveOnClosedSurface)*) &cr))->
-         SetUVPoints2(PFirst,PLast);
+        (*((Handle(BRep_CurveOnClosedSurface)*) &cr))->
+          SetUVPoints2(PFirst,PLast);
       else
-       (*((Handle(BRep_CurveOnSurface)*) &cr))->
-         SetUVPoints(PFirst,PLast);
+        (*((Handle(BRep_CurveOnSurface)*) &cr))->
+          SetUVPoints(PFirst,PLast);
     }
     itcr.Next();
   }
@@ -1001,9 +1000,9 @@ void  BRep_Tool::SetUVPoints(const TopoDS_Edge& E,
 //=======================================================================
 
 void  BRep_Tool::SetUVPoints(const TopoDS_Edge& E,
-                            const TopoDS_Face& F, 
-                            const gp_Pnt2d& PFirst, 
-                            const gp_Pnt2d& PLast)
+                             const TopoDS_Face& F, 
+                             const gp_Pnt2d& PFirst, 
+                             const gp_Pnt2d& PLast)
 {
   TopLoc_Location L;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,L);
@@ -1024,8 +1023,8 @@ void  BRep_Tool::SetUVPoints(const TopoDS_Edge& E,
 //=======================================================================
 
 Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E, 
-                                         const TopoDS_Face& F1, 
-                                         const TopoDS_Face& F2)
+                                          const TopoDS_Face& F1, 
+                                          const TopoDS_Face& F2)
 {
   TopLoc_Location l1,l2;
   const Handle(Geom_Surface)& S1 = BRep_Tool::Surface(F1,l1);
@@ -1039,8 +1038,8 @@ Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E,
 //=======================================================================
 
 GeomAbs_Shape  BRep_Tool::Continuity(const TopoDS_Edge& E, 
-                                    const TopoDS_Face& F1, 
-                                    const TopoDS_Face& F2)
+                                     const TopoDS_Face& F1, 
+                                     const TopoDS_Face& F2)
 {
   TopLoc_Location l1,l2;
   const Handle(Geom_Surface)& S1 = BRep_Tool::Surface(F1,l1);
@@ -1054,10 +1053,10 @@ GeomAbs_Shape  BRep_Tool::Continuity(const TopoDS_Edge& E,
 //=======================================================================
 
 Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E, 
-                                         const Handle(Geom_Surface)& S1, 
-                                         const Handle(Geom_Surface)& S2, 
-                                         const TopLoc_Location& L1, 
-                                         const TopLoc_Location& L2)
+                                          const Handle(Geom_Surface)& S1, 
+                                          const Handle(Geom_Surface)& S2, 
+                                          const TopLoc_Location& L1, 
+                                          const TopLoc_Location& L2)
 {
   const TopLoc_Location& Eloc = E.Location();
   TopLoc_Location l1 = L1.Predivided(Eloc);
@@ -1082,10 +1081,10 @@ Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E,
 //=======================================================================
 
 GeomAbs_Shape  BRep_Tool::Continuity(const TopoDS_Edge& E, 
-                                    const Handle(Geom_Surface)& S1, 
-                                    const Handle(Geom_Surface)& S2, 
-                                    const TopLoc_Location& L1, 
-                                    const TopLoc_Location& L2)
+                                     const Handle(Geom_Surface)& S1, 
+                                     const Handle(Geom_Surface)& S2, 
+                                     const TopLoc_Location& L1, 
+                                     const TopLoc_Location& L2)
 {
   TopLoc_Location l1 = L1.Predivided(E.Location());
   TopLoc_Location l2 = L2.Predivided(E.Location());
@@ -1135,7 +1134,7 @@ Standard_Real  BRep_Tool::Tolerance(const TopoDS_Vertex& V)
 //=======================================================================
 
 Standard_Real  BRep_Tool::Parameter(const TopoDS_Vertex& V, 
-                                   const TopoDS_Edge& E)
+                                  const TopoDS_Edge& E)
 {
   
   // Search the vertex in the edge
@@ -1158,13 +1157,13 @@ Standard_Real  BRep_Tool::Parameter(const TopoDS_Vertex& V,
     const TopoDS_Shape& Vcur = itv.Value();
     if (V.IsSame(Vcur)) {
       if (VF.IsNull()) {
-       VF = Vcur;
+        VF = Vcur;
       }
       else {
-       rev = E.Orientation() == TopAbs_REVERSED;
-       if (Vcur.Orientation() == V.Orientation()) {
-         VF = Vcur;
-       }
+        rev = E.Orientation() == TopAbs_REVERSED;
+        if (Vcur.Orientation() == V.Orientation()) {
+          VF = Vcur;
+        }
       }
     }
     itv.Next();
@@ -1190,30 +1189,30 @@ Standard_Real  BRep_Tool::Parameter(const TopoDS_Vertex& V,
     L = L.Predivided(V.Location());
     if (!C.IsNull() || Degenerated(E)) {
       BRep_ListIteratorOfListOfPointRepresentation itpr
-       ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
+        ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
 
       while (itpr.More()) {
-       const Handle(BRep_PointRepresentation)& pr = itpr.Value();
-       if (pr->IsPointOnCurve(C,L)) {
-         Standard_Real p = pr->Parameter();
-         Standard_Real res = p;// SVV 4 nov 99 - to avoid warnings on Linux
-         if (!C.IsNull()) {
-           // Closed curves RLE 16 june 94
-           if (Precision::IsNegativeInfinite(f)) return pr->Parameter();//p;
-           if (Precision::IsPositiveInfinite(l)) return pr->Parameter();//p;
-           gp_Pnt Pf = C->Value(f).Transformed(L.Transformation());
-           gp_Pnt Pl = C->Value(l).Transformed(L.Transformation());
-           Standard_Real tol = BRep_Tool::Tolerance(V);
-           if (Pf.Distance(Pl) < tol) {
-             if (Pf.Distance(BRep_Tool::Pnt(V)) < tol) {
-               if (V.Orientation() == TopAbs_FORWARD) res = f;//p = f;
-               else                                   res = l;//p = l;
-             }
-           }
-         }
-         return res;//p;
-       }
-       itpr.Next();
+        const Handle(BRep_PointRepresentation)& pr = itpr.Value();
+        if (pr->IsPointOnCurve(C,L)) {
+          Standard_Real p = pr->Parameter();
+          Standard_Real res = p;// SVV 4 nov 99 - to avoid warnings on Linux
+          if (!C.IsNull()) {
+            // Closed curves RLE 16 june 94
+            if (Precision::IsNegativeInfinite(f)) return pr->Parameter();//p;
+            if (Precision::IsPositiveInfinite(l)) return pr->Parameter();//p;
+            gp_Pnt Pf = C->Value(f).Transformed(L.Transformation());
+            gp_Pnt Pl = C->Value(l).Transformed(L.Transformation());
+            Standard_Real tol = BRep_Tool::Tolerance(V);
+            if (Pf.Distance(Pl) < tol) {
+              if (Pf.Distance(BRep_Tool::Pnt(V)) < tol) {
+                if (V.Orientation() == TopAbs_FORWARD) res = f;//p = f;
+                else                                   res = l;//p = l;
+              }
+            }
+          }
+          return res;//p;
+        }
+        itpr.Next();
       }
     }
     else {
@@ -1224,23 +1223,23 @@ Standard_Real  BRep_Tool::Parameter(const TopoDS_Vertex& V,
       BRep_Tool::CurveOnSurface(E,PC,S,L,f,l);
       L = L.Predivided(V.Location()); 
       BRep_ListIteratorOfListOfPointRepresentation itpr
-       ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
+        ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
 
       while (itpr.More()) {
-       const Handle(BRep_PointRepresentation)& pr = itpr.Value();
-       if (pr->IsPointOnCurveOnSurface(PC,S,L)) {
-         Standard_Real p = pr->Parameter();
-         // Closed curves RLE 16 june 94
-         if (PC->IsClosed()) {
-           if ((p == PC->FirstParameter()) || 
-               (p == PC->LastParameter())) {
-             if (V.Orientation() == TopAbs_FORWARD) p = PC->FirstParameter();
-             else                                   p = PC->LastParameter();
-           }
-         }
-         return p;
-       }
-       itpr.Next();
+        const Handle(BRep_PointRepresentation)& pr = itpr.Value();
+        if (pr->IsPointOnCurveOnSurface(PC,S,L)) {
+          Standard_Real p = pr->Parameter();
+          // Closed curves RLE 16 june 94
+          if (PC->IsClosed()) {
+            if ((p == PC->FirstParameter()) || 
+                (p == PC->LastParameter())) {
+              if (V.Orientation() == TopAbs_FORWARD) p = PC->FirstParameter();
+              else                                   p = PC->LastParameter();
+            }
+          }
+          return p;
+        }
+        itpr.Next();
       }
     }
   }
@@ -1256,8 +1255,8 @@ Standard_Real  BRep_Tool::Parameter(const TopoDS_Vertex& V,
 //=======================================================================
 
 Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V, 
-                                  const TopoDS_Edge& E, 
-                                  const TopoDS_Face& F)
+                                   const TopoDS_Edge& E, 
+                                   const TopoDS_Face& F)
 {
   TopLoc_Location L;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,L);
@@ -1271,9 +1270,9 @@ Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
 //=======================================================================
 
 Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V, 
-                                  const TopoDS_Edge& E, 
-                                  const Handle(Geom_Surface)& S,
-                                  const TopLoc_Location& L)
+                                   const TopoDS_Edge& E, 
+                                   const Handle(Geom_Surface)& S,
+                                   const TopLoc_Location& L)
 {
   // Search the vertex in the edge
 
@@ -1285,9 +1284,9 @@ Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
     if (V.IsSame(itv.Value())) {
       if (VF.IsNull()) VF = itv.Value();
       else {
-       rev = E.Orientation() == TopAbs_REVERSED;
-       if (itv.Value().Orientation() == V.Orientation()) 
-       VF = itv.Value();
+        rev = E.Orientation() == TopAbs_REVERSED;
+        if (itv.Value().Orientation() == V.Orientation()) 
+        VF = itv.Value();
       }
     }
     itv.Next();
@@ -1332,23 +1331,23 @@ Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
     while (itpr.More()) {
       const Handle(BRep_PointRepresentation)& pr = itpr.Value();
       if (pr->IsPointOnCurve(C,L1)) {
-       Standard_Real p = pr->Parameter();
-       Standard_Real res = p;
-       if (!C.IsNull()) {
-         // Closed curves RLE 16 june 94
-         if (Precision::IsNegativeInfinite(f)) return res;
-         if (Precision::IsPositiveInfinite(l)) return res;
-         gp_Pnt Pf = C->Value(f).Transformed(L1.Transformation());
-         gp_Pnt Pl = C->Value(l).Transformed(L1.Transformation());
-         Standard_Real tol = BRep_Tool::Tolerance(V);
-         if (Pf.Distance(Pl) < tol) {
-           if (Pf.Distance(BRep_Tool::Pnt(V)) < tol) {
-             if (V.Orientation() == TopAbs_FORWARD) res = f;
-             else                                   res = l;
-           }
-         }
-       }
-       return res;
+        Standard_Real p = pr->Parameter();
+        Standard_Real res = p;
+        if (!C.IsNull()) {
+          // Closed curves RLE 16 june 94
+          if (Precision::IsNegativeInfinite(f)) return res;
+          if (Precision::IsPositiveInfinite(l)) return res;
+          gp_Pnt Pf = C->Value(f).Transformed(L1.Transformation());
+          gp_Pnt Pl = C->Value(l).Transformed(L1.Transformation());
+          Standard_Real tol = BRep_Tool::Tolerance(V);
+          if (Pf.Distance(Pl) < tol) {
+            if (Pf.Distance(BRep_Tool::Pnt(V)) < tol) {
+              if (V.Orientation() == TopAbs_FORWARD) res = f;
+              else                                   res = l;
+            }
+          }
+        }
+        return res;
       }
       itpr.Next();
     }
@@ -1366,7 +1365,7 @@ Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
 //=======================================================================
 
 gp_Pnt2d  BRep_Tool::Parameters(const TopoDS_Vertex& V, 
-                               const TopoDS_Face& F)
+                                const TopoDS_Face& F)
 {
   TopLoc_Location L;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,L);
@@ -1378,7 +1377,7 @@ gp_Pnt2d  BRep_Tool::Parameters(const TopoDS_Vertex& V,
   while (itpr.More()) {
     if (itpr.Value()->IsPointOnSurface(S,L)) {
       return gp_Pnt2d(itpr.Value()->Parameter(),
-                     itpr.Value()->Parameter2());
+                      itpr.Value()->Parameter2());
     }
     itpr.Next();
   }
index 4e3b1b0..b47c61f 100755 (executable)
--- File:       BRepMesh.cdl
--- Created:    Wed Sep 22 17:34:57 1993
--- Author:     Didier PIFFAULT
---             <dpf@zerox>
----Copyright:   Matra Datavision 1993, 1994
+-- File:        BRepMesh.cdl
+-- Created:     Wed Sep 22 17:34:57 1993
+-- Author:      Didier PIFFAULT
+--              <dpf@zerox>
+---Copyright:    Matra Datavision 1993, 1994
  
 
-package BRepMesh 
+package BRepMesh
 
-       ---Purpose: Instantiated   package for the   class of packages
-       --          MeshAlgo, and so on ...
+        ---Purpose: Instantiated   package for the   class of packages
+        --          MeshAlgo, and so on ...
 
         ---Level : Advanced.  
         --  All methods of all  classes will be advanced.
 
 
 uses    Standard,
-       gp,
-       Bnd,
-       TColStd,
-       TColgp,
-       GCPnts,
-       BRepAdaptor,
-       BRepTopAdaptor,
-       MeshDS,
-       MeshAlgo,
-       TCollection,
-       MMgt,
-       TopoDS,
-       TopAbs,
-       TopExp,
-       TopTools,
-       Poly,
-       Geom2d,
-       GeomAbs,
-        GeomAdaptor
+        gp,
+        Bnd,
+        TColStd,
+        TColgp,
+        GCPnts,
+        BRepAdaptor,
+        BRepTopAdaptor,
+        MeshDS,
+        MeshAlgo,
+        TCollection,
+        MMgt,
+        TopoDS,
+        TopAbs,
+        TopExp,
+        TopTools,
+        Poly,
+        Geom2d,
+        GeomAbs,
+        GeomAdaptor,
+        TopLoc
 
 
 is 
 
-       enumeration Status  is 
-           ---Purpose: Discribes the wires discretisation.
-           NoError,
-           OpenWire,
-           SelfIntersectingWire,
-           Failure,
-           ReMesh
-           
-       end Status;
-        
-       enumeration FactoryError is 
-           FE_NOERROR,  
-           FE_LIBRARYNOTFOUND,
-           FE_FUNCTIONNOTFOUND,
-           FE_CANNOTCREATEALGO
-       end FactoryError;   
-       
-        class Vertex;
-
-        class Edge;
-
-       class Triangle;
-
-       class ShapeTool;
-       
-       deferred class DiscretRoot; 
-       class DiscretFactory;
-       --
-       pointer PDiscretRoot to DiscretRoot from BRepMesh;
-       --
-
-       class Delaun instantiates Delaunay from MeshAlgo(Vertex   from BRepMesh,
-                                                        Edge     from BRepMesh,
-                                                        Triangle from BRepMesh);
-
-       class DataMapOfVertexInteger instantiates DataMap from TCollection
-         (Vertex from TopoDS, Integer from Standard, ShapeMapHasher from TopTools);
-
-       class ListOfVertex instantiates List from TCollection 
-           (Vertex from  BRepMesh);
+      enumeration Status  is 
+      ---Purpose: Discribes the wires discretisation.
+        NoError,
+        OpenWire,
+        SelfIntersectingWire,
+        Failure,
+        ReMesh 
+      end Status;
+       
+      enumeration FactoryError is 
+        FE_NOERROR,  
+        FE_LIBRARYNOTFOUND,
+        FE_FUNCTIONNOTFOUND,
+        FE_CANNOTCREATEALGO
+      end FactoryError;   
+      
+      class Vertex;
+
+      class Edge;
+
+      class Triangle;
+
+      class ShapeTool;
+      
+      deferred class DiscretRoot; 
+      class DiscretFactory;
+      --
+      pointer PDiscretRoot to DiscretRoot from BRepMesh;
+      --
+
+      class Delaun instantiates Delaunay from MeshAlgo(Vertex   from BRepMesh,
+                                                       Edge     from BRepMesh,
+                                                       Triangle from BRepMesh);
+
+      class DataMapOfVertexInteger instantiates DataMap from TCollection
+          (Vertex from TopoDS, Integer from Standard, ShapeMapHasher from TopTools);
+
+      class ListOfVertex instantiates List from TCollection 
+          (Vertex from  BRepMesh);
 
         class ListOfXY instantiates List from TCollection (XY from gp);
 
-       class DataMapOfIntegerListOfXY  instantiates DataMap from TCollection
-          (Integer from Standard, ListOfXY from BRepMesh, MapIntegerHasher from TColStd);
+      class DataMapOfIntegerListOfXY  instantiates DataMap from TCollection
+          (Integer from Standard, ListOfXY from BRepMesh, MapIntegerHasher from TColStd);
 
 
-       class  VertexHasher  instantiates   MapHasher  from  TCollection(Vertex  from  BRepMesh);
+      class  VertexHasher  instantiates   MapHasher  from  TCollection(Vertex  from  BRepMesh);
 
-       class IndexedMapOfVertex instantiates IndexedMap from TCollection 
-           (Vertex from  BRepMesh,  VertexHasher from  BRepMesh);
+      class IndexedMapOfVertex instantiates IndexedMap from TCollection 
+          (Vertex from  BRepMesh,  VertexHasher from  BRepMesh);
 
 
-       class DataMapOfShapeReal instantiates DataMap from TCollection
-                                             (Shape          from TopoDS,
-                                              Real           from Standard,
-                                              ShapeMapHasher from TopTools);
+      class DataMapOfShapeReal instantiates DataMap from TCollection
+                                            (Shape          from TopoDS,
+                                             Real           from Standard,
+                                             ShapeMapHasher from TopTools);
 
-       class BiPoint;
-       
-       class Array1OfBiPoint    instantiates Array1  from TCollection
-                                             (BiPoint from BRepMesh);
+      class BiPoint;
+  
+      class Array1OfBiPoint    instantiates Array1  from TCollection(BiPoint from BRepMesh);
 
-       class FastDiscret;
-       
-       class FaceAttribute;
-       
-       class DataMapOfFaceAttribute instantiates DataMap from TCollection
-                                             (Face           from TopoDS,
-                                              FaceAttribute  from BRepMesh,
-                                              ShapeMapHasher from TopTools);
+      private class FastDiscretFace;
+      
+      class FastDiscret;
+      
+      class FaceAttribute;
+  
+      class DataMapOfFaceAttribute instantiates DataMap from TCollection
+                                            (Face           from TopoDS,
+                                             FaceAttribute  from BRepMesh,
+                                             ShapeMapHasher from TopTools);
+              
+      private class Classifier;
+      imported ClassifierPtr; -- smart pointer on Classifier
 
-        private class FastDiscretFace;
-                                           
-       private class Classifier;
-       imported ClassifierPtr; -- smart pointer on Classifier
+      class IncrementalMesh from BRepMesh;
+      ---Purpose: meshes faces from a Shape only if necessary.
 
-       class IncrementalMesh from BRepMesh;
-       ---Purpose: meshes faces from a Shape only if necessary.
+         ---- classes moved from MeshShape
+      class GeomTool;
 
-        ---- classes moved from MeshShape
-       class GeomTool;
+      class DataMapOfIntegerPnt instantiates
+          DataMap from TCollection   (Integer          from Standard,
+                                      Pnt              from gp,
+                                      MapIntegerHasher from TColStd);
 
-       class DataMapOfIntegerPnt instantiates
-           DataMap from TCollection   (Integer          from Standard,
-                                       Pnt              from gp,
-                                       MapIntegerHasher from TColStd);
+      class PairOfPolygon;
 
-       class PairOfPolygon;
+      class DataMapOfShapePairOfPolygon instantiates 
+      DataMap from TCollection(Shape          from TopoDS,
+                               PairOfPolygon  from BRepMesh,
+                               ShapeMapHasher from TopTools);
 
-        class DataMapOfShapePairOfPolygon instantiates 
-           DataMap from TCollection(Shape          from TopoDS,
-                                    PairOfPolygon  from BRepMesh,
-                                    ShapeMapHasher from TopTools);
+      Mesh(S: Shape from TopoDS; d: Real from Standard);
+      ---Purpose: call to incremental mesh.
 
-       Mesh(S: Shape from TopoDS; d: Real from Standard);
-       ---Purpose: call to incremental mesh.
-
-       
+  
 end BRepMesh;
index 9340ea7..5179a0e 100755 (executable)
--- File:       BRepMesh_FastDiscret.cdl
--- Created:    Tue Feb 27 14:21:35 1996
--- Author:     Laurent PAINNOT
---             <lpa@nonox>
----Copyright:   Matra Datavision 1996
+-- File:        BRepMesh_FastDiscret.cdl
+-- Created:     Tue Feb 27 14:21:35 1996
+-- Author:      Laurent PAINNOT
+--              <lpa@nonox>
+---Copyright:    Matra Datavision 1996
 
 
 class FastDiscret from BRepMesh inherits TShared from MMgt
 
-       ---Purpose: Algorithm  to mesh  a shape  with  respect of  the
-       --          frontier the deflection  and by option the  shared
-       --          components.
+        ---Purpose: Algorithm  to mesh  a shape  with  respect of  the
+        --          frontier the deflection  and by option the  shared
+        --          components.
 
 
 uses    Boolean                   from Standard,
-       Integer                   from Standard,
-       Box                       from Bnd,
-       Real                      from Standard,
-       Shape                     from TopoDS,
-       Face                      from TopoDS,
-       Edge                      from TopoDS,
-       FaceAttribute             from BRepMesh,
-       Vertex                    from TopoDS,
-       Triangle                  from BRepMesh,
-       Vertex                    from BRepMesh,
-       Edge                      from BRepMesh,
-       ListOfInteger             from TColStd,
-       MapOfInteger              from TColStd,
-       SequenceOfInteger         from TColStd,
-       ListOfReal                from TColStd,
-       IndexedMapOfInteger       from TColStd,
-       SequenceOfPnt2d           from TColgp,
-       Dir                       from gp,
-       Pnt                       from gp,
+        Integer                   from Standard,
+        Box                       from Bnd,
+        Real                      from Standard,
+        Shape                     from TopoDS,
+        Face                      from TopoDS,
+        Edge                      from TopoDS,
+        FaceAttribute             from BRepMesh,
+        Vertex                    from TopoDS,
+        Triangle                  from BRepMesh,
+        Vertex                    from BRepMesh,
+        Edge                      from BRepMesh,
+        ListOfInteger             from TColStd,
+        MapOfInteger              from TColStd,
+        SequenceOfInteger         from TColStd,
+        ListOfReal                from TColStd,
+        IndexedMapOfInteger       from TColStd,
+        SequenceOfPnt2d           from TColgp,
+        Dir                       from gp,
+        Pnt                       from gp,
         XY                        from gp,
-       Pnt2d                     from gp,
-       DataMapOfIntegerPnt       from BRepMesh,
-       DataMapOfIntegerListOfXY  from BRepMesh,
-       DataMapOfShapePairOfPolygon from  BRepMesh,
-       Delaun                    from BRepMesh,
-       DataMapOfVertexInteger    from BRepMesh,
-       DataStructureOfDelaun     from BRepMesh,
-       ListOfVertex              from BRepMesh,
-       MapOfShape                from TopTools,
-       HSurface                  from BRepAdaptor,
-       ClassifierPtr             from BRepMesh,        
+        Pnt2d                     from gp,
+        DataMapOfIntegerPnt       from BRepMesh,
+        DataMapOfIntegerListOfXY  from BRepMesh,
+        DataMapOfShapePairOfPolygon from  BRepMesh,
+        Delaun                    from BRepMesh,
+        DataMapOfVertexInteger    from BRepMesh,
+        DataStructureOfDelaun     from BRepMesh,
+        ListOfVertex              from BRepMesh,
+        MapOfShape                from TopTools,
+        HSurface                  from BRepAdaptor,
+        ClassifierPtr             from BRepMesh,
         IndexedMapOfReal          from TColStd,
-       Status                    from BRepMesh,
-       DataMapOfShapeReal        from TopTools,
-       ListOfShape               from TopTools,
-       Curve                     from Geom2d,
-       MapOfInteger              from MeshDS,
-       BaseAllocator             from MeshDS,
-       DataMapOfFaceAttribute    from BRepMesh 
-       
+        Status                    from BRepMesh,
+        DataMapOfShapeReal        from TopTools,
+        ListOfShape               from TopTools,
+        Curve                     from Geom2d,
+        MapOfInteger              from MeshDS,
+        BaseAllocator             from MeshDS,
+        DataMapOfFaceAttribute    from BRepMesh
+
+
+is
+
+        Create (defle     : Real    from Standard;
+                angle     : Real    from Standard;
+                B         : Box     from Bnd;
+                withShare : Boolean from Standard=Standard_True;
+                inshape   : Boolean from Standard=Standard_False;
+                relative  : Boolean from Standard=Standard_False;
+                shapetrigu: Boolean from Standard=Standard_False)
+          returns mutable FastDiscret from BRepMesh;
 
-is 
 
         Create (defle     : Real    from Standard;
-               angle     : Real    from Standard;
-               B         : Box     from Bnd;
-               withShare : Boolean from Standard=Standard_True;
-               inshape   : Boolean from Standard=Standard_False;
-               relative  : Boolean from Standard=Standard_False;
-               shapetrigu: Boolean from Standard=Standard_False)
-           returns mutable FastDiscret from BRepMesh;
-
-
-       Create (defle     : Real    from Standard;
-               shape     : Shape   from TopoDS;
-               B         : Box     from Bnd;
-               angle     : Real    from Standard;
-               withShare : Boolean from Standard=Standard_True;
-               inshape   : Boolean from Standard=Standard_False;
-               relative  : Boolean from Standard=Standard_False;
-               shapetrigu: Boolean from Standard=Standard_False)
-          ---Purpose: if the  boolean    <relative>   is  True,    the
-          --          deflection used   for the polygonalisation   of
-          --          each edge will be <defle> * Size of Edge.
-          --          the deflection used for the faces will be the maximum
-          --          deflection of their edges.
-          --          
-          --          if <shapetrigu> is True, the triangulation, if exists
-          --          with a correct deflection, can be used to re-triangulate 
-          --          the shape.
-          --          
-          --          if   <inshape>   is   True, the      calculated
-          --          triangulation will be stored in the shape.
-           returns mutable FastDiscret from BRepMesh;
-
-
-       Perform (me: mutable; shape: Shape from TopoDS) is static;
-       ---Purpose: Build triangulation on the whole shape
-
-       Add (me: mutable; face: Face from TopoDS) is static;
-       ---Purpose: Record a face for further processing.
-
-       Process (me; face: Face from TopoDS) is static;
-       ---Purpose: Triangulate a face previously recorded for
-       --          processing by call to Add(). Can be executed in
-       --          parallel threads.
-       ---C++: alias operator ()
-
-       InternalVerticesMode(me: mutable) returns Boolean from Standard;
-       ---Purpose: Returns mode defining if internal vertices on faces 
-       -- are taken into consideration or not. If this mode is equal to true
-       -- that internal vertices on faces are considered during triangulation.
-       -- Default value is equal to false (old behaviour).
-       ---C++: return &
-        ---C++: inline
-
-       CurrentFaceStatus(me)
-       returns Status from BRepMesh;
-
-       Add (me     : mutable;
-            edge   : Edge     from TopoDS;
-            face   : Face     from TopoDS;
-            S      : HSurface from BRepAdaptor;
-            C      : Curve    from Geom2d;
-            defedge: Real     from Standard;
+                shape     : Shape   from TopoDS;
+                B         : Box     from Bnd;
+                angle     : Real    from Standard;
+                withShare : Boolean from Standard=Standard_True;
+                inshape   : Boolean from Standard=Standard_False;
+                relative  : Boolean from Standard=Standard_False;
+                shapetrigu: Boolean from Standard=Standard_False)
+           ---Purpose: if the  boolean    <relative>   is  True,    the
+           --          deflection used   for the polygonalisation   of
+           --          each edge will be <defle> * Size of Edge.
+           --          the deflection used for the faces will be the maximum
+           --          deflection of their edges.
+           --          
+           --          if <shapetrigu> is True, the triangulation, if exists
+           --          with a correct deflection, can be used to re-triangulate 
+           --          the shape.
+           --          
+           --          if   <inshape>   is   True, the      calculated
+           --          triangulation will be stored in the shape.
+            returns mutable FastDiscret from BRepMesh;
+
+
+        Perform (me: mutable; shape: Shape from TopoDS) is static;
+        ---Purpose: Build triangulation on the whole shape
+
+        Add (me: mutable; face: Face from TopoDS) is static;
+        ---Purpose: Record a face for further processing.
+
+        Process (me; face: Face from TopoDS) is static;
+        ---Purpose: Triangulate a face previously recorded for
+            --          processing by call to Add(). Can be executed in
+            --          parallel threads.
+        ---C++: alias operator ()
+
+        CurrentFaceStatus(me)
+        returns Status from BRepMesh;
+
+        Add (me     : mutable;
+             edge   : Edge     from TopoDS;
+             face   : Face     from TopoDS;
+             S      : HSurface from BRepAdaptor;
+             C      : Curve    from Geom2d;
+             defedge: Real     from Standard;
              first  : Real     from Standard;
              last   : Real     from Standard)
-       is static private;
-       
-       Add (me     : mutable;
+        is static private;
+
+        Add (me     : mutable;
              theVert: Vertex   from TopoDS;
-            face   : Face     from TopoDS;
-            S      : HSurface from BRepAdaptor) is private;
+             face   : Face     from TopoDS;
+             S      : HSurface from BRepAdaptor) is private;
 
-       Update (me: mutable; 
-               Edge:    Edge     from TopoDS; 
-               Face:    Face     from TopoDS; 
+        Update (me: mutable; 
+                Edge   : Edge     from TopoDS; 
+                Face   : Face     from TopoDS; 
                 C      : Curve    from Geom2d;
-               defedge: Real     from Standard;
-               first  : Real     from Standard;
-                last   : Real     from Standard)
-                
-       returns Boolean is private;
-       
-
-       InternalVertices
-              (me         : mutable;
-               caro       : HSurface            from BRepAdaptor;
-               inter      : in out ListOfVertex from BRepMesh;
-               defedge    : Real                from Standard;
-               classifier : ClassifierPtr       from BRepMesh)
-       is static private;
-
-
-       Control
-              (me      : mutable;
-               caro    : HSurface                from BRepAdaptor;
-               defface : Real                    from Standard;
-               inter   : in out ListOfVertex     from BRepMesh;
-               badTri  : in out ListOfInteger    from TColStd;
-               nulTri  : in out ListOfInteger    from TColStd;
-               trigu   : in out Delaun           from BRepMesh;
-               isfirst : Boolean                 from Standard)
-       returns Real from Standard is static private;
-
-
-       FindUV(me: mutable; V:  Vertex  from TopoDS; 
-                           XY: Pnt2d   from gp;
-                           ip: Integer from Standard; 
-                            S : HSurface from BRepAdaptor; 
-                            mindist:  Real  from  Standard)
-       returns XY from gp is private;
-
-       AddInShape(me: mutable; face   : Face                          from TopoDS;
-                               defedge: Real                          from Standard)
-       is static private;
+                defedge: Real     from Standard;
+                first  : Real     from Standard;
+                last   : Real     from Standard)     
+        returns Boolean is private;
+
+
+        InternalVertices
+               (me         : mutable;
+               caro       : HSurface            from BRepAdaptor;
+               inter      : in out ListOfVertex from BRepMesh;
+               defedge    : Real                from Standard;
+               classifier : ClassifierPtr       from BRepMesh)
+        is static private;
+
+
+        Control (me      : mutable;
+                 caro    : HSurface                from BRepAdaptor;
+                 defface : Real                    from Standard;
+                 inter   : in out ListOfVertex     from BRepMesh;
+                 badTri  : in out ListOfInteger    from TColStd;
+                 nulTri  : in out ListOfInteger    from TColStd;
+                 trigu   : in out Delaun           from BRepMesh;
+                 isfirst : Boolean                 from Standard)
+          returns Real from Standard is static private;
+
+        AddInShape(me: mutable;
+                   face   : Face from TopoDS;
+                   defedge: Real from Standard)
+        is static private;
 
 
 -- Output :
 
 
-       NbTriangles(me)
-           ---Purpose: Gives the number of built triangles.
-           returns Integer from Standard
-           is static;
+        NbTriangles(me)
+            ---Purpose: Gives the number of built triangles.
+            returns Integer from Standard
+            is static;
+
+        Triangle   (me;
+                    Index : Integer from Standard)
+            ---Purpose: Gives the triangle of <Index>.
+            ---C++: return const &
+            returns Triangle from BRepMesh
+            is static;
+
 
-       Triangle   (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the triangle of <Index>.
-           ---C++: return const &
-           returns Triangle from BRepMesh
-           is static;
+        NbEdges    (me)
+            ---Purpose: Gives the number of built Edges
+            returns Integer from Standard
+            is static;
 
+        Edge       (me;
+                    Index : Integer from Standard)
+            ---Purpose: Gives the edge of index <Index>.
+            ---C++: return const &
+              returns Edge from BRepMesh
+            is static;
 
-       NbEdges    (me)
-           ---Purpose: Gives the number of built Edges
-           returns Integer from Standard
-           is static;
+        NbVertices (me)
+            ---Purpose: Gives the number of built Vertices.
+            returns Integer from Standard
+            is static;
 
-       Edge       (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the edge of index <Index>.
-           ---C++: return const &
-           returns Edge from BRepMesh
-           is static;
+        Vertex     (me;
+                    Index : Integer from Standard)
+            ---Purpose: Gives the vertex of <Index>.
+            ---C++: return const &
+            returns Vertex from BRepMesh
+            is static;
 
+        Pnt        (me;
+                    Index : Integer from Standard)
+            ---Purpose: Gives the location3d of the vertex of <Index>.
+            ---C++: return const &
+            returns Pnt from gp
+            is static;
 
-       NbVertices (me)
-           ---Purpose: Gives the number of built Vertices.
-           returns Integer from Standard
-           is static;
+        VerticesOfDomain
+                 (me; Indices : in out MapOfInteger from MeshDS)
+            ---Purpose: Gives the list of indices of the vertices
+            is static;
 
-       Vertex     (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the vertex of <Index>.
-           ---C++: return const &
-           returns Vertex from BRepMesh
-           is static;
 
-       Pnt        (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the location3d of the vertex of <Index>.
-           ---C++: return const &
-           returns Pnt from gp
-           is static;
+        EdgesOfDomain
+                 (me; Indices : in out MapOfInteger from MeshDS)
+            ---Purpose: Gives the list of indices of the edges
+            ---C++: inline
+            is static;
 
-       VerticesOfDomain
-                  (me; Indices : in out MapOfInteger from MeshDS)
-           ---Purpose: Gives the list of indices of the vertices
-           is static;
 
+        TrianglesOfDomain(me; Indices: in out MapOfInteger from MeshDS)
+            ---Purpose: Gives the list of indices of the triangles
+            ---C++: inline
+            is static;
 
-       EdgesOfDomain
-                  (me; Indices : in out MapOfInteger from MeshDS)
-           ---Purpose: Gives the list of indices of the edges
-           ---C++: inline
-           is static;
 
+        NbPoint3d (me)
+            ---Purpose: Gives the  number of different  location in 3d
+            --          space.  It  is  different    of the number  of
+            --          vertices if there is more than one surface.
+            --          Even for one surface, the number can be different
+            --          if an edge is shared.
+            ---C++: inline
+            returns Integer from Standard
+            is static;
 
-       TrianglesOfDomain(me; Indices: in out MapOfInteger from MeshDS)
-           ---Purpose: Gives the list of indices of the triangles
-           ---C++: inline
+        Point3d    (me;
+                    Index : Integer from Standard)
+            ---Purpose: Gives the 3d space location of the vertex <Index>.
+            ---C++: return const &
+            ---C++: inline
+            returns Pnt from gp
             is static;
-       
-
-       NbPoint3d (me)
-           ---Purpose: Gives the  number of different  location in 3d
-           --          space.  It  is  different    of the number  of
-           --          vertices if there is more than one surface.
-           --          Even for one surface, the number can be different
-           --          if an edge is shared.
-           ---C++: inline
-           returns Integer from Standard
-           is static;
-
-       Point3d    (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the 3d space location of the vertex <Index>.
-           ---C++: return const &
-           ---C++: inline
-           returns Pnt from gp
-           is static;
-
-
-       GetDeflection(me)
-           ---Purpose: returns the deflection value.
-           ---C++: inline
-       returns Real from Standard;
-       
-       GetAngle(me)
-           ---Purpose: returns the deflection value.
-           ---C++: inline
-       returns Real from Standard;
-       
-       WithShare(me)
-           ---C++: inline
-       returns Boolean from Standard;
-       
-       InShape(me)
-           ---C++: inline
-       returns Boolean from Standard;
-       
+
+
+        GetDeflection(me)
+            ---Purpose: returns the deflection value.
+            ---C++: inline
+            returns Real from Standard;
+
+        GetAngle(me)  
+            ---Purpose: returns the deflection value.
+            ---C++: inline
+            returns Real from Standard;
+
+        WithShare(me)
+            ---C++: inline
+            returns Boolean from Standard;
+    
+        InShape(me)
+            ---C++: inline
+            returns Boolean from Standard;
+    
         ShapeTrigu(me)
-           ---C++: inline
-        returns Boolean from Standard;
-       
-       GetFaceAttribute(me;
-                   face    : Face from TopoDS;
-                   fattrib : in out FaceAttribute from BRepMesh)
-           ---Purpose: returns the face deflection value.
-       returns Boolean from Standard;
-       
-       RemoveFaceAttribute(me   : mutable;
-                           face : Face     from TopoDS);
-           ---Purpose: remove face attribute as useless to free locate memory
-       
+            ---C++: inline
+            returns Boolean from Standard;
+    
+        GetFaceAttribute(me;
+                         face    : Face from TopoDS;
+                         fattrib : in out FaceAttribute from BRepMesh)
+            ---Purpose: returns the face deflection value.
+            returns Boolean from Standard;
+    
+        RemoveFaceAttribute(me   : mutable;
+                            face : Face     from TopoDS);
+            ---Purpose: remove face attribute as useless to free locate memory
+    
         GetMapOfDefEdge(me)
-          ---C++: return const &
-          ---C++: inline
-          returns DataMapOfShapeReal from TopTools;
-               
+            ---C++: return const &
+            ---C++: inline
+            returns DataMapOfShapeReal from TopTools;
+    
 fields  
-       myangle      : Real                          from Standard;
-       mydeflection : Real                          from Standard;
-       mydtotale    : Real                          from Standard;
-       myWithShare  : Boolean                       from Standard;
-       vertices     : DataMapOfVertexInteger        from BRepMesh;
-       edges        : DataMapOfShapePairOfPolygon   from BRepMesh;
-       internaledges: DataMapOfShapePairOfPolygon   from BRepMesh;
-       nbLocat      : Integer                       from Standard;
-       Location3d   : DataMapOfIntegerPnt           from BRepMesh;
-       structure    : DataStructureOfDelaun         from BRepMesh;
-       mapattrib    : DataMapOfFaceAttribute        from BRepMesh;
-       myvemap      : IndexedMapOfInteger           from TColStd;
-       mylocation2d : DataMapOfIntegerListOfXY      from BRepMesh;
-       myrelative   : Boolean                       from Standard;
-       myshapetrigu : Boolean                       from Standard;
-       myinshape    : Boolean                       from Standard;
-       myInternalVerticesMode : Boolean             from Standard; --mode to accounting internal vertices 
-       myfacestate  : Status                        from BRepMesh;
-        mapdefle     : DataMapOfShapeReal            from TopTools;
-       mynottriangulated : ListOfShape              from TopTools;
-       myAllocator  : BaseAllocator                 from MeshDS;
+      myAngle        : Real                          from Standard;
+      myDeflection   : Real                          from Standard;
+      myDtotale      : Real                          from Standard;
+      myWithShare    : Boolean                       from Standard;
+      myVertices     : DataMapOfVertexInteger        from BRepMesh;
+      myEdges        : DataMapOfShapePairOfPolygon   from BRepMesh;
+      myInternaledges: DataMapOfShapePairOfPolygon   from BRepMesh;
+      myNbLocat      : Integer                       from Standard;
+      myLocation3d   : DataMapOfIntegerPnt           from BRepMesh;
+      myStructure    : DataStructureOfDelaun         from BRepMesh;
+      myMapattrib    : DataMapOfFaceAttribute        from BRepMesh;
+      myVemap        : IndexedMapOfInteger           from TColStd;
+      myLocation2d   : DataMapOfIntegerListOfXY      from BRepMesh;
+      myRelative     : Boolean                       from Standard;
+      myShapetrigu   : Boolean                       from Standard;
+      myInshape      : Boolean                       from Standard; 
+      myFacestate    : Status                        from BRepMesh;
+      myMapdefle     : DataMapOfShapeReal            from TopTools;
+      myNottriangulated : ListOfShape                from TopTools;
+      myAllocator    : BaseAllocator                 from MeshDS;
+
 end FastDiscret;
index f75c47d..3e0f503 100755 (executable)
@@ -1,6 +1,6 @@
-// File:       BRepMesh_FastDiscret.cxx
-// Created:    Tue Feb 27 16:39:53 1996
-// Author:     Ekaterina SMIRNOVA
+// File:        BRepMesh_FastDiscret.cxx
+// Created:     Tue Feb 27 16:39:53 1996
+// Author:      Ekaterina SMIRNOVA
 // Copyright: Open CASCADE SAS 2008
 
 #include <BRepMesh_FastDiscret.ixx>
@@ -112,27 +112,27 @@ inline Standard_Real MaxFaceTol (const TopoDS_Face& theFace)
 //function : BRepMesh_FastDiscret
 //purpose  : 
 //=======================================================================
-BRepMesh_FastDiscret::BRepMesh_FastDiscret(const Standard_Real    defle,
-                                           const Standard_Real    angl,
-                                           const Bnd_Box&         Box,
-                                           const Standard_Boolean ws,
-                                           const Standard_Boolean inshape,
-                                           const Standard_Boolean relative,
-                                           const Standard_Boolean shapetrigu): 
-  myangle(angl), mydeflection(defle),myWithShare(ws), nbLocat(0), 
-  myrelative(relative), myshapetrigu(shapetrigu), myinshape(inshape),
-  myInternalVerticesMode(Standard_True)
+BRepMesh_FastDiscret::BRepMesh_FastDiscret(const Standard_Real    theDefle,
+                                           const Standard_Real    theAngl,
+                                           const Bnd_Box&         theBox,
+                                           const Standard_Boolean theWithShare,
+                                           const Standard_Boolean theInshape,
+                                           const Standard_Boolean theRelative,
+                                           const Standard_Boolean theShapetrigu) :
+  myAngle(theAngl), myDeflection(theDefle),myWithShare(theWithShare),
+  myNbLocat(0), myRelative(theRelative), myShapetrigu(theShapetrigu), 
+  myInshape(theInshape)
 {
   myAllocator = new NCollection_IncAllocator(64000);
-  if (relative)
+  if (theRelative)
   {
     Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
-    Box.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
-    mydtotale = TXmax-TXmin;
+    theBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
+    myDtotale = TXmax-TXmin;
     const Standard_Real dy = TYmax-TYmin;
     const Standard_Real dz = TZmax-TZmin;
-    if (dy > mydtotale) mydtotale = dy;
-    if (dz > mydtotale) mydtotale = dz;
+    if (dy > myDtotale) myDtotale = dy;
+    if (dz > myDtotale) myDtotale = dz;
   }
 }
 
@@ -141,30 +141,30 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(const Standard_Real    defle,
 //purpose  : 
 //=======================================================================
 
-BRepMesh_FastDiscret::BRepMesh_FastDiscret(const Standard_Real    defle,
-                                           const TopoDS_Shape&    shape,
-                                           const Bnd_Box&         Box,
-                                           const Standard_Real    angl,
-                                           const Standard_Boolean ws,
-                                           const Standard_Boolean inshape,
-                                           const Standard_Boolean relative,
-                                           const Standard_Boolean shapetrigu): 
- myangle(angl), mydeflection(defle),myWithShare(ws), nbLocat(0), 
myrelative(relative), myshapetrigu(shapetrigu), myinshape(inshape),
myInternalVerticesMode(Standard_True)
+BRepMesh_FastDiscret::BRepMesh_FastDiscret(const Standard_Real    theDefle,
+                                           const TopoDS_Shape&    theShape,
+                                           const Bnd_Box&         theBox,
+                                           const Standard_Real    theAngl,
+                                           const Standard_Boolean theWithShare,
+                                           const Standard_Boolean theInshape,
+                                           const Standard_Boolean theRelative,
+                                           const Standard_Boolean theShapetrigu): 
+  myAngle(theAngl), myDeflection(theDefle),myWithShare(theWithShare),
 myNbLocat(0), myRelative(theRelative), myShapetrigu(theShapetrigu),
 myInshape(theInshape)
 {
   myAllocator = new NCollection_IncAllocator(64000);
-  if (relative)
+  if (theRelative)
   {
     Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
-    Box.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
-    mydtotale = TXmax-TXmin;
+    theBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
+    myDtotale = TXmax-TXmin;
     const Standard_Real dy = TYmax-TYmin;
     const Standard_Real dz = TZmax-TZmin;
-    if (dy > mydtotale) mydtotale = dy;
-    if (dz > mydtotale) mydtotale = dz;
+    if (dy > myDtotale) myDtotale = dy;
+    if (dz > myDtotale) myDtotale = dz;
   }
-  Perform(shape);
+  Perform(theShape);
 }
 
 //=======================================================================
@@ -172,10 +172,10 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(const Standard_Real    defle,
 //purpose  : 
 //=======================================================================
 
-void BRepMesh_FastDiscret::Perform(const TopoDS_Shape& shape)
+void BRepMesh_FastDiscret::Perform(const TopoDS_Shape& theShape)
 {
   std::vector<TopoDS_Face> aFaces;
-  for (TopExp_Explorer ex(shape, TopAbs_FACE); ex.More(); ex.Next()) {
+  for (TopExp_Explorer ex(theShape, TopAbs_FACE); ex.More(); ex.Next()) {
     TopoDS_Face aF = TopoDS::Face(ex.Current());
     Add(aF);
     aFaces.push_back(aF);
@@ -203,7 +203,7 @@ void BRepMesh_FastDiscret::Process(const TopoDS_Face& theFace) const
   Handle(BRepMesh_FaceAttribute) fattribute;
   if ( GetFaceAttribute (theFace, fattribute) ) 
   {
-    BRepMesh_FastDiscretFace aTool (GetAngle(), WithShare(), InShape(), ShapeTrigu());
+    BRepMesh_FastDiscretFace aTool (GetAngle(), WithShare());
     aTool.Add (theFace, fattribute, GetMapOfDefEdge());
   }
   //cout << "END   face " << theFace.TShape().operator->() << endl << flush;
@@ -216,8 +216,8 @@ void BRepMesh_FastDiscret::Process(const TopoDS_Face& theFace) const
 
 #define MESH_FAILURE(theface)        \
 {                                    \
-  myfacestate = BRepMesh_Failure;    \
-  mynottriangulated.Append(theface); \
+  myFacestate = BRepMesh_Failure;    \
+  myNottriangulated.Append(theface); \
   return;                            \
 }
 
@@ -231,10 +231,10 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
   TopoDS_Face face = theface;
   BRepTools::Update(face);
   face.Orientation(TopAbs_FORWARD);
-  structure.Nullify();
+  myStructure.Nullify();
   Handle(NCollection_IncAllocator) anAlloc = Handle(NCollection_IncAllocator)::DownCast(myAllocator);
   anAlloc->Reset(Standard_False);  
-  structure=new BRepMesh_DataStructureOfDelaun(anAlloc);
+  myStructure=new BRepMesh_DataStructureOfDelaun(anAlloc);
   BRepAdaptor_Surface  BS(face, Standard_False);
   Handle(BRepAdaptor_HSurface) gFace = new BRepAdaptor_HSurface(BS);
   
@@ -248,13 +248,13 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
   TopLoc_Location loc;
 
   if (!myWithShare) {          
-    vertices.Clear();
-    edges.Clear();
+    myVertices.Clear();
+    myEdges.Clear();
   }
 
-  myvemap.Clear();
-  mylocation2d.Clear();
-  internaledges.Clear();
+  myVemap.Clear();
+  myLocation2d.Clear();
+  myInternaledges.Clear();
 
   Standard_Integer i;
   i = 1;
@@ -262,12 +262,12 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
   Standard_Real defedge, defface;
   Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, dx, dy, dz;
   Standard_Integer nbEdge = 0;
-  Standard_Real savangle = myangle;
+  Standard_Real savangle = myAngle;
   Standard_Real cdef;
   Standard_Real maxdef = 2.* MaxFaceTol(theface);
   defface = 0.;
 
-  if (!myrelative) defface = Max(mydeflection, maxdef);
+  if (!myRelative) defface = Max(myDeflection, maxdef);
 
   TColStd_SequenceOfReal aFSeq, aLSeq;
   TColGeom2d_SequenceOfCurve aCSeq;
@@ -283,13 +283,13 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
     for(; ex.More(); ex.Next()) {
       const TopoDS_Edge& edge = TopoDS::Edge(ex.Value());
       nbEdge++;
-      if (!mapdefle.IsBound(edge)) {
-        if (myrelative) {
-          if (edges.IsBound(edge)) {
-           const BRepMesh_PairOfPolygon& pair = edges.Find(edge);
-           const Handle(Poly_PolygonOnTriangulation)& P = pair.First();
-           defedge = P->Deflection();
-         }
+      if (!myMapdefle.IsBound(edge)) {
+        if (myRelative) {
+          if (myEdges.IsBound(edge)) {
+            const BRepMesh_PairOfPolygon& pair = myEdges.Find(edge);
+            const Handle(Poly_PolygonOnTriangulation)& P = pair.First();
+            defedge = P->Deflection();
+          }
           else {
             Bnd_Box B;
             BRepBndLib::Add(edge, B);
@@ -301,24 +301,24 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
             if (defedge < dy) defedge = dy;
             if (defedge < dz) defedge = dz;
             // adjusted in relation to the total size:
-            cdef = mydtotale/(2*defedge);
+            cdef = myDtotale/(2*defedge);
             if (cdef < 0.5) cdef = 0.5;
             if (cdef > 2.) cdef = 2.;
-            defedge = cdef * defedge * mydeflection;
-            myangle = savangle * cdef;
+            defedge = cdef * defedge * myDeflection;
+            myAngle = savangle * cdef;
           }
           defface = defface + defedge;
-         defface = Max(maxdef, defface);
+          defface = Max(maxdef, defface);
         }
-        else defedge = mydeflection;
+        else defedge = myDeflection;
     
         defedge = Max(maxdef, defedge);
         defedge = Max(1.e-05 , defedge);
-        mapdefle.Bind(edge, defedge);
+        myMapdefle.Bind(edge, defedge);
       }
       else{
-        defedge = mapdefle(edge);
-        if (myrelative) {defface = defface + defedge; defface = Max(maxdef, defface);}
+        defedge = myMapdefle(edge);
+        if (myRelative) {defface = defface + defedge; defface = Max(maxdef, defface);}
       }
       Standard_Real f1,l1;
       Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(edge, face, f1, l1);
@@ -329,23 +329,23 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
       aCSeq.Append(C);
       aShSeq.Append(edge);
       Add(edge, face, gFace, C, defedge, f1, l1);
-      myangle = savangle;
+      myAngle = savangle;
     }
   }
 
-  if (nbEdge == 0 || myvemap.Extent() < 3)
+  if (nbEdge == 0 || myVemap.Extent() < 3)
   {
       MESH_FAILURE(theface);
   }
 
-  if (myrelative ) defface = defface / nbEdge;
-  else             defface = mydeflection;
+  if (myRelative ) defface = defface / nbEdge;
+  else             defface = myDeflection;
 
   if (myWithShare) defface = Max(maxdef, defface);
   
   T = BRep_Tool::Triangulation(face, loc);
 
-  if (!myshapetrigu || T.IsNull()) {
+  if (!myShapetrigu || T.IsNull()) {
     
     Standard_Real xCur, yCur;
     Standard_Real maxX, minX, maxY, minY;
@@ -354,8 +354,8 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
     
     Standard_Integer ipn = 0;
     Standard_Integer i1 =1;
-    for (i1 = 1; i1 <= myvemap.Extent(); i1++) {
-      const BRepMesh_Vertex& aV = structure->GetNode(myvemap.FindKey(i1));
+    for (i1 = 1; i1 <= myVemap.Extent(); i1++) {
+      const BRepMesh_Vertex& aV = myStructure->GetNode(myVemap.FindKey(i1));
       ipn++;
       xCur=aV.Coord().X();
       yCur=aV.Coord().Y();
@@ -418,38 +418,38 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
     
     Standard_Real deltaX = 1.0;
     Standard_Real deltaY = 1.0;
-    Standard_Integer nbVertices = myvemap.Extent();
+    Standard_Integer nbVertices = myVemap.Extent();
     const Standard_Real tolclass = Precision::PConfusion(); //0.03*Max(myumax-myumin, myvmax-myvmin);
     
     BRepMesh_ClassifierPtr classifier ( 
-      new BRepMesh_Classifier(face, tolclass,  internaledges, myvemap, 
-                              structure, myumin, myumax, myvmin, myvmax) );   
+      new BRepMesh_Classifier(face, tolclass,  myInternaledges, myVemap, 
+                              myStructure, myumin, myumax, myvmin, myvmax) );   
   
-    myfacestate = classifier->State();
-    if (myfacestate == BRepMesh_SelfIntersectingWire)
+    myFacestate = classifier->State();
+    if (myFacestate == BRepMesh_SelfIntersectingWire)
     {
       Standard_Integer nbmaill = 0;
       Standard_Real eps = Precision::Confusion();
-      while (nbmaill < 5 && myfacestate != BRepMesh_ReMesh)
+      while (nbmaill < 5 && myFacestate != BRepMesh_ReMesh)
       {
         nbmaill++;
         
         //clear the structure of links
-        structure.Nullify();
-        structure = new BRepMesh_DataStructureOfDelaun(anAlloc);
+        myStructure.Nullify();
+        myStructure = new BRepMesh_DataStructureOfDelaun(anAlloc);
         
-        myvemap.Clear();
-        mylocation2d.Clear();
-        internaledges.Clear();
+        myVemap.Clear();
+        myLocation2d.Clear();
+        myInternaledges.Clear();
 
         Standard_Integer j1;
         for(j1 = 1; j1 <= aShSeq.Length(); j1++)
         {
           const TopoDS_Edge& edge = TopoDS::Edge(aShSeq.Value(j1));
-          if (edges.IsBound(edge))
+          if (myEdges.IsBound(edge))
           {
-            edges.UnBind(edge);
-            internaledges.UnBind(edge);
+            myEdges.UnBind(edge);
+            myInternaledges.UnBind(edge);
           }
         }
         
@@ -457,45 +457,33 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
         for( j1 = 1; j1 <= aShSeq.Length(); j1++)
         {
           const TopoDS_Edge& edge = TopoDS::Edge(aShSeq.Value(j1));
-          defedge = mapdefle(edge) / 3.;
+          defedge = myMapdefle(edge) / 3.;
           defedge = Max(defedge, eps);
-          mapdefle.Bind(edge, defedge);
+          myMapdefle.Bind(edge, defedge);
           const Handle(Geom2d_Curve)& C = aCSeq.Value(j1);
           Add(edge, face, gFace, C, defedge, aFSeq.Value(j1), aLSeq.Value(j1));
         }
-         
+
         classifier.Nullify();
 
-        classifier = new BRepMesh_Classifier(face, tolclass, internaledges, myvemap,
-                                             structure, myumin, myumax, myvmin, myvmax);
+        classifier = new BRepMesh_Classifier(face, tolclass, myInternaledges, myVemap,
+                                             myStructure, myumin, myumax, myvmin, myvmax);
 
         if (classifier->State() == BRepMesh_NoError)
         {
-          myfacestate = BRepMesh_ReMesh;
-       }
-        nbVertices = myvemap.Extent();
+          myFacestate = BRepMesh_ReMesh;
+        }
+        nbVertices = myVemap.Extent();
       }
     }
     
-    if (myfacestate != BRepMesh_NoError && myfacestate != BRepMesh_ReMesh)
+    if (myFacestate != BRepMesh_NoError && myFacestate != BRepMesh_ReMesh)
     {
-      mynottriangulated.Append(face);
+      myNottriangulated.Append(face);
       classifier.Nullify();
       return;
     }
     
-    //??
-    //add internal vertices after self-intersection check
-    /*if(myInternalVerticesMode) {
-      for(TopExp_Explorer ex(face,TopAbs_VERTEX ,TopAbs_EDGE); ex.More(); ex.Next()) {
-        const TopoDS_Vertex& aVert = TopoDS::Vertex(ex.Current());
-        Add(aVert,face,gFace);
-      }
-      nbVertices = myvemap.Extent();
-    }*/
-    
-
-    
     // try to find the real length:
     // akm (bug OCC16) : We must calculate these measures in non-singular
     //     parts of face. Let's try to compute average value of three
@@ -539,7 +527,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
     // akm (bug OCC16) ^^^^^
     
     if (longu <= 1.e-16 || longv <= 1.e-16) {
-      //yes, it is seen!!!
+      //yes, it is seen!!
 #ifdef DEB_MESH_CHRONO
       chMaillEdges.Stop();
       MESH_CHRONO_TSTOP(thetype);
@@ -555,7 +543,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
       
       Dv = Max(1.0e0 - (defface/r),0.0e0) ;
       Standard_Real oldDv = 2.0 * ACos (Dv);
-      oldDv = Min(oldDv, myangle);
+      oldDv = Min(oldDv, myAngle);
       Dv  =  0.9*oldDv; //TWOTHIRD * oldDv;
       Dv = oldDv;
       
@@ -566,7 +554,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
       if (ru > 1.e-16) {
         Du = Max(1.0e0 - (defface/ru),0.0e0);
         Du  = (2.0 * ACos (Du));
-        Du = Min(Du, myangle);
+        Du = Min(Du, myAngle);
         Standard_Real aa = sqrt(Du*Du + oldDv*oldDv);
         if(aa < gp::Resolution())
           return; 
@@ -574,7 +562,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
         Du = Du * Min(oldDv, Du) / aa;
       }
       else Du = Dv;     
-       
+  
       Standard_Integer nbU = Max((Standard_Integer)((myumax-myumin)/Du), 2);
       nbU = Max(nbU, (Standard_Integer)(nbV*(myumax-myumin)*R/((myvmax-myvmin)*r)/5.));
       
@@ -603,7 +591,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
       deltaY = (myvmax-myvmin)/longv;
     }    
 
-    if(!mapattrib.IsBound(theface))
+    if(!myMapattrib.IsBound(theface))
     {
       Handle(BRepMesh_FaceAttribute) aFA = new BRepMesh_FaceAttribute();
       aFA->GetDefFace() = defface;
@@ -616,17 +604,17 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
       aFA->GetMinX() = minX;
       aFA->GetMinY() = minY;
       aFA->GetClassifier() = classifier;
-      mapattrib.Bind(theface, aFA);
+      myMapattrib.Bind(theface, aFA);
     }
 
-    //Standard_Integer nbVertices = myvemap.Extent();
+    //Standard_Integer nbVertices = myVemap.Extent();
     T = new Poly_Triangulation(nbVertices, 1, Standard_True);
     TColgp_Array1OfPnt&  Nodes = T->ChangeNodes();
     TColgp_Array1OfPnt2d& Nodes2d = T->ChangeUVNodes();
     
     Standard_Integer index;
     for (i = 1; i <= nbVertices; i++) {
-      index = myvemap.FindKey(i);
+      index = myVemap.FindKey(i);
       Nodes(i) = Pnt(index);
       Nodes2d(i).SetXY(Vertex(index).Coord());
     }
@@ -637,21 +625,21 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
       gp_Trsf tr = loc.Transformation();
       tr.Invert();
       for (i = Nodes.Lower(); i <= Nodes.Upper(); i++) 
-             Nodes(i).Transform(tr);
+        Nodes(i).Transform(tr);
     }
 
     BRep_Builder B;
     B.UpdateFace(face, T);
 
-    BRepMesh_DataMapIteratorOfDataMapOfShapePairOfPolygon It(internaledges);
+    BRepMesh_DataMapIteratorOfDataMapOfShapePairOfPolygon It(myInternaledges);
     for (; It.More(); It.Next()) {
       const BRepMesh_PairOfPolygon& pair = It.Value();
       const Handle(Poly_PolygonOnTriangulation)& NOD1 = pair.First();
       const Handle(Poly_PolygonOnTriangulation)& NOD2 = pair.Last();
       if ( NOD1 == NOD2 )
-       B.UpdateEdge(TopoDS::Edge(It.Key()), NOD1, T, loc);
+        B.UpdateEdge(TopoDS::Edge(It.Key()), NOD1, T, loc);
       else
-       B.UpdateEdge(TopoDS::Edge(It.Key()), NOD1, NOD2, T, loc);
+        B.UpdateEdge(TopoDS::Edge(It.Key()), NOD1, NOD2, T, loc);
     }
   }
 
@@ -662,7 +650,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
     MESH_FAILURE(theface);
   }
 #endif // DEB_MESH
-  structure.Nullify();
+  myStructure.Nullify();
 }
 
 
@@ -670,55 +658,55 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
 //function : Add
 //purpose  : 
 //=======================================================================
-void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge, 
-                          const TopoDS_Face&                  face, 
-                          const Handle(BRepAdaptor_HSurface)& gFace,
-                           const Handle(Geom2d_Curve)&         C2d,
-                          const Standard_Real                 defedge,
-                           const Standard_Real                 first,
-                           const Standard_Real                 last)
+void BRepMesh_FastDiscret::Add( const TopoDS_Edge&                  theEdge, 
+                                const TopoDS_Face&                  theFace, 
+                                const Handle(BRepAdaptor_HSurface)& theGFace,
+                                const Handle(Geom2d_Curve)&         theC2d,
+                                const Standard_Real                 theDefEdge,
+                                const Standard_Real                 theFirst,
+                                const Standard_Real                 theLast)
 {
-  const TopAbs_Orientation orEdge = edge.Orientation();
+  const TopAbs_Orientation orEdge = theEdge.Orientation();
   if (orEdge == TopAbs_EXTERNAL) return;
 
-  const Standard_Boolean isEdgeBound = edges.IsBound(edge);
+  const Standard_Boolean isEdgeBound = myEdges.IsBound(theEdge);
 
   if (!isEdgeBound)
   {
-    if (Update(edge, face, C2d, defedge, first, last))
+    if (Update(theEdge, theFace, theC2d, theDefEdge, theFirst, theLast))
     {
       return;
     }
   }
 
   TopoDS_Vertex pBegin, pEnd;
-  TopExp::Vertices(edge, pBegin, pEnd);
+  TopExp::Vertices(theEdge, pBegin, pEnd);
   if (pBegin.IsNull() || pEnd.IsNull())
   {
     return;
   }
 
   Standard_Real wFirst, wLast;
-  BRep_Tool::Range(edge, face, wFirst, wLast);
+  BRep_Tool::Range(theEdge, theFace, wFirst, wLast);
 
   gp_Pnt2d uvFirst, uvLast;
-  BRep_Tool::UVPoints(edge, face, uvFirst, uvLast);
+  BRep_Tool::UVPoints(theEdge, theFace, uvFirst, uvLast);
 
   const Standard_Boolean sameUV = uvFirst.IsEqual(uvLast, Precision::PConfusion());
 
   //Control vertexes tolerances
-  gp_Pnt pFirst = gFace->Value(uvFirst.X(), uvFirst.Y());
-  gp_Pnt pLast = gFace->Value(uvLast.X(), uvLast.Y());
+  gp_Pnt pFirst = theGFace->Value(uvFirst.X(), uvFirst.Y());
+  gp_Pnt pLast  = theGFace->Value(uvLast.X(), uvLast.Y());
 
   Standard_Real mindist = 10. * Max(pFirst.Distance(BRep_Tool::Pnt(pBegin)), 
-                                   pLast.Distance(BRep_Tool::Pnt(pEnd)));
+                                    pLast.Distance(BRep_Tool::Pnt(pEnd)));
 
   if(mindist < BRep_Tool::Tolerance(pBegin) ||
-     mindist < BRep_Tool::Tolerance(pEnd) ) mindist = defedge;
+     mindist < BRep_Tool::Tolerance(pEnd) ) mindist = theDefEdge;
 
   // control of degenerated non-coded edges.
 
-  Standard_Boolean degener = BRep_Tool::Degenerated(edge);
+  Standard_Boolean degener = BRep_Tool::Degenerated(theEdge);
 
   if (!degener)
   {
@@ -728,20 +716,20 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
       Standard_Real longueur = 0.0;
       Standard_Real du = (wLast-wFirst)/20;
       gp_Pnt P1, P2;
-      BRepAdaptor_Curve BC(edge);
+      BRepAdaptor_Curve BC(theEdge);
       BC.D0(wFirst, P1);
       Standard_Real tolV = BRep_Tool::Tolerance(pBegin);
       Standard_Real tolV2 = 1.2*tolV;
       for (Standard_Integer l = 1; l <= 20; l++) {
-       BC.D0(wFirst + l*du, P2);
-       longueur += P1.Distance(P2);
-       if (longueur > tolV2) break;
-       P1 = P2;
+        BC.D0(wFirst + l*du, P2);
+        longueur += P1.Distance(P2);
+        if (longueur > tolV2) break;
+        P1 = P2;
       }
 
       if (longueur < tolV2)
       {
-       degener = Standard_True;
+        degener = Standard_True;
       }
     }
   }
@@ -751,8 +739,8 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
   {
     // 1. is it really sameUV without being degenerated
     gp_Pnt2d uvF, uvL;
-    C2d->D0(first, uvF);
-    C2d->D0(last, uvL);
+    theC2d->D0(theFirst, uvF);
+    theC2d->D0(theLast, uvL);
     if (!uvFirst.IsEqual(uvF, Precision::PConfusion()))
     {
       uvFirst = uvF;
@@ -767,27 +755,27 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
 
   // Process first vertex
   Standard_Integer ipf;
-  if (vertices.IsBound(pBegin))
+  if (myVertices.IsBound(pBegin))
   {
-    ipf = vertices.Find(pBegin);
+    ipf = myVertices.Find(pBegin);
   }
   else
   {
-    if (sameUV && vertices.IsBound(pEnd))
+    if (sameUV && myVertices.IsBound(pEnd))
     {
-      ipf = vertices.Find(pEnd);
+      ipf = myVertices.Find(pEnd);
     }
     else
     {
-      nbLocat++;
-      ipf = nbLocat;
-      Location3d.Bind(ipf, BRep_Tool::Pnt(pBegin));
+      myNbLocat++;
+      ipf = myNbLocat;
+      myLocation3d.Bind(ipf, BRep_Tool::Pnt(pBegin));
     }
-    vertices.Bind(pBegin, ipf);
+    myVertices.Bind(pBegin, ipf);
   }
-  theUV = FindUV(pBegin, uvFirst, ipf, gFace, mindist);
+  theUV = BRepMesh_FastDiscretFace::FindUV(pBegin, uvFirst, ipf, theGFace, mindist, myLocation2d);
   BRepMesh_Vertex vf(theUV, ipf, MeshDS_Frontier);
-  Standard_Integer ivf = structure->AddNode(vf);
+  Standard_Integer ivf = myStructure->AddNode(vf);
 
   // Process last vertex
   Standard_Integer ipl;
@@ -797,9 +785,9 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
   }
   else
   {
-    if (vertices.IsBound(pEnd))
+    if (myVertices.IsBound(pEnd))
     {
-      ipl = vertices.Find(pEnd);
+      ipl = myVertices.Find(pEnd);
     }
     else
     {
@@ -809,23 +797,23 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
       }
       else
       {
-        nbLocat++;
-       ipl = nbLocat;
-        Location3d.Bind(ipl, BRep_Tool::Pnt(pEnd));
+        myNbLocat++;
+        ipl = myNbLocat;
+        myLocation3d.Bind(ipl, BRep_Tool::Pnt(pEnd));
       }
-      vertices.Bind(pEnd,ipl);
+      myVertices.Bind(pEnd,ipl);
     }
   }
-  theUV = FindUV(pEnd, uvLast, ipl, gFace, mindist);
+  theUV = BRepMesh_FastDiscretFace::FindUV(pEnd, uvLast, ipl, theGFace, mindist, myLocation2d);
   BRepMesh_Vertex vl(theUV, ipl, MeshDS_Frontier);
-  Standard_Integer ivl= structure->AddNode(vl);
+  Standard_Integer ivl= myStructure->AddNode(vl);
 
-  Standard_Integer isvf = myvemap.FindIndex(ivf);
-  if (isvf == 0) isvf = myvemap.Add(ivf);
-  Standard_Integer isvl = myvemap.FindIndex(ivl);
-  if (isvl == 0) isvl = myvemap.Add(ivl);
+  Standard_Integer isvf = myVemap.FindIndex(ivf);
+  if (isvf == 0) isvf = myVemap.Add(ivf);
+  Standard_Integer isvl = myVemap.FindIndex(ivl);
+  if (isvl == 0) isvl = myVemap.Add(ivl);
   
-  Standard_Real otherdefedge = 0.5*defedge;
+  Standard_Real otherdefedge = 0.5*theDefEdge;
   gp_Pnt2d uv;
   BRepMesh_Vertex v2;
   gp_Pnt   P3d;
@@ -858,43 +846,43 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
       if (orEdge == TopAbs_INTERNAL) otherdefedge *= 0.5;
       
       BRepAdaptor_Curve cons;
-      if (BRep_Tool::SameParameter(edge))
+      if (BRep_Tool::SameParameter(theEdge))
       {
-             cons.Initialize(edge);
+        cons.Initialize(theEdge);
       }
       else
       {
-             cons.Initialize(edge, face);
+        cons.Initialize(theEdge, theFace);
       }
 
       TopLoc_Location L;
       Standard_Integer nbpmin = 2;
       if (cons.GetType() == GeomAbs_Circle) nbpmin = 4; //OCC287
-      BRepMesh_GeomTool GT(cons, wFirst, wLast, 0.5*myangle, otherdefedge, nbpmin);
+      BRepMesh_GeomTool GT(cons, wFirst, wLast, 0.5*myAngle, otherdefedge, nbpmin);
 
       // PTv, chl/922/G9, Take into account internal vertices
-      // it is necessary for internal edges, which does not split other edges, by their vertex
-      TopoDS_Iterator exV(edge);
+      // it is necessary for internal edges, which do not split other edges, by their vertex
+      TopoDS_Iterator exV(theEdge);
       for ( ; exV.More(); exV.Next() )
       {
-             TopoDS_Vertex aIntV = TopoDS::Vertex(exV.Value());
-             if ( aIntV.Orientation() == TopAbs_INTERNAL )
+        TopoDS_Vertex aIntV = TopoDS::Vertex(exV.Value());
+        if ( aIntV.Orientation() == TopAbs_INTERNAL )
          GT.AddPoint(BRep_Tool::Pnt(aIntV),
-                     BRep_Tool::Parameter(aIntV, edge),
-                       Standard_True);
+                     BRep_Tool::Parameter(aIntV, theEdge),
+                     Standard_True);
       }
 
-      // Creation of polygons on triangulation:
+      // Creation des polygones sur triangulation:
       Standard_Real puv;
       Standard_Integer i;      
       Standard_Real aEdgeLen = 0., a2dEdgeLen = 0.;
       gp_Pnt P3dPrev;
       gp_Pnt2d uvPrev;
-      GT.Value(cons, gFace, 1, puv, P3dPrev, uvPrev);
+      GT.Value(cons, theGFace, 1, puv, P3dPrev, uvPrev);
       for (i = 2; i <= GT.NbPoints(); i++)
       {
         // Record 3d point
-             GT.Value(cons, gFace, i, puv, P3d, uv);
+             GT.Value(cons, theGFace, i, puv, P3d, uv);
         aEdgeLen += P3d.SquareDistance(P3dPrev);
         a2dEdgeLen += uv.SquareDistance(uvPrev);
         P3dPrev = P3d;
@@ -902,12 +890,12 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
       }
 
       Standard_Integer nbnodes = GT.NbPoints();
-      Standard_Real aMinToler = Min(defedge, mydeflection);
+      Standard_Real aMinToler = Min(theDefEdge, myDeflection);
       if(aEdgeLen < aMinToler*aMinToler)
       {
         //check 2D resolution
-        Standard_Real ddu = gFace->UResolution(aMinToler);
-        Standard_Real ddv = gFace->VResolution(aMinToler);
+        Standard_Real ddu = theGFace->UResolution(aMinToler);
+        Standard_Real ddv = theGFace->VResolution(aMinToler);
         Standard_Real aMin = Min(ddu, ddv);
 
         if(a2dEdgeLen < aMin*aMin)
@@ -916,7 +904,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
       TColStd_Array1OfInteger Nodes(1, nbnodes);
       TColStd_Array1OfInteger NodInStruct(1, nbnodes);
       TColStd_Array1OfReal Param(1, nbnodes);
-
+      
       // processing of the 1st point:
       Nodes(1) = isvf;
       NodInStruct(1) = ipf;
@@ -933,26 +921,26 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
         for (i = 2; i < GT.NbPoints(); i++)
         {
           // Record 3d point
-               GT.Value(cons, gFace, i, puv, P3d, uv);
-               nbLocat++;
-               Location3d.Bind(nbLocat, P3d);
-               NodInStruct(i) = nbLocat;
+          GT.Value(cons, theGFace, i, puv, P3d, uv);
+          myNbLocat++;
+          myLocation3d.Bind(myNbLocat, P3d);
+          NodInStruct(i) = myNbLocat;
           // Record 2d point
-               v2.Initialize(uv.Coord(), nbLocat, MeshDS_OnCurve);
-          iv2=structure->AddNode(v2);
+          v2.Initialize(uv.Coord(), myNbLocat, MeshDS_OnCurve);
+          iv2=myStructure->AddNode(v2);
           
-          Standard_Integer isv = myvemap.FindIndex(iv2);
-          if (isv == 0) isv = myvemap.Add(iv2);
+          Standard_Integer isv = myVemap.FindIndex(iv2);
+          if (isv == 0) isv = myVemap.Add(iv2);
           Nodes(i) = isv;
-          NodInStruct(i) = nbLocat;
+          NodInStruct(i) = myNbLocat;
           Param(i) = puv;
-
+    
           if (orEdge == TopAbs_FORWARD)
-            structure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Frontier));
+            myStructure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Frontier));
           else if (orEdge == TopAbs_REVERSED)
-            structure->AddLink(BRepMesh_Edge(iv2, ivf, MeshDS_Frontier));
+            myStructure->AddLink(BRepMesh_Edge(iv2, ivf, MeshDS_Frontier));
           else if (orEdge == TopAbs_INTERNAL)
-            structure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Fixed));
+            myStructure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Fixed));
           ivf = iv2;
         }
       }
@@ -964,15 +952,15 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
     P2->Deflection(otherdefedge);
     BRepMesh_PairOfPolygon pair;
     pair.Append(P2);
-    edges.Bind(edge, pair);
+    myEdges.Bind(theEdge, pair);
 
     if (ivf != ivl) {
       if (orEdge == TopAbs_FORWARD)
-             structure->AddLink(BRepMesh_Edge(ivf, ivl, MeshDS_Frontier));
+        myStructure->AddLink(BRepMesh_Edge(ivf, ivl, MeshDS_Frontier));
       else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(ivl, ivf, MeshDS_Frontier));
+        myStructure->AddLink(BRepMesh_Edge(ivl, ivf, MeshDS_Frontier));
       else if (orEdge == TopAbs_INTERNAL)
-        structure->AddLink(BRepMesh_Edge(ivf, ivl, MeshDS_Fixed));
+        myStructure->AddLink(BRepMesh_Edge(ivf, ivl, MeshDS_Fixed));
     }
       
 
@@ -998,7 +986,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
     else
     {
       // retrieve the polygone:
-      const BRepMesh_PairOfPolygon& pair = edges.Find(edge);
+      const BRepMesh_PairOfPolygon& pair = myEdges.Find(theEdge);
       const Handle(Poly_PolygonOnTriangulation)& P = pair.First();
       const TColStd_Array1OfInteger& NOD = P->Nodes();
       Handle(TColStd_HArray1OfReal) Par = P->Parameters();
@@ -1018,96 +1006,96 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
       if (nbnodes > 2)
       {
         Standard_Integer i;
-       if (BRep_Tool::SameParameter(edge))
+        if (BRep_Tool::SameParameter(theEdge))
         {
-         for (i = 2; i < nbnodes; i++)
+          for (i = 2; i < nbnodes; i++)
           {
             const Standard_Real puv = Par->Value(i);
-           C2d->D0(puv, uv);
-           v2.Initialize(uv.Coord(), NOD(i), MeshDS_OnCurve);
-            iv2 = structure->AddNode(v2);
-       
-           Standard_Integer isv = myvemap.FindIndex(iv2);
-           if (isv == 0) isv = myvemap.Add(iv2);
+            theC2d->D0(puv, uv);
+            v2.Initialize(uv.Coord(), NOD(i), MeshDS_OnCurve);
+            iv2 = myStructure->AddNode(v2);
+  
+            Standard_Integer isv = myVemap.FindIndex(iv2);
+            if (isv == 0) isv = myVemap.Add(iv2);
             Nodes(i) = isv;
-           PPar(i) = puv;
+            PPar(i) = puv;
             
             if (orEdge==TopAbs_FORWARD)
-             structure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(iv2, ivf, MeshDS_Frontier));
+              myStructure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Frontier));
+            else if (orEdge == TopAbs_REVERSED)
+              myStructure->AddLink(BRepMesh_Edge(iv2, ivf, MeshDS_Frontier));
             else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Fixed));
-         
+              myStructure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Fixed));
+    
             ivf = iv2;
-         }
-       }
+          }
+        }
         else
         {
-         const Standard_Real wFold = Par->Value(Par->Lower());
-         const Standard_Real wLold = Par->Value(Par->Upper());
+          const Standard_Real wFold = Par->Value(Par->Lower());
+          const Standard_Real wLold = Par->Value(Par->Upper());
 
-         Standard_Real wKoef = 1.;
-         if ((wFold != wFirst || wLold != wLast) && wLold != wFold)
+          Standard_Real wKoef = 1.;
+          if ((wFold != wFirst || wLold != wLast) && wLold != wFold)
           {
-           wKoef = (wLast - wFirst) / (wLold - wFold);
-         }
-         
-         BRepAdaptor_Curve cons(edge, face);
-         Extrema_LocateExtPC pcos;
-         pcos.Initialize(cons, cons.FirstParameter(), 
-                         cons.LastParameter(), Precision::PConfusion());
-
-         Standard_Real wPrev;
-         Standard_Real wCur      = wFirst;
-         Standard_Real wCurFound = wFirst;
-         for (i = 2; i < nbnodes; i++)
+            wKoef = (wLast - wFirst) / (wLold - wFold);
+          }
+          
+          BRepAdaptor_Curve cons(theEdge, theFace);
+          Extrema_LocateExtPC pcos;
+          pcos.Initialize(cons, cons.FirstParameter(), 
+              cons.LastParameter(), Precision::PConfusion());
+
+          Standard_Real wPrev;
+          Standard_Real wCur      = wFirst;
+          Standard_Real wCurFound = wFirst;
+          for (i = 2; i < nbnodes; i++)
           {
-           P3d = Location3d(NOD(i));
+            P3d = myLocation3d(NOD(i));
             // Record 2d point
-           wPrev = wCur;
-           wCur  = wFirst + wKoef*(Par->Value(i) - wFold);
-            wCurFound += (wCur - wPrev);
-           pcos.Perform(P3d, wCurFound);
-           if (pcos.IsDone()) wCurFound = pcos.Point().Parameter();
-           C2d->D0(wCurFound, uv);
-           v2.Initialize(uv.Coord(), NOD(i), MeshDS_OnCurve);
-            iv2 = structure->AddNode(v2);
-            
-           Standard_Integer isv = myvemap.FindIndex(iv2);
-           if (isv == 0) isv = myvemap.Add(iv2); 
-            Nodes(i) = isv;
-           PPar(i) = wCurFound;
-            
+            wPrev = wCur;
+            wCur  = wFirst + wKoef*(Par->Value(i) - wFold);
+                  wCurFound += (wCur - wPrev);
+            pcos.Perform(P3d, wCurFound);
+            if (pcos.IsDone()) wCurFound = pcos.Point().Parameter();
+            theC2d->D0(wCurFound, uv);
+            v2.Initialize(uv.Coord(), NOD(i), MeshDS_OnCurve);
+            iv2 = myStructure->AddNode(v2);
+                  
+            Standard_Integer isv = myVemap.FindIndex(iv2);
+            if (isv == 0) isv = myVemap.Add(iv2); 
+                  Nodes(i) = isv;
+            PPar(i) = wCurFound;
+                  
             if (orEdge==TopAbs_FORWARD)
-             structure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Frontier));
+              myStructure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Frontier));
             else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(iv2, ivf, MeshDS_Frontier));
+              myStructure->AddLink(BRepMesh_Edge(iv2, ivf, MeshDS_Frontier));
             else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Fixed));
-         
+              myStructure->AddLink(BRepMesh_Edge(ivf, iv2, MeshDS_Fixed));
+    
             ivf = iv2;
-         }
-       }
+          }
+        }
       }
 
-      P1 = new Poly_PolygonOnTriangulation(Nodes, PPar);
+    P1 = new Poly_PolygonOnTriangulation(Nodes, PPar);
     
     if (ivf != ivl) {
       if (orEdge == TopAbs_FORWARD) 
-       structure->AddLink(BRepMesh_Edge(ivf, ivl, MeshDS_Frontier));
+        myStructure->AddLink(BRepMesh_Edge(ivf, ivl, MeshDS_Frontier));
       else if (orEdge == TopAbs_REVERSED)
-       structure->AddLink(BRepMesh_Edge(ivl, ivf, MeshDS_Frontier));
+        myStructure->AddLink(BRepMesh_Edge(ivl, ivf, MeshDS_Frontier));
       else if (orEdge == TopAbs_INTERNAL)
-       structure->AddLink(BRepMesh_Edge(ivf, ivl, MeshDS_Fixed));
+        myStructure->AddLink(BRepMesh_Edge(ivf, ivl, MeshDS_Fixed));
       }
     }
   }
 
-  P1->Deflection(defedge);
-  if (internaledges.IsBound(edge))
+  P1->Deflection(theDefEdge);
+  if (myInternaledges.IsBound(theEdge))
   {
-    BRepMesh_PairOfPolygon& pair = internaledges.ChangeFind(edge);
+    BRepMesh_PairOfPolygon& pair = myInternaledges.ChangeFind(theEdge);
     if (orEdge == TopAbs_REVERSED)
       pair.Append(P1);
     else
@@ -1117,7 +1105,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
   {
     BRepMesh_PairOfPolygon pair1;
     pair1.Append(P1);
-    internaledges.Bind(edge, pair1);
+    myInternaledges.Bind(theEdge, pair1);
   }
 }
 
@@ -1126,14 +1114,14 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Edge&                  edge,
 //function : Update(edge)
 //purpose  :
 //=======================================================================
-Standard_Boolean BRepMesh_FastDiscret::Update(const TopoDS_Edge&  edge,
-                                         const TopoDS_Face&  face,
-                                          const Handle(Geom2d_Curve)& C2d,
-                                         const Standard_Real defedge,
-                                          const Standard_Real first,
-                                          const Standard_Real last)
+Standard_Boolean BRepMesh_FastDiscret::Update(const TopoDS_Edge&          theEdge,
+                                              const TopoDS_Face&          theFace,
+                                              const Handle(Geom2d_Curve)& theC2d,
+                                              const Standard_Real         theDefEdge,
+                                              const Standard_Real         theFirst,
+                                              const Standard_Real         theLast)
 {
-  TopLoc_Location l;
+  TopLoc_Location Loc;
   Handle(Poly_Triangulation) T, TNull;
   Handle(Poly_PolygonOnTriangulation) Poly, NullPoly;
 
@@ -1141,103 +1129,103 @@ Standard_Boolean BRepMesh_FastDiscret::Update(const TopoDS_Edge&  edge,
   Standard_Boolean found = Standard_False;
   do
   {
-    BRep_Tool::PolygonOnTriangulation(edge,Poly,T,l,i);
+    BRep_Tool::PolygonOnTriangulation(theEdge,Poly,T,Loc,i);
     i++;
     if (!found && !T.IsNull() && T->HasUVNodes() && 
-       !Poly.IsNull() && Poly->HasParameters())
+        !Poly.IsNull() && Poly->HasParameters())
     {
-      if (Poly->Deflection() <= 1.1*defedge)
+      if (Poly->Deflection() <= 1.1*theDefEdge)
       {
         // 2d vertex indices
-        TopAbs_Orientation orEdge = edge.Orientation();
+        TopAbs_Orientation orEdge = theEdge.Orientation();
         Standard_Integer iv1, iv2, ivl;
         Standard_Integer isv1, isv, isvl;
         
         // Get range on 2d curve
-       Standard_Real wFirst, wLast;
-       BRep_Tool::Range(edge, face, wFirst, wLast);
-
+        Standard_Real wFirst, wLast;
+        BRep_Tool::Range(theEdge, theFace, wFirst, wLast);
+        
         // Get end points on 2d curve
-       gp_Pnt2d uvFirst, uvLast;
-       BRep_Tool::UVPoints(edge, face, uvFirst, uvLast);
+        gp_Pnt2d uvFirst, uvLast;
+        BRep_Tool::UVPoints(theEdge, theFace, uvFirst, uvLast);
 
         // Get vertices
-       TopoDS_Vertex pBegin, pEnd;
-       TopExp::Vertices(edge,pBegin,pEnd);
-
-       const Standard_Boolean sameUV =
+        TopoDS_Vertex pBegin, pEnd;
+        TopExp::Vertices(theEdge,pBegin,pEnd);
+        
+        const Standard_Boolean sameUV =
           uvFirst.IsEqual(uvLast, Precision::PConfusion());
-
-       //Controle vertice tolerances
-        BRepAdaptor_Surface  BS(face, Standard_False);
+        
+        //Controle vertice tolerances
+        BRepAdaptor_Surface  BS(theFace, Standard_False);
         Handle(BRepAdaptor_HSurface) gFace = new BRepAdaptor_HSurface(BS);
+        
 
+        gp_Pnt pFirst = gFace->Value(uvFirst.X(), uvFirst.Y());
+        gp_Pnt pLast  = gFace->Value(uvLast.X(), uvLast.Y());
+        
+        Standard_Real mindist = 10. * Max(pFirst.Distance(BRep_Tool::Pnt(pBegin)), 
+                                          pLast.Distance(BRep_Tool::Pnt(pEnd)));
 
-       gp_Pnt pFirst = gFace->Value(uvFirst.X(), uvFirst.Y());
-       gp_Pnt pLast  = gFace->Value(uvLast.X(), uvLast.Y());
-       
-       Standard_Real mindist = 10. * Max(pFirst.Distance(BRep_Tool::Pnt(pBegin)), 
-                                         pLast.Distance(BRep_Tool::Pnt(pEnd)));
-
-       if (mindist < BRep_Tool::Tolerance(pBegin) ||
-           mindist < BRep_Tool::Tolerance(pEnd) ) mindist = defedge;
-
-       if (sameUV)
+        if (mindist < BRep_Tool::Tolerance(pBegin) ||
+            mindist < BRep_Tool::Tolerance(pEnd) ) mindist = theDefEdge;
+        
+        if (sameUV)
         {
-         // 1. is it really sameUV without being degenerated
-         gp_Pnt2d uvF, uvL;
-         C2d->D0(first, uvF);
-         C2d->D0(last, uvL);
-         if (!uvFirst.IsEqual(uvF, Precision::PConfusion())) {
-           uvFirst = uvF;
-         }
-         if (!uvLast.IsEqual(uvL, Precision::PConfusion())) {
-           uvLast = uvL; 
-         }
-       }
-
-       const TColgp_Array1OfPnt&      Nodes   = T->Nodes();
-       const TColStd_Array1OfInteger& Indices = Poly->Nodes();
-       Handle(TColStd_HArray1OfReal)  Param   = Poly->Parameters();
-
-       const Standard_Integer nbnodes = Indices.Length();
-       TColStd_Array1OfInteger NewNodes(1, nbnodes);
-        TColStd_Array1OfInteger NewNodInStruct(1, nbnodes);
+          // 1. is it really sameUV without being degenerated
+          gp_Pnt2d uvF, uvL;
+          theC2d->D0(theFirst, uvF);
+          theC2d->D0(theLast, uvL);
+          if (!uvFirst.IsEqual(uvF, Precision::PConfusion())) {
+            uvFirst = uvF;
+          }
+          if (!uvLast.IsEqual(uvL, Precision::PConfusion())) {
+            uvLast = uvL; 
+          }
+        }
 
+        const TColgp_Array1OfPnt&      Nodes   = T->Nodes();
+        const TColStd_Array1OfInteger& Indices = Poly->Nodes();
+        Handle(TColStd_HArray1OfReal)  Param   = Poly->Parameters();
+        
+        const Standard_Integer nbnodes = Indices.Length();
+        TColStd_Array1OfInteger NewNodes(1, nbnodes);
+        TColStd_Array1OfInteger NewNodInStruct(1, nbnodes);
+        
         gp_Pnt P3d;
-       gp_XY theUV;
-
+        gp_XY theUV;
+        
         // Process first vertex
         Standard_Integer ipf;
-       if (vertices.IsBound(pBegin))
+        if (myVertices.IsBound(pBegin))
         {
-         ipf = vertices.Find(pBegin);
-       }
+          ipf = myVertices.Find(pBegin);
+        }
         else
         {
-         if (sameUV && vertices.IsBound(pEnd))
+          if (sameUV && myVertices.IsBound(pEnd))
           {
-           ipf = vertices.Find(pEnd);
-         }
-         else
+              ipf = myVertices.Find(pEnd);
+          }
+          else
           {
-           P3d = Nodes(Indices(1));
-           if (!l.IsIdentity())
-              P3d.Transform(l.Transformation());
-            nbLocat++;
-            Location3d.Bind(nbLocat,P3d);
-           ipf = nbLocat;
-         }
-          vertices.Bind(pBegin,ipf);
-       } 
-       NewNodInStruct(1) = ipf;
-       theUV = FindUV(pBegin, uvFirst, ipf, gFace, mindist);
-       BRepMesh_Vertex vf(theUV,ipf,MeshDS_Frontier);
-        iv1 = structure->AddNode(vf);
-        isv1 = myvemap.FindIndex(iv1);
-        if (isv1 == 0) isv1 = myvemap.Add(iv1);
-       NewNodes(1) = isv1;
-
+            P3d = Nodes(Indices(1));
+            if (!Loc.IsIdentity())
+              P3d.Transform(Loc.Transformation());
+            myNbLocat++;
+            myLocation3d.Bind(myNbLocat,P3d);
+            ipf = myNbLocat;
+          }
+          myVertices.Bind(pBegin,ipf);
+        }
+        NewNodInStruct(1) = ipf;
+        theUV = BRepMesh_FastDiscretFace::FindUV(pBegin, uvFirst, ipf, gFace, mindist, myLocation2d);
+        BRepMesh_Vertex vf(theUV,ipf,MeshDS_Frontier);
+        iv1 = myStructure->AddNode(vf);
+        isv1 = myVemap.FindIndex(iv1);
+        if (isv1 == 0) isv1 = myVemap.Add(iv1);
+        NewNodes(1) = isv1;
+        
         // Process last vertex
         Standard_Integer ipl;
         if (pEnd.IsSame(pBegin))
@@ -1246,9 +1234,9 @@ Standard_Boolean BRepMesh_FastDiscret::Update(const TopoDS_Edge&  edge,
         }
         else
         {
-          if (vertices.IsBound(pEnd))
+          if (myVertices.IsBound(pEnd))
           {
-            ipl = vertices.Find(pEnd);
+            ipl = myVertices.Find(pEnd);
           }
           else
           {
@@ -1260,169 +1248,169 @@ Standard_Boolean BRepMesh_FastDiscret::Update(const TopoDS_Edge&  edge,
             }
             else
             {
-              nbLocat++;
-              Location3d.Bind(nbLocat,Nodes(Indices(nbnodes)).Transformed(l.Transformation()));
-              ipl = nbLocat;
+              myNbLocat++;
+              myLocation3d.Bind(myNbLocat,Nodes(Indices(nbnodes)).Transformed(Loc.Transformation()));
+              ipl = myNbLocat;
             }
-            vertices.Bind(pEnd,ipl);
+            myVertices.Bind(pEnd,ipl);
           }
         }
-       NewNodInStruct(nbnodes) = ipl;
-       theUV = FindUV(pEnd, uvLast, ipl, gFace, mindist);
-       BRepMesh_Vertex vl(theUV,ipl,MeshDS_Frontier);
+        NewNodInStruct(nbnodes) = ipl;
+        theUV = BRepMesh_FastDiscretFace::FindUV(pEnd, uvLast, ipl, gFace, mindist, myLocation2d);
+        BRepMesh_Vertex vl(theUV,ipl,MeshDS_Frontier);
         
-        ivl = structure->AddNode(vl);
-        isvl = myvemap.FindIndex(ivl);
-        if (isvl == 0) isvl = myvemap.Add(ivl);
+        ivl = myStructure->AddNode(vl);
+        isvl = myVemap.FindIndex(ivl);
+        if (isvl == 0) isvl = myVemap.Add(ivl);
         
-       NewNodes(nbnodes) = isvl;
-       
-       gp_Pnt2d uv;
-       BRepMesh_Vertex v;
-       
-       if (BRep_Tool::SameParameter(edge))
+        NewNodes(nbnodes) = isvl;
+  
+        gp_Pnt2d uv;
+        BRepMesh_Vertex v;
+  
+        if (BRep_Tool::SameParameter(theEdge))
         {
-         for (i = 2; i < Indices.Length(); i++)
+          for (i = 2; i < Indices.Length(); i++)
           {
             // Record 3d point
-           P3d = Nodes(Indices(i));
-           if (!l.IsIdentity())
-              P3d.Transform(l.Transformation());
-           nbLocat++;
-           Location3d.Bind(nbLocat, P3d);
-           NewNodInStruct(i) = nbLocat;
+            P3d = Nodes(Indices(i));
+            if (!Loc.IsIdentity())
+              P3d.Transform(Loc.Transformation());
+            myNbLocat++;
+            myLocation3d.Bind(myNbLocat, P3d);
+            NewNodInStruct(i) = myNbLocat;
             // Record 2d point
-           uv = C2d->Value(Param->Value(i));
-           v.Initialize(uv.Coord(), nbLocat, MeshDS_Frontier);
-            iv2 = structure->AddNode(v);
-            isv = myvemap.FindIndex(iv2);
-            if (isv == 0) isv = myvemap.Add(iv2);
-           NewNodes(i) = isv;
+            uv = theC2d->Value(Param->Value(i));
+            v.Initialize(uv.Coord(), myNbLocat, MeshDS_Frontier);
+            iv2 = myStructure->AddNode(v);
+            isv = myVemap.FindIndex(iv2);
+            if (isv == 0) isv = myVemap.Add(iv2);
+            NewNodes(i) = isv;
             
             //add links
             if (orEdge == TopAbs_FORWARD)
-              structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(iv2,iv1,MeshDS_Frontier));
-           else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Fixed));
-           iv1 = iv2;  
-         }
+              myStructure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Frontier));
+            else if (orEdge == TopAbs_REVERSED)
+              myStructure->AddLink(BRepMesh_Edge(iv2,iv1,MeshDS_Frontier));
+            else if (orEdge == TopAbs_INTERNAL)
+              myStructure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Fixed));
+            iv1 = iv2;  
+          }
           
           // last point
           if (iv1 != ivl) {
-           if (orEdge == TopAbs_FORWARD)
-             structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(ivl,iv1,MeshDS_Frontier));
-           else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Fixed));
-         }
-
+            if (orEdge == TopAbs_FORWARD)
+              myStructure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Frontier));
+            else if (orEdge == TopAbs_REVERSED)
+              myStructure->AddLink(BRepMesh_Edge(ivl,iv1,MeshDS_Frontier));
+            else if (orEdge == TopAbs_INTERNAL)
+              myStructure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Fixed));
+          }
+          
           
-       }
+        }
         else
         {
-         const Standard_Real wFold = Param->Value(Param->Lower());
-         const Standard_Real wLold = Param->Value(Param->Upper());
-
-         Standard_Real wKoef = 1.;
-         if ((wFold != wFirst || wLold != wLast) && wLold != wFold)
+          const Standard_Real wFold = Param->Value(Param->Lower());
+          const Standard_Real wLold = Param->Value(Param->Upper());
+          
+          Standard_Real wKoef = 1.;
+          if ((wFold != wFirst || wLold != wLast) && wLold != wFold)
           {
-           wKoef = (wLast - wFirst) / (wLold - wFold);
-         }
-         
-         BRepAdaptor_Curve cons(edge, face);
-         Extrema_LocateExtPC pcos;
-         pcos.Initialize(cons, cons.FirstParameter(), 
-                         cons.LastParameter(), Precision::PConfusion());
-
-         Standard_Real wPrev;
-         Standard_Real wCur      = wFirst;
-         Standard_Real wCurFound = wFirst;
-         for (i = 2; i < Indices.Length(); i++)
+            wKoef = (wLast - wFirst) / (wLold - wFold);
+          }
+    
+          BRepAdaptor_Curve cons(theEdge, theFace);
+          Extrema_LocateExtPC pcos;
+          pcos.Initialize(cons, cons.FirstParameter(), 
+                          cons.LastParameter(), Precision::PConfusion());
+          
+          Standard_Real wPrev;
+          Standard_Real wCur      = wFirst;
+          Standard_Real wCurFound = wFirst;
+          for (i = 2; i < Indices.Length(); i++)
           {
             // Record 3d point
-           P3d = Nodes(Indices(i));
-           if (!l.IsIdentity())
-              P3d.Transform(l.Transformation());
-           nbLocat++;
-           Location3d.Bind(nbLocat, P3d);
-           NewNodInStruct(i) = nbLocat;
+            P3d = Nodes(Indices(i));
+            if (!Loc.IsIdentity())
+              P3d.Transform(Loc.Transformation());
+            myNbLocat++;
+            myLocation3d.Bind(myNbLocat, P3d);
+            NewNodInStruct(i) = myNbLocat;
             // Record 2d point
-           wPrev = wCur;
-           wCur  = wFirst + wKoef*(Param->Value(i) - wFold);
+            wPrev = wCur;
+            wCur  = wFirst + wKoef*(Param->Value(i) - wFold);
             wCurFound += (wCur - wPrev);
-           pcos.Perform(P3d, wCurFound);
-           if (pcos.IsDone()) wCurFound = pcos.Point().Parameter();
-           C2d->D0(wCurFound, uv);
-           v.Initialize(uv.Coord(), nbLocat, MeshDS_Frontier);
-            iv2 = structure->AddNode(v);
-            isv = myvemap.FindIndex(iv2);
-            if (isv == 0) isv = myvemap.Add(iv2);
-           NewNodes(i) = isv;
+            pcos.Perform(P3d, wCurFound);
+            if (pcos.IsDone()) wCurFound = pcos.Point().Parameter();
+            theC2d->D0(wCurFound, uv);
+            v.Initialize(uv.Coord(), myNbLocat, MeshDS_Frontier);
+            iv2 = myStructure->AddNode(v);
+            isv = myVemap.FindIndex(iv2);
+            if (isv == 0) isv = myVemap.Add(iv2);
+            NewNodes(i) = isv;
 
             
             //add links
             if (orEdge == TopAbs_FORWARD)
-              structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(iv2,iv1,MeshDS_Frontier));
-           else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Fixed));
-           iv1 = iv2;              
-         }
+              myStructure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Frontier));
+            else if (orEdge == TopAbs_REVERSED)
+              myStructure->AddLink(BRepMesh_Edge(iv2,iv1,MeshDS_Frontier));
+            else if (orEdge == TopAbs_INTERNAL)
+              myStructure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Fixed));
+            iv1 = iv2;              
+          }
           
           // last point
           if (iv1 != ivl) {
-           if (orEdge == TopAbs_FORWARD)
-             structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(ivl,iv1,MeshDS_Frontier));
-           else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Fixed));
-         }
-       }
-
-       Handle(Poly_PolygonOnTriangulation) P1 =
+            if (orEdge == TopAbs_FORWARD)
+              myStructure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Frontier));
+            else if (orEdge == TopAbs_REVERSED)
+              myStructure->AddLink(BRepMesh_Edge(ivl,iv1,MeshDS_Frontier));
+            else if (orEdge == TopAbs_INTERNAL)
+              myStructure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Fixed));
+          }
+        }
+        
+        Handle(Poly_PolygonOnTriangulation) P1 =
           new Poly_PolygonOnTriangulation(NewNodes, Param->Array1());
-       P1->Deflection(defedge);
-       if (internaledges.IsBound(edge))
+        P1->Deflection(theDefEdge);
+        if (myInternaledges.IsBound(theEdge))
         {
-         BRepMesh_PairOfPolygon& pair = internaledges.ChangeFind(edge);
-          if (edge.Orientation() == TopAbs_REVERSED)
+          BRepMesh_PairOfPolygon& pair = myInternaledges.ChangeFind(theEdge);
+          if (theEdge.Orientation() == TopAbs_REVERSED)
             pair.Append(P1);
           else
             pair.Prepend(P1);
-       }
-       else
+        }
+        else
         {
-         BRepMesh_PairOfPolygon pair1;
-         pair1.Append(P1);
-         internaledges.Bind(edge, pair1);
-       }
-
-       Handle(Poly_PolygonOnTriangulation) P2 =
+          BRepMesh_PairOfPolygon pair1;
+          pair1.Append(P1);
+          myInternaledges.Bind(theEdge, pair1);
+        }
+        
+        Handle(Poly_PolygonOnTriangulation) P2 =
           new Poly_PolygonOnTriangulation(NewNodInStruct, Param->Array1());
-       P2->Deflection(defedge);
-       BRepMesh_PairOfPolygon pair;
-       pair.Append(P2);
-       edges.Bind(edge, pair);
-
-       found = Standard_True;
+        P2->Deflection(theDefEdge);
+        BRepMesh_PairOfPolygon pair;
+        pair.Append(P2);
+        myEdges.Bind(theEdge, pair);
+        
+        found = Standard_True;
       }
       else
       {
-       BRep_Builder B;
-       B.UpdateEdge(edge,NullPoly,T,l);
-       B.UpdateFace(face,TNull);
+        BRep_Builder B;
+        B.UpdateEdge(theEdge,NullPoly,T,Loc);
+        B.UpdateFace(theFace,TNull);
       }
     }
     else if (!T.IsNull() && !T->HasUVNodes())
     {
       BRep_Builder B;
-      B.UpdateEdge(edge,NullPoly,T,l);
-      B.UpdateFace(face,TNull);
+      B.UpdateEdge(theEdge,NullPoly,T,Loc);
+      B.UpdateFace(theFace,TNull);
     }
   }
   while (!Poly.IsNull());
@@ -1436,7 +1424,7 @@ Standard_Boolean BRepMesh_FastDiscret::Update(const TopoDS_Edge&  edge,
 //=======================================================================
 Standard_Integer BRepMesh_FastDiscret::NbTriangles() const
 {
-  return structure->NbElements();
+  return myStructure->NbElements();
 }
 
 //=======================================================================
@@ -1447,7 +1435,7 @@ Standard_Integer BRepMesh_FastDiscret::NbTriangles() const
 const BRepMesh_Triangle& BRepMesh_FastDiscret::Triangle
   (const Standard_Integer Index) const
 {
-  return structure->GetElement(Index);
+  return myStructure->GetElement(Index);
 }
 
 //=======================================================================
@@ -1457,7 +1445,7 @@ const BRepMesh_Triangle& BRepMesh_FastDiscret::Triangle
 
 Standard_Integer BRepMesh_FastDiscret::NbEdges() const
 {
-  return structure->NbLinks();
+  return myStructure->NbLinks();
 }
 
 //=======================================================================
@@ -1467,7 +1455,7 @@ Standard_Integer BRepMesh_FastDiscret::NbEdges() const
 
 const BRepMesh_Edge& BRepMesh_FastDiscret::Edge(const Standard_Integer Index) const
 {
-  return structure->GetLink(Index);
+  return myStructure->GetLink(Index);
 }
 
 //=======================================================================
@@ -1477,7 +1465,7 @@ const BRepMesh_Edge& BRepMesh_FastDiscret::Edge(const Standard_Integer Index) co
 
 Standard_Integer BRepMesh_FastDiscret::NbVertices() const
 {
-  return structure->NbNodes();
+  return myStructure->NbNodes();
 }
 
 //=======================================================================
@@ -1488,7 +1476,7 @@ Standard_Integer BRepMesh_FastDiscret::NbVertices() const
 const BRepMesh_Vertex& BRepMesh_FastDiscret::Vertex
   (const Standard_Integer Index) const
 {
-  return structure->GetNode(Index);
+  return myStructure->GetNode(Index);
 }
 
 //=======================================================================
@@ -1498,7 +1486,7 @@ const BRepMesh_Vertex& BRepMesh_FastDiscret::Vertex
 
 const gp_Pnt& BRepMesh_FastDiscret::Pnt(const Standard_Integer Index) const
 {
-  return Location3d(structure->GetNode(Index).Location3d());
+  return myLocation3d(myStructure->GetNode(Index).Location3d());
 }
 
 //=======================================================================
@@ -1511,7 +1499,7 @@ void BRepMesh_FastDiscret::VerticesOfDomain(MeshDS_MapOfInteger&  Indices) const
   Indices.Clear();
   
   // recuperate from the map of edges.
-  const MeshDS_MapOfInteger& edmap = structure->LinkOfDomain();
+  const MeshDS_MapOfInteger& edmap = myStructure->LinkOfDomain();
 
   // iterator on edges.
   MeshDS_MapOfInteger::Iterator iter(edmap);
@@ -1525,68 +1513,9 @@ void BRepMesh_FastDiscret::VerticesOfDomain(MeshDS_MapOfInteger&  Indices) const
   }
 }
 
-//=======================================================================
-//function : FindUV
-//purpose  : 
-//=======================================================================
-
-gp_XY BRepMesh_FastDiscret::FindUV(const TopoDS_Vertex&   V,
-                              const gp_Pnt2d&        XY, 
-                              const Standard_Integer ip,
-                              const Handle(BRepAdaptor_HSurface)& S,
-                              const Standard_Real mindist) 
-{
-  gp_XY theUV;
-  if (mylocation2d.IsBound(ip))
-  {
-    BRepMesh_ListOfXY& L = mylocation2d.ChangeFind(ip);
-    theUV = L.First();
-    if (L.Extent() != 1)
-    {
-      BRepMesh_ListIteratorOfListOfXY it(L);
-      it.Next();
-      Standard_Real dd, dmin = XY.Distance(gp_Pnt2d(theUV));
-      for (; it.More(); it.Next())
-      {
-       dd = XY.Distance(gp_Pnt2d(it.Value()));
-       if (dd < dmin)
-        {
-         theUV = it.Value();
-         dmin = dd;
-       }
-      }
-    }
-
-    const Standard_Real tol = Min(2. * BRep_Tool::Tolerance(V), mindist);
-
-    const Standard_Real Utol2d = .5 * (S->LastUParameter() - S->FirstUParameter());
-    const Standard_Real Vtol2d = .5 * (S->LastVParameter() - S->FirstVParameter());
-
-    const gp_Pnt p1 = S->Value(theUV.X(), theUV.Y());
-    const gp_Pnt p2 = S->Value(XY.X(), XY.Y());
-
-    if (Abs(theUV.X() - XY.X()) > Utol2d ||
-        Abs(theUV.Y() - XY.Y()) > Vtol2d ||
-       !p1.IsEqual(p2, tol))
-    {
-      theUV = XY.Coord();
-      L.Append(theUV);
-    }
-  }
-  else
-  {
-    theUV = XY.Coord();
-    BRepMesh_ListOfXY L;
-    L.Append(theUV);
-    mylocation2d.Bind(ip, L);
-  }
-  return theUV;
-}
-
-
 BRepMesh_Status BRepMesh_FastDiscret::CurrentFaceStatus() const
 {
-  return myfacestate;
+  return myFacestate;
 }
 
 //=======================================================================
@@ -1594,12 +1523,12 @@ BRepMesh_Status BRepMesh_FastDiscret::CurrentFaceStatus() const
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean BRepMesh_FastDiscret::GetFaceAttribute(const TopoDS_Face& theFace,
-                                                        Handle(BRepMesh_FaceAttribute)& fattrib) const
+Standard_Boolean BRepMesh_FastDiscret::GetFaceAttribute(const TopoDS_Face&              theFace,
+                                                        Handle(BRepMesh_FaceAttribute)& theFattrib) const
 {
-  if(mapattrib.IsBound(theFace))
+  if(myMapattrib.IsBound(theFace))
   {
-    fattrib = mapattrib(theFace);
+    theFattrib = myMapattrib(theFace);
     return Standard_True;
   }
   return Standard_False;
@@ -1612,6 +1541,6 @@ Standard_Boolean BRepMesh_FastDiscret::GetFaceAttribute(const TopoDS_Face& theFa
 
 void BRepMesh_FastDiscret::RemoveFaceAttribute(const TopoDS_Face& theFace)
 {
-  if(mapattrib.IsBound(theFace))
-    mapattrib.UnBind(theFace);
+  if(myMapattrib.IsBound(theFace))
+    myMapattrib.UnBind(theFace);
 }
index 843c008..25c8c0e 100755 (executable)
@@ -1,21 +1,11 @@
-// File:       BRepMesh_FastDiscret.lxx
-// Created:    Fri Sep 26 16:39:53 2003
-// Author:     Open CASCADE Support
-//             <support@opencascade.com>
-// Copyright:   Open CASCADE 2003
+// File:        BRepMesh_FastDiscret.lxx
+// Created:     Fri Sep 26 16:39:53 2003
+// Author:      Open CASCADE Support
+//              <support@opencascade.com>
+// Copyright:    Open CASCADE 2003
 
 #include <BRepMesh_DataStructureOfDelaun.hxx>
 
-//=======================================================================
-//function : InternalVerticesMode
-//purpose  : 
-//=======================================================================
-
-inline Standard_Boolean& BRepMesh_FastDiscret::InternalVerticesMode ()
-{
-  return myInternalVerticesMode;
-}
-
 //=======================================================================
 //function : GetDeflection
 //purpose  : 
@@ -23,7 +13,7 @@ inline Standard_Boolean& BRepMesh_FastDiscret::InternalVerticesMode ()
 
 inline Standard_Real BRepMesh_FastDiscret::GetDeflection() const
 {
-  return mydeflection;
+  return myDeflection;
 }
 
 //=======================================================================
@@ -33,7 +23,7 @@ inline Standard_Real BRepMesh_FastDiscret::GetDeflection() const
 
 inline Standard_Real BRepMesh_FastDiscret::GetAngle() const
 {
-  return myangle;
+  return myAngle;
 }
 
 //=======================================================================
@@ -43,7 +33,7 @@ inline Standard_Real BRepMesh_FastDiscret::GetAngle() const
 
 inline const TopTools_DataMapOfShapeReal& BRepMesh_FastDiscret::GetMapOfDefEdge() const
 {
-  return mapdefle;
+  return myMapdefle;
 }
 
 //=======================================================================
@@ -53,7 +43,7 @@ inline const TopTools_DataMapOfShapeReal& BRepMesh_FastDiscret::GetMapOfDefEdge(
 
 inline void BRepMesh_FastDiscret::EdgesOfDomain(MeshDS_MapOfInteger&  Indices) const 
 { 
-  Indices = structure->LinkOfDomain();
+  Indices = myStructure->LinkOfDomain();
 }
 
 //=======================================================================
@@ -63,7 +53,7 @@ inline void BRepMesh_FastDiscret::EdgesOfDomain(MeshDS_MapOfInteger&  Indices) c
 
 inline void BRepMesh_FastDiscret::TrianglesOfDomain(MeshDS_MapOfInteger&  Indices) const 
 { 
-  Indices = structure->ElemOfDomain();
+  Indices = myStructure->ElemOfDomain();
 }
 
 //=======================================================================
@@ -73,7 +63,7 @@ inline void BRepMesh_FastDiscret::TrianglesOfDomain(MeshDS_MapOfInteger&  Indice
 
 inline Standard_Integer BRepMesh_FastDiscret::NbPoint3d() const
 {
-  return nbLocat;
+  return myNbLocat;
 }
 
 //=======================================================================
@@ -83,7 +73,7 @@ inline Standard_Integer BRepMesh_FastDiscret::NbPoint3d() const
 
 inline const gp_Pnt& BRepMesh_FastDiscret::Point3d(const Standard_Integer Index) const
 {
-  return Location3d(Index);
+  return myLocation3d(Index);
 }
 
 //=======================================================================
@@ -103,7 +93,7 @@ inline Standard_Boolean BRepMesh_FastDiscret::WithShare() const
 
 inline Standard_Boolean BRepMesh_FastDiscret::InShape() const
 {
-  return myinshape;
+  return myInshape;
 }
 
 //=======================================================================
@@ -113,5 +103,5 @@ inline Standard_Boolean BRepMesh_FastDiscret::InShape() const
 
 inline Standard_Boolean BRepMesh_FastDiscret::ShapeTrigu() const
 {
-  return myshapetrigu;
+  return myShapetrigu;
 }
index bd9b2dd..085dcfc 100755 (executable)
--- File:       BRepMesh_FastDiscretFace.cdl
--- Created:    Tue Oct 28 14:10:54 2008
--- Author:     
---             <epa@TOSTEX>
----Copyright:   Matra Datavision 2008
+-- File:        BRepMesh_FastDiscretFace.cdl
+-- Created:     Tue Oct 28 14:10:54 2008
+-- Author:      
+--              <epa@TOSTEX>
+---Copyright:    Matra Datavision 2008
 
 private class FastDiscretFace from BRepMesh inherits TShared from MMgt
 
-       ---Purpose: Algorithm  to mesh  a face  with  respect of  the
-       --          frontier the deflection  and by option the  shared
-       --          components.
+        ---Purpose: Algorithm  to mesh  a face  with  respect of  the
+        --          frontier the deflection  and by option the  shared
+        --          components.
 
 
 uses    Boolean                   from Standard,
-       Integer                   from Standard,
-       Real                      from Standard,
-       Face                      from TopoDS,
-       Edge                      from TopoDS,
-       Vertex                    from TopoDS,
-       ListOfShape               from TopTools,
-       Dir                       from gp,
-       Pnt                       from gp,
-       Pnt2d                     from gp,
+        Integer                   from Standard,
+        Real                      from Standard,
+        Face                      from TopoDS,
+        Edge                      from TopoDS,
+        Vertex                    from TopoDS,
+        Pnt                       from gp,
+        Pnt2d                     from gp,
         XY                        from gp,
-       HSurface                  from BRepAdaptor,
-       Delaun                    from BRepMesh,
-       DataStructureOfDelaun     from BRepMesh,
-       DataMapOfVertexInteger    from BRepMesh,
-       DataMapOfIntegerListOfXY  from BRepMesh,
-       DataMapOfShapeReal        from TopTools,
-       ListOfVertex              from BRepMesh,
-       ClassifierPtr             from BRepMesh,        
-       Triangle                  from BRepMesh,
-       Edge                      from BRepMesh,
-       Vertex                    from BRepMesh,
-       Status                    from BRepMesh,
-       FaceAttribute             from BRepMesh,
-       Curve                     from Geom2d,
-       ListOfInteger             from TColStd,
-       BaseAllocator             from MeshDS,
-       MapOfInteger              from MeshDS,
-       DataMapOfIntegerPnt       from BRepMesh,
-       IndexedMapOfInteger       from TColStd,
+        HSurface                  from BRepAdaptor,
+        Delaun                    from BRepMesh,
+        DataStructureOfDelaun     from BRepMesh,
+        DataMapOfVertexInteger    from BRepMesh,
+        DataMapOfIntegerListOfXY  from BRepMesh,
+        DataMapOfShapeReal        from TopTools,
+        ListOfVertex              from BRepMesh,
+        ClassifierPtr             from BRepMesh,
+        Triangle                  from BRepMesh,
+        Edge                      from BRepMesh,
+        Vertex                    from BRepMesh,
+        FaceAttribute             from BRepMesh,
+        ListOfInteger             from TColStd,
+        BaseAllocator             from MeshDS,
+        DataMapOfIntegerPnt       from BRepMesh,
+        IndexedMapOfInteger       from TColStd,
         IndexedMapOfReal          from TColStd,
-       DataMapOfShapePairOfPolygon from  BRepMesh
-       
+        DataMapOfShapePairOfPolygon from  BRepMesh,
+        Triangulation             from Poly,
+        Location                  from TopLoc
+
 
 is 
 
-        Create (angle      : Real    from Standard;
-               withShare  : Boolean from Standard=Standard_True;
-               inshape    : Boolean from Standard=Standard_False;
-               shapetrigu : Boolean from Standard=Standard_False)
-           returns mutable FastDiscretFace from BRepMesh;
-
-
-
-
-       Add    (me       : mutable;
-               face     : Face from TopoDS;
-               attrib   : FaceAttribute from BRepMesh;        
-                mapdefle : DataMapOfShapeReal from TopTools)
-           is static;
-
-       
-       Add (me     : mutable;
-             theVert: Vertex   from TopoDS;
-            face   : Face     from TopoDS;
-            S      : HSurface from BRepAdaptor) is private;
-            
-       Update (me: mutable; 
-               Edge:    Edge     from TopoDS; 
-               Face:    Face     from TopoDS; 
-                C      : Curve    from Geom2d;
-               defedge: Real     from Standard;
-               first  : Real     from Standard;
-                last   : Real     from Standard)
-                
-       returns Boolean;
-       
+        Create (theAngle      : Real    from Standard;
+                theWithShare  : Boolean from Standard=Standard_True)
+          returns mutable FastDiscretFace from BRepMesh;
+
+
+
+
+        Add  (me       : mutable;
+              theFace     : Face from TopoDS;
+              theAttrib   : FaceAttribute from BRepMesh;
+              theMapDefle : DataMapOfShapeReal from TopTools)
+          is static;
+
+      
+        Add  (me     : mutable;
+              theVert       : Vertex   from TopoDS;
+              theFace       : Face     from TopoDS;
+              theSFace  : HSurface from BRepAdaptor) is private;
+            
+        RestoreStructureFromTriangulation
+               (me: mutable; 
+                theEdge    : Edge          from TopoDS;
+                theFace    : Face          from TopoDS;
+                theSurf    : HSurface      from BRepAdaptor;
+                theTrigu   : Triangulation from Poly;
+                theDefEdge : Real          from Standard;
+                theLoc     : Location      from TopLoc)
+          returns Boolean from Standard is protected;
+        
  
-       InternalVertices
-              (me         : mutable;
-               caro       : HSurface            from BRepAdaptor;
-               inter      : in out ListOfVertex from BRepMesh;
-               defedge    : Real                from Standard;
-               classifier : ClassifierPtr       from BRepMesh)
-       is static private;
-
-
-       Control
-              (me      : mutable;
-               caro    : HSurface                from BRepAdaptor;
-               defface : Real                    from Standard;
-               inter   : in out ListOfVertex     from BRepMesh;
-               badTri  : in out ListOfInteger    from TColStd;
-               nulTri  : in out ListOfInteger    from TColStd;
-               trigu   : in out Delaun           from BRepMesh;
-               isfirst : Boolean                 from Standard)
-       returns Real from Standard is static;
-
-       FindUV(me: mutable; V:  Vertex  from TopoDS; 
-                           XY: Pnt2d   from gp;
-                           ip: Integer from Standard; 
-                            S : HSurface from BRepAdaptor; 
-                            mindist:  Real  from  Standard)
-       returns XY from gp;
-
-       AddInShape(me: mutable; face   : Face                          from TopoDS;
-                               defedge: Real                          from Standard)
-       is static private;
+        InternalVertices  (me            : mutable;
+                           theCaro       : HSurface            from BRepAdaptor;
+                           theInternalV  : in out ListOfVertex from BRepMesh;
+                           theDefFace    : Real                from Standard;
+                           theClassifier : ClassifierPtr       from BRepMesh)
+          is static private;
+
+
+        Control  (me      : mutable;
+                  theCaro         : HSurface                from BRepAdaptor;
+                  theDefFace      : Real                    from Standard;
+                  theInternalV    : in out ListOfVertex     from BRepMesh;
+                  theBadTriangles : in out ListOfInteger    from TColStd;
+                  theNulTriangles : in out ListOfInteger    from TColStd;
+                  theTrigu        : in out Delaun           from BRepMesh;
+                  theIsFirst      : Boolean                 from Standard)
+          returns Real from Standard is static;
+
+        FindUV (myclass; 
+                theV            : Vertex                            from TopoDS; 
+                theXY           : Pnt2d                             from gp;
+                theIp           : Integer                           from Standard; 
+                theSFace        : HSurface                          from BRepAdaptor; 
+                theMinDist      : Real                              from  Standard;
+                theLocation2dMap: in out DataMapOfIntegerListOfXY   from BRepMesh)
+          returns XY from gp;
+
+        AddInShape (me: mutable;
+                    theFace   : Face     from TopoDS;
+                    theDefFace: Real     from Standard)
+          is static private;
 
 
 -- Output :
 
-       Triangle   (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the triangle of <Index>.
-           ---C++: return const &
-           returns Triangle from BRepMesh
-           is static;
-
-       Edge       (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the edge of index <Index>.
-           ---C++: return const &
-           returns Edge from BRepMesh
-           is static;
-
-
-       Vertex     (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the vertex of <Index>.
-           ---C++: return const &
-           returns Vertex from BRepMesh
-           is static;
-
-       Pnt        (me;
-                   Index : Integer from Standard)
-           ---Purpose: Gives the location3d of the vertex of <Index>.
-           ---C++: return const &
-           returns Pnt from gp
-           is static;
+        Triangle   (me;
+                    theIndex : Integer from Standard)
+        ---Purpose: Gives the triangle of <Index>.
+        ---C++: return const &
+          returns Triangle from BRepMesh
+          is static;
+
+        Edge       (me;
+                    theIndex : Integer from Standard)
+        ---Purpose: Gives the edge of index <Index>.
+        ---C++: return const &
+          returns Edge from BRepMesh
+          is static;
+
+
+        Vertex     (me;
+                    theIndex : Integer from Standard)
+          ---Purpose: Gives the vertex of <Index>.
+          ---C++: return const &
+          returns Vertex from BRepMesh
+          is static;
+
+        Pnt        (me;
+                    theIndex : Integer from Standard)
+          ---Purpose: Gives the location3d of the vertex of <Index>.
+          ---C++: return const &
+          returns Pnt from gp
+          is static;
 
 fields  
-       angle        : Real                          from Standard;
-       WithShare    : Boolean                       from Standard;
-       vertices     : DataMapOfVertexInteger        from BRepMesh;
-       edges        : DataMapOfShapePairOfPolygon   from BRepMesh;
-       internaledges: DataMapOfShapePairOfPolygon   from BRepMesh;
-       nbLocat      : Integer                       from Standard;
-       Location3d   : DataMapOfIntegerPnt           from BRepMesh;
-       structure    : DataStructureOfDelaun         from BRepMesh;
-       mylistver    : ListOfVertex                  from BRepMesh;
-       myvemap      : IndexedMapOfInteger           from TColStd;
-       mylocation2d : DataMapOfIntegerListOfXY      from BRepMesh;
-       myattrib     : FaceAttribute                 from BRepMesh;
-       myshapetrigu : Boolean                       from Standard;
-       myinshape    : Boolean                       from Standard;
-       myInternalVerticesMode : Boolean             from Standard; --mode to accounting internal vertices 
-       myUParam     : IndexedMapOfReal              from TColStd;
-       myVParam     : IndexedMapOfReal              from TColStd;
-       myAllocator  : BaseAllocator                 from MeshDS;
+        myAngle         : Real                          from Standard;
+        myWithShare     : Boolean                       from Standard;
+        myVertices      : DataMapOfVertexInteger        from BRepMesh;
+        myInternaledges : DataMapOfShapePairOfPolygon   from BRepMesh;
+        myNbLocat       : Integer                       from Standard;
+        myLocation3d    : DataMapOfIntegerPnt           from BRepMesh;
+        myStructure     : DataStructureOfDelaun         from BRepMesh;
+        myListver       : ListOfVertex                  from BRepMesh;
+        myVemap         : IndexedMapOfInteger           from TColStd;
+        myLocation2d    : DataMapOfIntegerListOfXY      from BRepMesh;
+        myAttrib        : FaceAttribute                 from BRepMesh;
+        myInternalVerticesMode : Boolean                from Standard; --mode to accounting internal vertices 
+        myUParam        : IndexedMapOfReal              from TColStd;
+        myVParam        : IndexedMapOfReal              from TColStd;
+        myAllocator     : BaseAllocator                 from MeshDS;
  
 end FastDiscretFace;
index 8f96927..9e5d9ef 100755 (executable)
@@ -1,6 +1,6 @@
-// File:       BRepMesh_FastDiscretFace.cxx
-// Created:    
-// Author:     Ekaterina SMIRNOVA
+// File:        BRepMesh_FastDiscretFace.cxx
+// Created:     
+// Author:      Ekaterina SMIRNOVA
 // Copyright: Open CASCADE SAS 2008
 
 #include <BRepMesh_FastDiscretFace.ixx>
 #include <BRep_Tool.hxx>
 #include <Geom_Surface.hxx>
 #include <ElSLib.hxx>
-#include <Extrema_LocateExtPC.hxx>
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
-#include <SortTools_ShellSortOfReal.hxx>
-#include <Poly_Connect.hxx>
 #include <Poly_PolygonOnTriangulation.hxx>
 #include <Poly_Triangulation.hxx>
-#include <TCollection_CompareOfReal.hxx>
 #include <TColStd_Array1OfReal.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
 #include <TColStd_SequenceOfReal.hxx>
 #include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_ListOfTransient.hxx>
 #include <TColStd_HArray1OfReal.hxx>
-#include <TColGeom2d_SequenceOfCurve.hxx>
 #include <TopExp_Explorer.hxx>
-#include <TopTools_SequenceOfShape.hxx>
 #include <TopoDS.hxx>
 #include <TopExp.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
@@ -83,12 +74,10 @@ static Standard_Real FUN_CalcAverageDUV(TColStd_Array1OfReal& P, const Standard_
 //function : BRepMesh_FastDiscretFace
 //purpose  : 
 //=======================================================================
-BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(const Standard_Real    angl,
-                                  const Standard_Boolean ws,
-                                  const Standard_Boolean inshape,
-                                  const Standard_Boolean shapetrigu): 
-  angle(angl), WithShare(ws), nbLocat(0), 
-  myshapetrigu(shapetrigu), myinshape(inshape),
+BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace
+                          (const Standard_Real     theAngle,
+                           const Standard_Boolean  theWithShare) : 
+  myAngle(theAngle), myWithShare(theWithShare), myNbLocat(0), 
   myInternalVerticesMode(Standard_True)
 {
   myAllocator = new NCollection_IncAllocator(64000);
@@ -99,74 +88,59 @@ BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(const Standard_Real    angl,
 //purpose  : 
 //=======================================================================
 
-void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theface,
-                                   const Handle(BRepMesh_FaceAttribute)& attrib,
-                                   const TopTools_DataMapOfShapeReal& mapdefle)
+void BRepMesh_FastDiscretFace::Add(const TopoDS_Face&                    theFace,
+                                   const Handle(BRepMesh_FaceAttribute)& theAttrib,
+                                   const TopTools_DataMapOfShapeReal&    theMapDefle)
 {
 #ifndef DEB_MESH
   try
   {
     OCC_CATCH_SIGNALS
 #endif
-    TopoDS_Face face = theface;
-    myattrib = attrib;
+    TopoDS_Face face = theFace;
+    TopLoc_Location loc;
+
+    const Handle(Poly_Triangulation)& aFaceTrigu = BRep_Tool::Triangulation(face, loc);
+    if ( aFaceTrigu.IsNull() )
+      return;
+
+    myAttrib = theAttrib;
     face.Orientation(TopAbs_FORWARD);
-    structure.Nullify();
+    myStructure.Nullify();
     Handle(NCollection_IncAllocator) anAlloc = Handle(NCollection_IncAllocator)::DownCast(myAllocator);
     anAlloc->Reset(Standard_False);  
-    structure=new BRepMesh_DataStructureOfDelaun(anAlloc);
+    myStructure=new BRepMesh_DataStructureOfDelaun(anAlloc);
     BRepAdaptor_Surface  BS(face, Standard_False);
     Handle(BRepAdaptor_HSurface) gFace = new BRepAdaptor_HSurface(BS);
     
     GeomAbs_SurfaceType thetype;
     thetype = BS.GetType();
     
-    gp_Pnt2d uvFirst, uvLast;
-
     TopAbs_Orientation orFace = face.Orientation();
-    TopLoc_Location loc;
 
-    if (!WithShare) {          
-      vertices.Clear();
-      edges.Clear();
-    }
+    if (!myWithShare)        
+      myVertices.Clear();
 
-    mylistver.Clear();
-    myvemap.Clear();
-    mylocation2d.Clear();
-    internaledges.Clear();
+    myListver.Clear();
+    myVemap.Clear();
+    myLocation2d.Clear();
+    myInternaledges.Clear();
 
     Standard_Integer i = 1;
-    Standard_Integer nbEdge = 0;
-    Standard_Real savangle = angle;
     Standard_Integer ipn = 0;
-
-    TColStd_SequenceOfReal aFSeq, aLSeq;
-    TColGeom2d_SequenceOfCurve aCSeq;
-    TopTools_SequenceOfShape aShSeq;
-    Standard_Real defedge = 0;
-
     TopoDS_Iterator exW(face);
     for (; exW.More(); exW.Next()) {
       const TopoDS_Shape& aWire = exW.Value();
       if (aWire.ShapeType() != TopAbs_WIRE)
-             continue;
+        continue;
       TopoDS_Iterator ex(aWire);
       for(; ex.More(); ex.Next()) {
-             const TopoDS_Edge& edge = TopoDS::Edge(ex.Value());
-             nbEdge++;
-             Standard_Real f,l;
-             if(edge.IsNull()) continue;
-             Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(edge, face, f, l);
-             if (C.IsNull()) continue;
-
-             aFSeq.Append(f);
-             aLSeq.Append(l);
-             aCSeq.Append(C);
-             aShSeq.Append(edge);
-       
-             Update(edge, face, C, mapdefle(edge), f, l);
-             angle = savangle;
+        const TopoDS_Edge& edge = TopoDS::Edge(ex.Value());
+        if(edge.IsNull())
+          continue;
+
+        RestoreStructureFromTriangulation(edge, face, gFace, aFaceTrigu, theMapDefle(edge), loc);
       }
     }
     
@@ -175,10 +149,10 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theface,
     Standard_Integer nbVertices = 0;
     if(myInternalVerticesMode) {
       for(TopExp_Explorer ex(face,TopAbs_VERTEX ,TopAbs_EDGE); ex.More(); ex.Next()) {
-             const TopoDS_Vertex& aVert = TopoDS::Vertex(ex.Current());
-             Add(aVert,face,gFace);
+        const TopoDS_Vertex& aVert = TopoDS::Vertex(ex.Current());
+        Add(aVert,face,gFace);
       }
-      nbVertices = myvemap.Extent();
+      nbVertices = myVemap.Extent();
     }
     
     // essai de determination de la longueur vraie:
@@ -189,44 +163,44 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theface,
     //Standard_Real longu = 0.0, longv = 0.0; //, last , first;
     //gp_Pnt P11, P12, P21, P22, P31, P32;
 
-    Standard_Real umax = myattrib->GetUMax();
-    Standard_Real umin = myattrib->GetUMin();
-    Standard_Real vmax = myattrib->GetVMax();
-    Standard_Real vmin = myattrib->GetVMin();
+    Standard_Real umax = myAttrib->GetUMax();
+    Standard_Real umin = myAttrib->GetUMin();
+    Standard_Real vmax = myAttrib->GetVMax();
+    Standard_Real vmin = myAttrib->GetVMin();
     
     TColStd_Array1OfInteger tabvert_corr(1, nbVertices);
     gp_Pnt2d p2d;
     
     // Check the necessity to fill the map of parameters
     const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus ||
-                                        thetype == GeomAbs_BezierSurface ||
-                                        thetype == GeomAbs_BSplineSurface);
+                                         thetype == GeomAbs_BezierSurface ||
+                                         thetype == GeomAbs_BSplineSurface);
     myUParam.Clear(); 
     myVParam.Clear();
   
-    BRepMesh_IDMapOfNodeOfDataStructureOfDelaun aMoveNodes(myvemap.Extent());
+    BRepMesh_IDMapOfNodeOfDataStructureOfDelaun aMoveNodes(myVemap.Extent());
     
-    for (i = 1; i <= structure->NbNodes(); i++)
+    for (i = 1; i <= myStructure->NbNodes(); i++)
     {
-      const BRepMesh_Vertex& v = structure->GetNode(i);
+      const BRepMesh_Vertex& v = myStructure->GetNode(i);
       p2d = v.Coord();
       if (useUVParam) {
-             myUParam.Add(p2d.X());
-             myVParam.Add(p2d.Y());
+        myUParam.Add(p2d.X());
+        myVParam.Add(p2d.Y());
       }
       gp_XY res;
-      res.SetCoord((p2d.X()-(myattrib->GetMinX()))/(myattrib->GetDeltaX()),
-                  (p2d.Y()-(myattrib->GetMinY()))/(myattrib->GetDeltaY()));
+      res.SetCoord((p2d.X()-(myAttrib->GetMinX()))/(myAttrib->GetDeltaX()),
+                   (p2d.Y()-(myAttrib->GetMinY()))/(myAttrib->GetDeltaY()));
       BRepMesh_Vertex v_new(res,v.Location3d(),v.Movability());
-      const MeshDS_ListOfInteger& alist = structure->GetNodeList(i);
+      const MeshDS_ListOfInteger& alist = myStructure->GetNodeList(i);
       aMoveNodes.Add(v_new,alist);
       tabvert_corr(i) = i;
-    }    
-    structure->ReplaceNodes(aMoveNodes);
+    }
+    myStructure->ReplaceNodes(aMoveNodes);
     
     Standard_Boolean rajout;
     
-    BRepMesh_ClassifierPtr& classifier = attrib->GetClassifier();
+    BRepMesh_ClassifierPtr& classifier = theAttrib->GetClassifier();
 
     switch (thetype)
     {
@@ -241,19 +215,19 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theface,
       rajout = Standard_False;
     }  
 
-    BRepMesh_Delaun trigu(structure, tabvert_corr, orFace==TopAbs_FORWARD);
+    BRepMesh_Delaun trigu(myStructure, tabvert_corr, orFace==TopAbs_FORWARD);
     
     //removed all free edges from triangulation
-    Standard_Integer nbLinks = structure->NbNodes(); 
+    Standard_Integer nbLinks = myStructure->NbNodes(); 
     for(i = 1; i <= nbLinks; i++) 
     {
-      if(structure->ElemConnectedTo(i).Extent() < 1)
+      if(myStructure->ElemConnectedTo(i).Extent() < 1)
       {
         BRepMesh_Edge& anEdge = (BRepMesh_Edge&)trigu.GetEdge(i);
         if(anEdge.Movability()==MeshDS_Deleted)
           continue;
         anEdge.SetMovability(MeshDS_Free);
-        structure->RemoveLink(i);
+        myStructure->RemoveLink(i);
       }
     }
 
@@ -261,430 +235,311 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theface,
     isaline = ((umax-umin)<1.e-05) || ((vmax-vmin)<1.e-05);
     
     Standard_Real aDef = -1;
-    if (!isaline && structure->ElemOfDomain().Extent() > 0) {
+    if (!isaline && myStructure->ElemOfDomain().Extent() > 0) {
       TColStd_ListOfInteger badTri, nulTri;
       
       if(!rajout)
       {
-             aDef = Control(gFace, attrib->GetDefFace(), mylistver, badTri, nulTri, trigu, Standard_True);
-             if( aDef > attrib->GetDefFace() || aDef < 0.)
-               rajout = Standard_True;
+        aDef = Control(gFace, theAttrib->GetDefFace(), myListver, badTri, nulTri, trigu, Standard_True);
+        if( aDef > theAttrib->GetDefFace() || aDef < 0.)
+          rajout = Standard_True;
       }
 
       if(!rajout) {
-             if(useUVParam) {
-               if(BS.IsUClosed()) {
-                 if(myVParam.Extent() > 2) {
-                   rajout = Standard_True;
-                 }
-               }
-               if(BS.IsVClosed()) {
-                 if(myUParam.Extent() > 2) {
-                   rajout = Standard_True;
-                 }
-               }
-             }
+        if(useUVParam) {
+          if(BS.IsUClosed()) {
+            if(myVParam.Extent() > 2) {
+              rajout = Standard_True;
+            }
+          }
+          if(BS.IsVClosed()) {
+            if(myUParam.Extent() > 2) {
+              rajout = Standard_True;
+            }
+          }
+        }
       }
 
       if(rajout){
-        InternalVertices(gFace, mylistver, attrib->GetDefFace(), classifier);
-       
-             if (mylistver.Extent() > 0) {
-               BRepMesh_Array1OfVertexOfDelaun verttab(1, mylistver.Extent());
-               BRepMesh_ListIteratorOfListOfVertex itVer(mylistver);
-               ipn = 1;
-               for (; itVer.More(); itVer.Next())
-                 verttab(ipn++) = itVer.Value();
-               trigu.AddVertices(verttab);
-             }
-             //control internal points
-             BRepMesh_ListOfVertex vvlist;
-             aDef = Control(gFace, attrib->GetDefFace(), vvlist, badTri, nulTri, trigu, Standard_False);
-             mylistver.Append(vvlist);
+        InternalVertices(gFace, myListver, theAttrib->GetDefFace(), classifier);
+        
+        if (myListver.Extent() > 0) {
+          BRepMesh_Array1OfVertexOfDelaun verttab(1, myListver.Extent());
+          BRepMesh_ListIteratorOfListOfVertex itVer(myListver);
+          ipn = 1;
+          for (; itVer.More(); itVer.Next())
+            verttab(ipn++) = itVer.Value();
+          trigu.AddVertices(verttab);
+        }
+        //control internal points
+        BRepMesh_ListOfVertex vvlist;
+        aDef = Control(gFace, theAttrib->GetDefFace(), vvlist, badTri, nulTri, trigu, Standard_False);
+        myListver.Append(vvlist);
       }
     }
 
-    //modify structure back
+    //modify myStructure back
     aMoveNodes.Clear();
-    Standard_Real deltaX = myattrib->GetDeltaX();
-    Standard_Real deltaY = myattrib->GetDeltaY();
-    for (i = 1; i <= structure->NbNodes(); i++)
+    Standard_Real deltaX = myAttrib->GetDeltaX();
+    Standard_Real deltaY = myAttrib->GetDeltaY();
+    for (i = 1; i <= myStructure->NbNodes(); i++)
     {
-      const BRepMesh_Vertex& v = structure->GetNode(i);
+      const BRepMesh_Vertex& v = myStructure->GetNode(i);
       p2d = v.Coord();
       gp_XY res;
       res.SetCoord(p2d.X()*deltaX+umin,p2d.Y()*deltaY+vmin);
       BRepMesh_Vertex v_new(res,v.Location3d(),v.Movability());
-      const MeshDS_ListOfInteger& alist = structure->GetNodeList(i);
+      const MeshDS_ListOfInteger& alist = myStructure->GetNodeList(i);
       aMoveNodes.Add(v_new,alist);
     }
-    structure->ReplaceNodes(aMoveNodes);
+    myStructure->ReplaceNodes(aMoveNodes);
   
-    AddInShape(face, (aDef < 0.0)? attrib->GetDefFace() : aDef);
+    AddInShape(face, (aDef < 0.0)? theAttrib->GetDefFace() : aDef);
 #ifndef DEB_MESH
   }
   catch(Standard_Failure)
   {
     BRep_Builder B;
     Handle(Poly_Triangulation) TNull;
-    B.UpdateFace(theface,TNull);
+    B.UpdateFace(theFace,TNull);
   }
 #endif // DEB_MESH
-  structure.Nullify();
-  myattrib.Nullify();
+  myStructure.Nullify();
+  myAttrib.Nullify();
 }
 
 //=======================================================================
-//function : Update(edge)
-//purpose  :
+//function : RestoreStructureFromTriangulation(edge)
+//purpose  : Restore structure of Delaun from triangulation on face
 //=======================================================================
-Standard_Boolean BRepMesh_FastDiscretFace::Update(const TopoDS_Edge&  edge,
-                                         const TopoDS_Face&  face,
-                                          const Handle(Geom2d_Curve)& C2d,
-                                         const Standard_Real defedge,
-                                          const Standard_Real first,
-                                          const Standard_Real last)
+Standard_Boolean BRepMesh_FastDiscretFace::RestoreStructureFromTriangulation
+                               (const TopoDS_Edge&                  theEdge,
+                                const TopoDS_Face&                  theFace,
+                                const Handle(BRepAdaptor_HSurface)& theSurf,
+                                const Handle(Poly_Triangulation)&   theTrigu,
+                                const Standard_Real                 theDefEdge,
+                                const TopLoc_Location&              theLoc)
 {
-  TopLoc_Location l;
-  Handle(Poly_Triangulation) T, TNull;
-  Handle(Poly_PolygonOnTriangulation) Poly, NullPoly;
+  // oan: changes for right restoring of triangulation data from face & edges
+  Handle(Poly_PolygonOnTriangulation) Poly;
+  Poly = BRep_Tool::PolygonOnTriangulation(theEdge, theTrigu, theLoc);
 
-  Standard_Integer i = 1;
-  Standard_Boolean found = Standard_False;
-  do
+  if (Poly.IsNull() || !Poly->HasParameters())
   {
-    BRep_Tool::PolygonOnTriangulation(edge,Poly,T,l,i);
-    i++;
-    if (!found && !T.IsNull() && T->HasUVNodes() && 
-       !Poly.IsNull() && Poly->HasParameters())
-    {
-      if (Poly->Deflection() <= 1.1*defedge)
-      {
-        // 2d vertex indices
-        TopAbs_Orientation orEdge = edge.Orientation();
-        Standard_Integer iv1, iv2, ivl;
-        Standard_Integer isv1, isv, isvl;
-        
-        // Get range on 2d curve
-       Standard_Real wFirst, wLast;
-       BRep_Tool::Range(edge, face, wFirst, wLast);
-
-        // Get end points on 2d curve
-       gp_Pnt2d uvFirst, uvLast;
-       BRep_Tool::UVPoints(edge, face, uvFirst, uvLast);
-
-        // Get vertices
-       TopoDS_Vertex pBegin, pEnd;
-       TopExp::Vertices(edge,pBegin,pEnd);
-
-       const Standard_Boolean sameUV =
-          uvFirst.IsEqual(uvLast, Precision::PConfusion());
-
-       //Controle vertice tolerances
-        BRepAdaptor_Surface  BS(face, Standard_False);
-        Handle(BRepAdaptor_HSurface) gFace = new BRepAdaptor_HSurface(BS);
+    return Standard_False;
+  }
+  
+  // 2d vertex indices
+  TopAbs_Orientation orEdge = theEdge.Orientation();
+  // Get end points on 2d curve
+  gp_Pnt2d uvFirst, uvLast;
+  BRep_Tool::UVPoints(theEdge, theFace, uvFirst, uvLast);
 
+  // Get vertices
+  TopoDS_Vertex pBegin, pEnd;
+  TopExp::Vertices(theEdge,pBegin,pEnd);
 
-       gp_Pnt pFirst = gFace->Value(uvFirst.X(), uvFirst.Y());
-       gp_Pnt pLast  = gFace->Value(uvLast.X(), uvLast.Y());
-       
-       Standard_Real mindist = 10. * Max(pFirst.Distance(BRep_Tool::Pnt(pBegin)), 
-                                         pLast.Distance(BRep_Tool::Pnt(pEnd)));
+  const Standard_Boolean sameUV =
+    uvFirst.IsEqual(uvLast, Precision::PConfusion());
 
-       if (mindist < BRep_Tool::Tolerance(pBegin) ||
-           mindist < BRep_Tool::Tolerance(pEnd) ) mindist = defedge;
+  const TColgp_Array1OfPnt2d&    UVNodes = theTrigu->UVNodes();
+  const TColgp_Array1OfPnt&      Nodes   = theTrigu->Nodes();
+  const TColStd_Array1OfInteger& Indices = Poly->Nodes();
 
-       if (sameUV)
-        {
-         // 1. est-ce vraiment sameUV sans etre denegere
-         gp_Pnt2d uvF, uvL;
-         C2d->D0(first, uvF);
-         C2d->D0(last, uvL);
-         if (!uvFirst.IsEqual(uvF, Precision::PConfusion())) {
-           uvFirst = uvF;
-         }
-         if (!uvLast.IsEqual(uvL, Precision::PConfusion())) {
-           uvLast = uvL; 
-         }
-       }
-
-       const TColgp_Array1OfPnt&      Nodes   = T->Nodes();
-       const TColStd_Array1OfInteger& Indices = Poly->Nodes();
-       Handle(TColStd_HArray1OfReal)  Param   = Poly->Parameters();
-
-       const Standard_Integer nbnodes = Indices.Length();
-       TColStd_Array1OfInteger NewNodes(1, nbnodes);
-        TColStd_Array1OfInteger NewNodInStruct(1, nbnodes);
-
-        gp_Pnt P3d;
-       gp_XY theUV;
-
-        // Process first vertex
-        Standard_Integer ipf;
-       if (vertices.IsBound(pBegin))
-        {
-         ipf = vertices.Find(pBegin);
-       }
-        else
-        {
-         if (sameUV && vertices.IsBound(pEnd))
-          {
-           ipf = vertices.Find(pEnd);
-         }
-         else
-          {
-           P3d = Nodes(Indices(1));
-           if (!l.IsIdentity())
-              P3d.Transform(l.Transformation());
-            nbLocat++;
-            Location3d.Bind(nbLocat,P3d);
-           ipf = nbLocat;
-         }
-          vertices.Bind(pBegin,ipf);
-       } 
-       NewNodInStruct(1) = ipf;
-       theUV = FindUV(pBegin, uvFirst, ipf, gFace, mindist);
-       BRepMesh_Vertex vf(theUV,ipf,MeshDS_Frontier);
-        iv1 = structure->AddNode(vf);
-        isv1 = myvemap.FindIndex(iv1);
-        if (isv1 == 0) isv1 = myvemap.Add(iv1);
-       NewNodes(1) = isv1;
-
-        // Process last vertex
-        Standard_Integer ipl;
-        if (pEnd.IsSame(pBegin))
-        {
-          ipl = ipf;
-        }
-        else
-        {
-          if (vertices.IsBound(pEnd))
-          {
-            ipl = vertices.Find(pEnd);
-          }
-          else
-          {
-            if (sameUV)
-            {
-              ipl = ipf;
-              ivl = iv1;
-              isv1 = isv1;
-            }
-            else
-            {
-              nbLocat++;
-              Location3d.Bind(nbLocat,Nodes(Indices(nbnodes)).Transformed(l.Transformation()));
-              ipl = nbLocat;
-            }
-            vertices.Bind(pEnd,ipl);
-          }
-        }
-       NewNodInStruct(nbnodes) = ipl;
-       theUV = FindUV(pEnd, uvLast, ipl, gFace, mindist);
-       BRepMesh_Vertex vl(theUV,ipl,MeshDS_Frontier);
-        
-        ivl = structure->AddNode(vl);
-        isvl = myvemap.FindIndex(ivl);
-        if (isvl == 0) isvl = myvemap.Add(ivl);
-        
-       NewNodes(nbnodes) = isvl;
-       
-       gp_Pnt2d uv;
-       BRepMesh_Vertex v;
-       
-       if (BRep_Tool::SameParameter(edge))
-        {
-         for (i = 2; i < Indices.Length(); i++)
-          {
-            // Record 3d point
-           P3d = Nodes(Indices(i));
-           if (!l.IsIdentity())
-              P3d.Transform(l.Transformation());
-           nbLocat++;
-           Location3d.Bind(nbLocat, P3d);
-           NewNodInStruct(i) = nbLocat;
-            // Record 2d point
-           uv = C2d->Value(Param->Value(i));
-           v.Initialize(uv.Coord(), nbLocat, MeshDS_Frontier);
-            iv2 = structure->AddNode(v);
-            isv = myvemap.FindIndex(iv2);
-            if (isv == 0) isv = myvemap.Add(iv2);
-           NewNodes(i) = isv;
-            
-            //add links
-            if (orEdge == TopAbs_FORWARD)
-              structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(iv2,iv1,MeshDS_Frontier));
-           else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Fixed));
-           iv1 = iv2;  
-         }
-          
-          // last point
-          if (iv1 != ivl) {
-           if (orEdge == TopAbs_FORWARD)
-             structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(ivl,iv1,MeshDS_Frontier));
-           else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Fixed));
-         }
-
-          
-       }
-        else
-        {
-         const Standard_Real wFold = Param->Value(Param->Lower());
-         const Standard_Real wLold = Param->Value(Param->Upper());
+  const Standard_Integer nbnodes = Indices.Length();
+  TColStd_Array1OfInteger NewNodes(1, nbnodes);
+  
+  gp_Pnt  P3d;
+  gp_XY   anUV;
 
-         Standard_Real wKoef = 1.;
-         if ((wFold != wFirst || wLold != wLast) && wLold != wFold)
-          {
-           wKoef = (wLast - wFirst) / (wLold - wFold);
-         }
-         
-         BRepAdaptor_Curve cons(edge, face);
-         Extrema_LocateExtPC pcos;
-         pcos.Initialize(cons, cons.FirstParameter(), 
-                         cons.LastParameter(), Precision::PConfusion());
-
-         Standard_Real wPrev;
-         Standard_Real wCur      = wFirst;
-         Standard_Real wCurFound = wFirst;
-         for (i = 2; i < Indices.Length(); i++)
-          {
-            // Record 3d point
-           P3d = Nodes(Indices(i));
-           if (!l.IsIdentity())
-              P3d.Transform(l.Transformation());
-           nbLocat++;
-           Location3d.Bind(nbLocat, P3d);
-           NewNodInStruct(i) = nbLocat;
-            // Record 2d point
-           wPrev = wCur;
-           wCur  = wFirst + wKoef*(Param->Value(i) - wFold);
-            wCurFound += (wCur - wPrev);
-           pcos.Perform(P3d, wCurFound);
-           if (pcos.IsDone()) wCurFound = pcos.Point().Parameter();
-           C2d->D0(wCurFound, uv);
-           v.Initialize(uv.Coord(), nbLocat, MeshDS_Frontier);
-            iv2 = structure->AddNode(v);
-            isv = myvemap.FindIndex(iv2);
-            if (isv == 0) isv = myvemap.Add(iv2);
-           NewNodes(i) = isv;
+  // Process first vertex
+  Standard_Integer ipf;
+  if (myVertices.IsBound(pBegin))
+  {
+    ipf = myVertices.Find(pBegin);
+  }
+  else
+  {
+    if (sameUV && myVertices.IsBound(pEnd))
+    {
+      ipf = myVertices.Find(pEnd);
+    }
+    else
+    {
+      P3d = Nodes(Indices(1));
+      if (!theLoc.IsIdentity())
+        P3d.Transform(theLoc.Transformation());
+      myNbLocat++;
+      myLocation3d.Bind(myNbLocat, P3d);
+      ipf = myNbLocat;
+    }
+    myVertices.Bind(pBegin,ipf);
+  } 
+    
+ //Controle vertice tolerances
+  gp_Pnt pFirst = theSurf->Value(uvFirst.X(), uvFirst.Y());
+  gp_Pnt pLast  = theSurf->Value(uvLast.X(), uvLast.Y());
+  
+  Standard_Real mindist = 10. * Max(pFirst.Distance(BRep_Tool::Pnt(pBegin)), 
+                                    pLast.Distance(BRep_Tool::Pnt(pEnd)));
 
-            
-            //add links
-            if (orEdge == TopAbs_FORWARD)
-              structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(iv2,iv1,MeshDS_Frontier));
-           else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Fixed));
-           iv1 = iv2;              
-         }
-          
-          // last point
-          if (iv1 != ivl) {
-           if (orEdge == TopAbs_FORWARD)
-             structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Frontier));
-           else if (orEdge == TopAbs_REVERSED)
-             structure->AddLink(BRepMesh_Edge(ivl,iv1,MeshDS_Frontier));
-           else if (orEdge == TopAbs_INTERNAL)
-             structure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Fixed));
-         }
-       }
-
-       Handle(Poly_PolygonOnTriangulation) P1 =
-          new Poly_PolygonOnTriangulation(NewNodes, Param->Array1());
-       P1->Deflection(defedge);
-       if (internaledges.IsBound(edge))
-        {
-         BRepMesh_PairOfPolygon& pair = internaledges.ChangeFind(edge);
-          if (edge.Orientation() == TopAbs_REVERSED)
-            pair.Append(P1);
-          else
-            pair.Prepend(P1);
-       }
-       else
-        {
-         BRepMesh_PairOfPolygon pair1;
-         pair1.Append(P1);
-         internaledges.Bind(edge, pair1);
-       }
-
-       Handle(Poly_PolygonOnTriangulation) P2 =
-          new Poly_PolygonOnTriangulation(NewNodInStruct, Param->Array1());
-       P2->Deflection(defedge);
-       BRepMesh_PairOfPolygon pair;
-       pair.Append(P2);
-       edges.Bind(edge, pair);
-
-       found = Standard_True;
+  if (mindist < BRep_Tool::Tolerance(pBegin) ||
+      mindist < BRep_Tool::Tolerance(pEnd) ) mindist = theDefEdge;
+  
+  anUV = FindUV(pBegin, uvFirst, ipf, theSurf, mindist, myLocation2d);
+  Standard_Integer iv1, isv1;
+  BRepMesh_Vertex vf(anUV, ipf, MeshDS_Frontier);
+  iv1 = myStructure->AddNode(vf);
+  isv1 = myVemap.FindIndex(iv1);
+  if (isv1 == 0)
+    isv1 = myVemap.Add(iv1);
+  NewNodes(1) = isv1;
+
+  // Process last vertex
+  Standard_Integer ipl, ivl;
+  if (pEnd.IsSame(pBegin))
+  {
+    ipl = ipf;
+  }
+  else
+  {
+    if (myVertices.IsBound(pEnd))
+    {
+      ipl = myVertices.Find(pEnd);
+    }
+    else
+    {
+      if (sameUV)
+      {
+        ipl = ipf;
+        ivl = iv1;
       }
       else
       {
-       BRep_Builder B;
-       B.UpdateEdge(edge,NullPoly,T,l);
-       B.UpdateFace(face,TNull);
+        P3d = Nodes(Indices(nbnodes));
+        if (!theLoc.IsIdentity())
+          P3d.Transform(theLoc.Transformation());
+        myNbLocat++;
+        myLocation3d.Bind(myNbLocat, P3d);
+        ipl = myNbLocat;
       }
-    }
-    else if (!T.IsNull() && !T->HasUVNodes())
-    {
-      BRep_Builder B;
-      B.UpdateEdge(edge,NullPoly,T,l);
-      B.UpdateFace(face,TNull);
+      myVertices.Bind(pEnd,ipl);
     }
   }
-  while (!Poly.IsNull());
 
-  return found;
-}
+  anUV = FindUV(pEnd, uvLast, ipl, theSurf, mindist, myLocation2d);
+  BRepMesh_Vertex vl(anUV, ipl, MeshDS_Frontier);
+  
+  Standard_Integer isvl;
+  ivl = myStructure->AddNode(vl);
+  isvl = myVemap.FindIndex(ivl);
+  if (isvl == 0) 
+    isvl = myVemap.Add(ivl);
+  NewNodes(nbnodes) = isvl;
+      
+  BRepMesh_Vertex v;
 
+  Standard_Integer i;
+  for (i = 2; i < nbnodes; i++)
+  {
+    // Record 3d point
+    P3d = Nodes(Indices(i));
+    if (!theLoc.IsIdentity())
+      P3d.Transform(theLoc.Transformation());
+    myNbLocat++;
+    myLocation3d.Bind(myNbLocat, P3d);
+    
+    // Record 2d point
+    anUV = UVNodes(Indices(i)).Coord();
+
+    Standard_Integer iv2, isv;
+    v.Initialize(anUV, myNbLocat, MeshDS_Frontier);
+    iv2 = myStructure->AddNode(v);
+    isv = myVemap.FindIndex(iv2);
+    if (isv == 0)
+      isv = myVemap.Add(iv2);
+    NewNodes(i) = isv;
+    
+    //add links
+    if (orEdge == TopAbs_FORWARD)
+      myStructure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Frontier));
+    else if (orEdge == TopAbs_REVERSED)
+      myStructure->AddLink(BRepMesh_Edge(iv2,iv1,MeshDS_Frontier));
+    else if (orEdge == TopAbs_INTERNAL)
+      myStructure->AddLink(BRepMesh_Edge(iv1,iv2,MeshDS_Fixed));
+    iv1 = iv2;  
+  }
+  
+  // last point
+  if (iv1 != ivl) {
+    if (orEdge == TopAbs_FORWARD)
+      myStructure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Frontier));
+    else if (orEdge == TopAbs_REVERSED)
+      myStructure->AddLink(BRepMesh_Edge(ivl,iv1,MeshDS_Frontier));
+    else if (orEdge == TopAbs_INTERNAL)
+      myStructure->AddLink(BRepMesh_Edge(iv1,ivl,MeshDS_Fixed));
+  }
+  
+  Handle(Poly_PolygonOnTriangulation) P1 =
+        new Poly_PolygonOnTriangulation(NewNodes, Poly->Parameters()->Array1());
+  P1->Deflection(theDefEdge);
+  if (myInternaledges.IsBound(theEdge))
+  {
+    BRepMesh_PairOfPolygon& pair = myInternaledges.ChangeFind(theEdge);
+    if (theEdge.Orientation() == TopAbs_REVERSED)
+      pair.Append(P1);
+    else
+      pair.Prepend(P1);
+  }
+  else
+  {
+    BRepMesh_PairOfPolygon pair1;
+    pair1.Append(P1);
+    myInternaledges.Bind(theEdge, pair1);
+  }
 
+  return Standard_True;
+}
 
 //=======================================================================
 //function : InternalVertices
 //purpose  : 
 //=======================================================================
-void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurface)& caro,
-                                                  BRepMesh_ListOfVertex&              InternalV,
-                                                  const Standard_Real                 defface,
-                                                  const BRepMesh_ClassifierPtr&       classifier)
+void BRepMesh_FastDiscretFace::InternalVertices(const Handle(BRepAdaptor_HSurface)& theCaro,
+                                                BRepMesh_ListOfVertex&              theInternalV,
+                                                const Standard_Real                 theDefFace,
+                                                const BRepMesh_ClassifierPtr&       theClassifier)
 {
   BRepMesh_Vertex newV;
   gp_Pnt2d p2d;
   gp_Pnt p3d;
   
   // travail suivant le type de surface
+  const BRepAdaptor_Surface& BS = *(BRepAdaptor_Surface*)&(theCaro->Surface());
+  GeomAbs_SurfaceType thetype = theCaro->GetType();
 
+  Standard_Real umax = myAttrib->GetUMax();
+  Standard_Real umin = myAttrib->GetUMin();
+  Standard_Real vmax = myAttrib->GetVMax();
+  Standard_Real vmin = myAttrib->GetVMin();
+  Standard_Real deltaX = myAttrib->GetDeltaX();
+  Standard_Real deltaY = myAttrib->GetDeltaY();
 
-  const BRepAdaptor_Surface& BS = *(BRepAdaptor_Surface*)&(caro->Surface());
-  GeomAbs_SurfaceType thetype = caro->GetType();
-
-  Standard_Real umax = myattrib->GetUMax();
-  Standard_Real umin = myattrib->GetUMin();
-  Standard_Real vmax = myattrib->GetVMax();
-  Standard_Real vmin = myattrib->GetVMin();
-  Standard_Real deltaX = myattrib->GetDeltaX();
-  Standard_Real deltaY = myattrib->GetDeltaY();
-
-  if (thetype == GeomAbs_Plane && !classifier->NaturalRestriction())
+  if (thetype == GeomAbs_Plane && !theClassifier->NaturalRestriction())
   {
     // rajout d`un seul point au milieu.
     const Standard_Real U = 0.5*(umin+umax);
     const Standard_Real V = 0.5*(vmin+vmax);
-    if (classifier->Perform(gp_Pnt2d(U, V)) == TopAbs_IN)
+    if (theClassifier->Perform(gp_Pnt2d(U, V)) == TopAbs_IN)
     {
       // Record 3d point
-      BRepMesh_GeomTool::D0(caro, U, V, p3d);
-      nbLocat++;
-      Location3d.Bind(nbLocat, p3d);
+      BRepMesh_GeomTool::D0(theCaro, U, V, p3d);
+      myNbLocat++;
+      myLocation3d.Bind(myNbLocat, p3d);
       // Record 2d point
       p2d.SetCoord((U-umin)/deltaX, (V-vmin)/deltaY);
-      newV.Initialize(p2d.XY(), nbLocat, MeshDS_Free);
-      InternalV.Append(newV);
+      newV.Initialize(p2d.XY(), myNbLocat, MeshDS_Free);
+      theInternalV.Append(newV);
     }
   }
   else if (thetype == GeomAbs_Sphere)
@@ -693,7 +548,7 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     const Standard_Real R = S.Radius();
 
     // Calculate parameters for iteration in V direction
-    Standard_Real Dv = 1.0 - (defface/R);
+    Standard_Real Dv = 1.0 - (theDefFace/R);
     if (Dv < 0.0) Dv = 0.0;
     Standard_Real oldDv = 2.0 * ACos (Dv);
     Dv  =  .7 * oldDv; //.7 ~= sqrt(2.) - Dv is hypotenuse of triangle when oldDv is legs
@@ -719,20 +574,20 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
       const Standard_Real pasumax = umax-Du*0.5 + d;
       for (pasu = umin + Du - d; pasu < pasumax; pasu += Du)
       {
-             if (classifier->Perform(gp_Pnt2d(pasu, pasv)) == TopAbs_IN)
+        if (theClassifier->Perform(gp_Pnt2d(pasu, pasv)) == TopAbs_IN)
         {
           // Record 3d point
 #ifdef DEB_MESH_CHRONO
-         D0Internal++;
+          D0Internal++;
 #endif
-               ElSLib::D0(pasu, pasv, S, p3d);
-               nbLocat++;
-               Location3d.Bind(nbLocat, p3d);
+          ElSLib::D0(pasu, pasv, S, p3d);
+          myNbLocat++;
+          myLocation3d.Bind(myNbLocat, p3d);
           // Record 2d point
-               p2d.SetCoord((pasu-umin)/deltaX, (pasv-vmin)/deltaY);
-               newV.Initialize(p2d.XY(), nbLocat, MeshDS_Free);
-               InternalV.Append(newV);
-             }
+          p2d.SetCoord((pasu-umin)/deltaX, (pasv-vmin)/deltaY);
+          newV.Initialize(p2d.XY(), myNbLocat, MeshDS_Free);
+          theInternalV.Append(newV);
+        }
       }
     }
   }
@@ -742,10 +597,10 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     const Standard_Real R = S.Radius();
 
     // Calculate parameters for iteration in U direction
-    Standard_Real Du = 1.0 - (defface/R);
+    Standard_Real Du = 1.0 - (theDefFace/R);
     if (Du < 0.0) Du = 0.0;
     Du = 2.0 * ACos (Du);
-    if (Du > angle) Du = angle;
+    if (Du > myAngle) Du = myAngle;
     const Standard_Real su = umax - umin;
     const Standard_Integer nbU = (Standard_Integer)(su/Du);
     Du = su/(nbU+1);
@@ -759,17 +614,17 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     Standard_Real pasu, pasv, pasvmax = vmax-Dv*0.5, pasumax = umax-Du*0.5;
     for (pasv = vmin + Dv; pasv < pasvmax; pasv += Dv) {
       for (pasu = umin + Du; pasu < pasumax; pasu += Du) {
-             if (classifier->Perform(gp_Pnt2d(pasu, pasv)) == TopAbs_IN)
+        if (theClassifier->Perform(gp_Pnt2d(pasu, pasv)) == TopAbs_IN)
         {
           // Record 3d point
-               ElSLib::D0(pasu, pasv, S, p3d);
-          nbLocat++;
-          Location3d.Bind(nbLocat, p3d);
+          ElSLib::D0(pasu, pasv, S, p3d);
+          myNbLocat++;
+          myLocation3d.Bind(myNbLocat, p3d);
           // Record 2d point
-               p2d.SetCoord((pasu-umin)/deltaX, (pasv-vmin)/deltaY);
-               newV.Initialize(p2d.XY(), nbLocat, MeshDS_Free);
-          InternalV.Append(newV);
-             }
+          p2d.SetCoord((pasu-umin)/deltaX, (pasv-vmin)/deltaY);
+          newV.Initialize(p2d.XY(), myNbLocat, MeshDS_Free);
+          theInternalV.Append(newV);
+        }
       }
     }
   }
@@ -781,7 +636,7 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     SAng = C.SemiAngle();
     R = Max(Abs(RefR+vmin*Sin(SAng)), Abs(RefR+vmax*Sin(SAng)));
     Standard_Real Du, Dv, pasu, pasv;
-    Du = Max(1.0e0 - (defface/R),0.0e0);
+    Du = Max(1.0e0 - (theDefFace/R),0.0e0);
     Du  = (2.0 * ACos (Du));
     Standard_Integer nbU = (Standard_Integer) ( (umax-umin)/Du );
     Standard_Integer nbV = (Standard_Integer) ( nbU*(vmax-vmin)/((umax-umin)*R) );
@@ -791,17 +646,17 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     Standard_Real pasvmax = vmax-Dv*0.5, pasumax = umax-Du*0.5;
     for (pasv = vmin + Dv; pasv < pasvmax; pasv += Dv) {
       for (pasu = umin + Du; pasu < pasumax; pasu += Du) {
-             if (classifier->Perform(gp_Pnt2d(pasu, pasv)) == TopAbs_IN)
+        if (theClassifier->Perform(gp_Pnt2d(pasu, pasv)) == TopAbs_IN)
         {
           // Record 3d point
-               ElSLib::D0(pasu, pasv, C, p3d);
-          nbLocat++;
-          Location3d.Bind(nbLocat, p3d);
+          ElSLib::D0(pasu, pasv, C, p3d);
+          myNbLocat++;
+          myLocation3d.Bind(myNbLocat, p3d);
           // Record 2d point
           p2d.SetCoord((pasu-umin)/deltaX, (pasv-vmin)/deltaY);
-               newV.Initialize(p2d.XY(), nbLocat, MeshDS_Free);
-          InternalV.Append(newV);
-             }
+          newV.Initialize(p2d.XY(), myNbLocat, MeshDS_Free);
+          theInternalV.Append(newV);
+        }
       }
     }
   }
@@ -817,9 +672,9 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     TColStd_SequenceOfReal ParamU, ParamV;
 
     Standard_Real Du, Dv;//, pasu, pasv;
-    Dv = Max(1.0e0 - (defface/r),0.0e0) ;
+    Dv = Max(1.0e0 - (theDefFace/r),0.0e0) ;
     Standard_Real oldDv = 2.0 * ACos (Dv);
-    oldDv = Min(oldDv, angle);
+    oldDv = Min(oldDv, myAngle);
     Dv  =  0.9*oldDv; //TWOTHIRD * oldDv;
     Dv = oldDv;
     
@@ -828,8 +683,8 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     Standard_Real ru = R + r;
     if (ru > 1.e-16)
     {
-      Du  = 2.0 * ACos(Max(1.0 - (defface/ru),0.0));
-      if (angle < Du) Du = angle;
+      Du  = 2.0 * ACos(Max(1.0 - (theDefFace/ru),0.0));
+      if (myAngle < Du) Du = myAngle;
       Standard_Real aa = sqrt(Du*Du + oldDv*oldDv);
       if(aa < gp::Resolution())
         return; 
@@ -915,24 +770,24 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
       pasu = ParamU.Value(i);
       if (pasu >= uminnew && pasu < umaxnew)
       {
-             for (j = 1; j <= Lv; j++)
+        for (j = 1; j <= Lv; j++)
         {
-               pasv = ParamV.Value(j);
-               if (pasv >= vminnew && pasv < vmaxnew)
+          pasv = ParamV.Value(j);
+          if (pasv >= vminnew && pasv < vmaxnew)
           {
-                 if (classifier->Perform(gp_Pnt2d(pasu, pasv)) == TopAbs_IN)
+            if (theClassifier->Perform(gp_Pnt2d(pasu, pasv)) == TopAbs_IN)
             {
               // Record 3d point
-                   ElSLib::D0(pasu, pasv, T, p3d);
-                   nbLocat++;
-                   Location3d.Bind(nbLocat, p3d);
+              ElSLib::D0(pasu, pasv, T, p3d);
+              myNbLocat++;
+              myLocation3d.Bind(myNbLocat, p3d);
               // Record 2d point
-                   p2d.SetCoord((pasu-umin)/deltaX, (pasv-vmin)/deltaY);
-                   newV.Initialize(p2d.XY(), nbLocat, MeshDS_Free);
-                   InternalV.Append(newV);
-                 }
-               }
-             }
+              p2d.SetCoord((pasu-umin)/deltaX, (pasv-vmin)/deltaY);
+              newV.Initialize(p2d.XY(), myNbLocat, MeshDS_Free);
+              theInternalV.Append(newV);
+            }
+          }
+        }
       }
     }
   }
@@ -966,15 +821,15 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
       aSurf->VKnots(anVKnots->ChangeArray1());
     }
 
-    Standard_Real ddu = caro->UResolution(defface)*5.;
-
+    Standard_Real ddu = theCaro->UResolution(theDefFace)*5.;
     Standard_Real aDUmin = (umax-umin)/5.;
     if(ddu > aDUmin)
       ddu = aDUmin;
+
     // Sort sequence of U parameters
     TColStd_SequenceOfReal ParamU;
-    Standard_Integer anUdegree = caro->UDegree();
-     
+    Standard_Integer anUdegree = theCaro->UDegree();
+        
     Standard_Real aU1 = anUKnots->Value(1);
     for( i = 1; i < aNbUNkots; i++)
     {
@@ -982,6 +837,7 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
       Standard_Real aEnd = anUKnots->Value(i+1);
       Standard_Integer aNbPoints = anUdegree-1;
       Standard_Real aStep = (aEnd-aStart)/(aNbPoints+1);
+      
       for( Standard_Integer anInd = 0; anInd<= aNbPoints; anInd++)
       {
         Standard_Real aU2 = aStart+anInd*aStep;
@@ -995,15 +851,14 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     ParamU.Append(anUKnots->Value(aNbUNkots));
     Standard_Integer ParamULength = ParamU.Length();
 
-    Standard_Real ddv = caro->VResolution(defface)*5.;
-
+    Standard_Real ddv = theCaro->VResolution(theDefFace)*5.;
     Standard_Real aDVmin = (vmax-vmin)/5.;
     if(ddv > aDVmin)
       ddv = aDVmin;
     // Sort sequence of V parameters
     TColStd_SequenceOfReal ParamV; 
-    Standard_Integer anVdegree = caro->VDegree();
-      
+    Standard_Integer anVdegree = theCaro->VDegree();
+        
     Standard_Real aV1 = anVKnots->Value(1);
     for( i = 1; i < aNbVNkots; i++)
     {
@@ -1011,6 +866,7 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
       Standard_Real aEnd = anVKnots->Value(i+1);
       Standard_Integer aNbPoints = anVdegree-1;
       Standard_Real aStep = (aEnd-aStart)/(aNbPoints+1);
+      
       for( Standard_Integer anInd = 0; anInd<= aNbPoints; anInd++)
       {
         Standard_Real aV2 = aStart+anInd*aStep;
@@ -1041,16 +897,16 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
         V2 = ParamV.Value(j);
         P2 = IsoU->Value(V2);
         v = 0.5*(V1+V2);
-             PControl = IsoU->Value(v);
+        PControl = IsoU->Value(v);
         // 23.03.2010 skl for OCC21645 - change precision for comparison
         if( P1.SquareDistance(P2) > dPreci ) {
           gp_Lin L (P1, gp_Dir(gp_Vec(P1, P2)));
           dist = L.Distance(PControl);
         }
-             else {
+        else {
           dist = P1.Distance(PControl);
         }
-        if (dist > defface) {
+        if (dist > theDefFace) {
           // insertion 
           ParamV.InsertBefore(j, v);
           ParamVLength++;
@@ -1059,7 +915,7 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
           V1 = V2;
           P1 = P2;
           j++;
-             }
+        }
       }
     }
 
@@ -1070,9 +926,9 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
       P1 = IsoV->Value(U1);
       for (j = 2; j <= ParamULength;) {
         U2 = ParamU.Value(j);
-             P2 = IsoV->Value(U2);
-             u = 0.5*(U1+U2);
-             PControl = IsoV->Value(u);
+        P2 = IsoV->Value(U2);
+        u = 0.5*(U1+U2);
+        PControl = IsoV->Value(u);
         // 23.03.2010 skl for OCC21645 - change precision for comparison
         if( P1.SquareDistance(P2) > dPreci ) {
           gp_Lin L (P1, gp_Dir(gp_Vec(P1, P2)));
@@ -1081,7 +937,7 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
         else {
           dist = P1.Distance(PControl);
         }
-        if (dist > defface) {
+        if (dist > theDefFace) {
           // insertion 
           ParamU.InsertBefore(j, u);
           ParamULength++;
@@ -1092,24 +948,24 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
           P1 = P2;
           if (j < ParamULength) {
             // Classify intersection point
-            if (classifier->Perform(gp_Pnt2d(U1, v)) == TopAbs_IN)
+            if (theClassifier->Perform(gp_Pnt2d(U1, v)) == TopAbs_IN)
             {
               // Record 3d point
-              nbLocat++;
-              Location3d.Bind(nbLocat, P1);
+              myNbLocat++;
+              myLocation3d.Bind(myNbLocat, P1);
               // Record 2d point
               p2d.SetCoord((U1-umin)/deltaX, (v-vmin)/deltaY);
-              newV.Initialize(p2d.XY(), nbLocat, MeshDS_Free);
-              InternalV.Append(newV);
+              newV.Initialize(p2d.XY(), myNbLocat, MeshDS_Free);
+              theInternalV.Append(newV);
             }
           }
           j++;
-             }
+        }
       }
     }
   }
   else {
-    const Standard_Real theangle = 0.35;
+    const Standard_Real anAngle = 0.35;
 
     Standard_Integer i, j, nbpointsU = 10, nbpointsV = 10;
     Adaptor3d_IsoCurve tabu[10], tabv[10];
@@ -1123,13 +979,13 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
 
     for (iu = 1; iu <= nbpointsU; iu++) {
       u = umin + iu*du;
-      tabu[iu-1].Load(caro);
+      tabu[iu-1].Load(theCaro);
       tabu[iu-1].Load(GeomAbs_IsoU, u);
     }
 
     for (iv = 1; iv <= nbpointsV; iv++) {
       v = vmin + iv*dv;
-      tabv[iv-1].Load(caro);
+      tabv[iv-1].Load(theCaro);
       tabv[iv-1].Load(GeomAbs_IsoV, v);
     }
 
@@ -1140,11 +996,11 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     for (i = 0; i <= nbpointsU-1; i++) {
       f = Max(vmin, tabu[i].FirstParameter());
       l = Min(vmax, tabu[i].LastParameter());
-      GCPnts_TangentialDeflection theDeflection(tabu[i], f, l, theangle, 0.7*defface, 2);
+      GCPnts_TangentialDeflection theDeflection(tabu[i], f, l, anAngle, 0.7*theDefFace, 2);
       tabGU[i] = theDeflection;
       if (tabGU[i].NbPoints() > MaxV) {
-             MaxV = tabGU[i].NbPoints();
-             imax = i;
+        MaxV = tabGU[i].NbPoints();
+        imax = i;
       }
     }
     
@@ -1163,11 +1019,11 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     for (i = 0; i <= nbpointsV-1; i++) {
       f = Max(umin, tabv[i].FirstParameter());
       l = Min(umax, tabv[i].LastParameter());
-      GCPnts_TangentialDeflection thedeflection2(tabv[i], f, l, theangle, 0.7*defface, 2);
+      GCPnts_TangentialDeflection thedeflection2(tabv[i], f, l, anAngle, 0.7*theDefFace, 2);
       tabGV[i] = thedeflection2;
       if (tabGV[i].NbPoints() > MaxU) {
-             MaxU = tabGV[i].NbPoints();
-             imax = i;
+        MaxU = tabGV[i].NbPoints();
+        imax = i;
       }
     }
     
@@ -1189,7 +1045,7 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
     gp_Pnt P1;
 
     Adaptor3d_IsoCurve IsoV;
-    IsoV.Load(caro);
+    IsoV.Load(theCaro);
 
     Standard_Integer Lu = ParamU.Length(), Lv = ParamV.Length();
     
@@ -1197,18 +1053,18 @@ void BRepMesh_FastDiscretFace::InternalVertices ( const Handle(BRepAdaptor_HSurf
       v = ParamV.Value(i);
       IsoV.Load(GeomAbs_IsoV, v);
       for (j = 2; j < Lu; j++) {
-             u = ParamU.Value(j);
-             if (classifier->Perform(gp_Pnt2d(u, v)) == TopAbs_IN)
+        u = ParamU.Value(j);
+        if (theClassifier->Perform(gp_Pnt2d(u, v)) == TopAbs_IN)
         {
           // Record 3d point
-               P1 = IsoV.Value(u);
-               nbLocat++;
-          Location3d.Bind(nbLocat, P1);
+          P1 = IsoV.Value(u);
+          myNbLocat++;
+          myLocation3d.Bind(myNbLocat, P1);
           // Record 2d point
-               p2d.SetCoord((u-umin)/deltaX, (v-vmin)/deltaY);
-               newV.Initialize(p2d.XY(), nbLocat, MeshDS_Free);
-               InternalV.Append(newV); 
-             }
+          p2d.SetCoord((u-umin)/deltaX, (v-vmin)/deltaY);
+          newV.Initialize(p2d.XY(), myNbLocat, MeshDS_Free);
+          theInternalV.Append(newV); 
+        }
       }
     } 
   }
@@ -1226,7 +1082,7 @@ class BRepMesh_Couple
  public:
   BRepMesh_Couple() { myI1 = myI2 = 0; }
   BRepMesh_Couple(const Standard_Integer I1,
-                 const Standard_Integer I2)
+                  const Standard_Integer I2)
   { myI1 = I1; myI2 = I2; }
 
   Standard_Integer myI1;
@@ -1253,31 +1109,29 @@ typedef NCollection_Map<BRepMesh_Couple> BRepMesh_MapOfCouple;
 //function : Control
 //purpose  : 
 //=======================================================================
-Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurface)& caro,
-                                                 const Standard_Real                 defface,
-                                                 BRepMesh_ListOfVertex&              InternalV,
-                                                 TColStd_ListOfInteger&              badTriangles,
-                                                 TColStd_ListOfInteger&              nulTriangles,
-                                                 BRepMesh_Delaun&                    trigu,
-                                                 const Standard_Boolean              isfirst)
+Standard_Real BRepMesh_FastDiscretFace::Control(const Handle(BRepAdaptor_HSurface)& theCaro,
+                                                const Standard_Real                 theDefFace,
+                                                BRepMesh_ListOfVertex&              theInternalV,
+                                                TColStd_ListOfInteger&              theBadTriangles,
+                                                TColStd_ListOfInteger&              theNulTriangles,
+                                                BRepMesh_Delaun&                    theTrigu,
+                                                const Standard_Boolean              theIsFirst)
 {
   //IMPORTANT: Constants used in calculations
   const Standard_Real MinimalArea2d = 1.e-9;
   const Standard_Real MinimalSqLength3d = 1.e-12;
-  const Standard_Real aDef2 = defface*defface;
+  const Standard_Real aDef2 = theDefFace*theDefFace;
 
   // Define the number of iterations
   Standard_Integer myNbIterations = 11;
-  const Standard_Integer nbPasses = (isfirst? 1 : myNbIterations);
+  const Standard_Integer nbPasses = (theIsFirst? 1 : myNbIterations);
 
   // Initialize stop condition
   Standard_Boolean allDegenerated = Standard_False;
   Standard_Integer nbInserted = 1;
 
   // Create map of links to skip already processed
-  Standard_Integer nbtriangles;
-
-  nbtriangles = structure->ElemOfDomain().Extent();
+  Standard_Integer nbtriangles = myStructure->ElemOfDomain().Extent();
   if (nbtriangles <= 0) return -1.0;
   BRepMesh_MapOfCouple theCouples(3*nbtriangles);
 
@@ -1286,36 +1140,33 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
   gp_Pnt pDef;
   Standard_Real dv = 0, defl = 0, maxdef = -1;
   Standard_Integer pass = 1, nf = 0, nl = 0;
-  Standard_Integer v1, v2, v3, e1, e2, e3;
-  Standard_Boolean o1, o2, o3;
-  Standard_Boolean m1, m2, m3;
   BRepMesh_Vertex InsVertex;
   Standard_Boolean caninsert;
 
-  Standard_Real sqdefface = defface * defface;
-  Standard_Real ddu = caro->UResolution(defface);
-  Standard_Real ddv = caro->VResolution(defface);
+  Standard_Real sqdefface = theDefFace * theDefFace;
+  Standard_Real ddu = theCaro->UResolution(theDefFace);
+  Standard_Real ddv = theCaro->VResolution(theDefFace);
 
-  GeomAbs_SurfaceType thetype = caro->GetType();
+  GeomAbs_SurfaceType thetype = theCaro->GetType();
   Handle(Geom_Surface) BSpl;
   Standard_Boolean isSpline = Standard_False;
   if (thetype == GeomAbs_BezierSurface || thetype == GeomAbs_BSplineSurface)
   {
     isSpline = Standard_True;
     if (thetype == GeomAbs_BezierSurface) 
-      BSpl = caro->Bezier();
+      BSpl = theCaro->Bezier();
     else 
-      BSpl = caro->BSpline();
+      BSpl = theCaro->BSpline();
   }
-  
+
   NCollection_DataMap<Standard_Integer,gp_Dir> aNorMap;
   NCollection_DataMap<Standard_Integer,Standard_Integer> aStatMap;
 
   // Perform refinement passes
   for (; pass <= nbPasses && nbInserted && !allDegenerated; pass++)
   {
-    InternalV.Clear();
-    badTriangles.Clear();
+    theInternalV.Clear();
+    theBadTriangles.Clear();
     
     // Reset stop condition
     allDegenerated = Standard_True;
@@ -1323,26 +1174,27 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
     maxdef = -1.0;
 
     // Do not insert nodes in last pass in non-SharedMode
-    caninsert = (WithShare || pass < nbPasses);
+    caninsert = (myWithShare || pass < nbPasses);
 
     // Read mesh size
-    nbtriangles = structure->ElemOfDomain().Extent();
+    nbtriangles = myStructure->ElemOfDomain().Extent();
     if (nbtriangles <= 0) break;
 
     // Iterate on current triangles
     MeshDS_MapOfInteger::Iterator triDom;
-    const MeshDS_MapOfInteger& TriMap = structure->ElemOfDomain();
+    const MeshDS_MapOfInteger& TriMap = myStructure->ElemOfDomain();
     triDom.Initialize(TriMap);
     Standard_Integer aNbPnt = 0;
-    Standard_Real umin = myattrib->GetUMin();
-    Standard_Real vmin = myattrib->GetVMin();
-    Standard_Real deltaX = myattrib->GetDeltaX();
-    Standard_Real deltaY = myattrib->GetDeltaY();
+    Standard_Real umin = myAttrib->GetUMin();
+    Standard_Real vmin = myAttrib->GetVMin();
+    Standard_Real deltaX = myAttrib->GetDeltaX();
+    Standard_Real deltaY = myAttrib->GetDeltaY();
     for (; triDom.More(); triDom.Next())
     {
       Standard_Integer TriId = triDom.Key();
       const BRepMesh_Triangle& curTri=Triangle(TriId);
       if (curTri.Movability()==MeshDS_Deleted) continue;
+      
       Standard_Boolean o1, o2, o3;
       Standard_Integer v1 = 0, v2 = 0, v3 = 0, e1 = 0, e2 = 0, e3 = 0;
       curTri.Edges(e1, e2, e3, o1, o2, o3);
@@ -1355,25 +1207,25 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
       Standard_Boolean m2 = (edg2.Movability() == MeshDS_Frontier);
       Standard_Boolean m3 = (edg3.Movability() == MeshDS_Frontier);
       if (o1) {
-             v1=edg1.FirstNode();
-             v2=edg1.LastNode();
+        v1=edg1.FirstNode();
+        v2=edg1.LastNode();
       }
       else {
-             v1=edg1.LastNode();
-             v2=edg1.FirstNode();
+        v1=edg1.LastNode();
+        v2=edg1.FirstNode();
       }
       if (o2)
-             v3=edg2.LastNode();
+        v3=edg2.LastNode();
       else
-             v3=edg2.FirstNode();
+        v3=edg2.FirstNode();
 
       const BRepMesh_Vertex& vert1=Vertex(v1);
       const BRepMesh_Vertex& vert2=Vertex(v2);
       const BRepMesh_Vertex& vert3=Vertex(v3);
 
-      const gp_XYZ& p1=Location3d(vert1.Location3d()).Coord();
-      const gp_XYZ& p2=Location3d(vert2.Location3d()).Coord();
-      const gp_XYZ& p3=Location3d(vert3.Location3d()).Coord();
+      const gp_XYZ& p1=myLocation3d(vert1.Location3d()).Coord();
+      const gp_XYZ& p2=myLocation3d(vert2.Location3d()).Coord();
+      const gp_XYZ& p3=myLocation3d(vert3.Location3d()).Coord();
 
       vecEd1 = p2 - p1;
       vecEd2 = p3 - p2;
@@ -1384,7 +1236,7 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
           vecEd2.SquareModulus() < MinimalSqLength3d ||
           vecEd3.SquareModulus() < MinimalSqLength3d) 
       {
-        nulTriangles.Append(TriId);
+        theNulTriangles.Append(TriId);
         continue;
       }
 
@@ -1397,7 +1249,7 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
       // Check triangle area in 2d
       if (Abs((xy2-xy1)^(xy3-xy1)) < MinimalArea2d)
       {
-               nulTriangles.Append(TriId);
+        theNulTriangles.Append(TriId);
         continue;
       }
 
@@ -1406,30 +1258,30 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
       dv = normal.Modulus();
       if (dv < Precision::Confusion())
       {
-               nulTriangles.Append(TriId);
+        theNulTriangles.Append(TriId);
         continue;
       }
       normal /= dv;
 
       // Check deflection on triangle
       mi2d = (xy1+xy2+xy3)/3.0;
-      caro->D0(mi2d.X(), mi2d.Y(), pDef);
+      theCaro->D0(mi2d.X(), mi2d.Y(), pDef);
       defl = pDef.SquareDistance((p1+p2+p3)/3.);
       if (defl > maxdef) maxdef = defl;
       if (defl > sqdefface)
       {
-        if (isfirst) break;
+        if (theIsFirst) break;
         if (caninsert)
         {
           // Record new vertex
           aNbPnt++;
-          nbLocat++;
-          Location3d.Bind(nbLocat,pDef);
+          myNbLocat++;
+          myLocation3d.Bind(myNbLocat,pDef);
           mi2d.SetCoord((mi2d.X()-umin)/deltaX,(mi2d.Y()-vmin)/deltaY);
-          InsVertex.Initialize(mi2d,nbLocat,MeshDS_Free);
-          InternalV.Append(InsVertex);
+          InsVertex.Initialize(mi2d,myNbLocat,MeshDS_Free);
+          theInternalV.Append(InsVertex);
         }
-        badTriangles.Append(TriId);
+        theBadTriangles.Append(TriId);
       }
       
       if (!m2) // Not a boundary
@@ -1440,23 +1292,23 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
         {
           // Check deflection on edge 1
           mi2d = (xy2+xy3)*0.5;
-          caro->D0(mi2d.X(), mi2d.Y(), pDef);
+          theCaro->D0(mi2d.X(), mi2d.Y(), pDef);
           defl = pDef.SquareDistance((p2+p3)/2.);
           if (defl > maxdef) maxdef = defl;
           if (defl > sqdefface)
           {
-            if (isfirst) break;
+            if (theIsFirst) break;
             if (caninsert)
             {
               // Record new vertex
               aNbPnt++;              
-              nbLocat++;
-              Location3d.Bind(nbLocat,pDef);
+              myNbLocat++;
+              myLocation3d.Bind(myNbLocat,pDef);
               mi2d.SetCoord((mi2d.X()-umin)/deltaX,(mi2d.Y()-vmin)/deltaY);
-              InsVertex.Initialize(mi2d,nbLocat,MeshDS_Free);
-              InternalV.Append(InsVertex);
+              InsVertex.Initialize(mi2d,myNbLocat,MeshDS_Free);
+              theInternalV.Append(InsVertex);
             }
-            badTriangles.Append(TriId);
+            theBadTriangles.Append(TriId);
           }
         }
       }
@@ -1469,23 +1321,23 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
         {
           // Check deflection on edge 2
           mi2d = (xy3+xy1)*0.5;
-          caro->D0(mi2d.X(), mi2d.Y(), pDef);
+          theCaro->D0(mi2d.X(), mi2d.Y(), pDef);
           defl = pDef.SquareDistance((p1+p3)/2.);
           if (defl > maxdef) maxdef = defl;
           if (defl > sqdefface)
           {
-            if (isfirst) break;
+            if (theIsFirst) break;
             if (caninsert)
             {
               // Record new vertex
               aNbPnt++;
-              nbLocat++;
-              Location3d.Bind(nbLocat,pDef);
+              myNbLocat++;
+              myLocation3d.Bind(myNbLocat,pDef);
               mi2d.SetCoord((mi2d.X()-umin)/deltaX,(mi2d.Y()-vmin)/deltaY);
-              InsVertex.Initialize(mi2d,nbLocat,MeshDS_Free);
-              InternalV.Append(InsVertex);
+              InsVertex.Initialize(mi2d,myNbLocat,MeshDS_Free);
+              theInternalV.Append(InsVertex);
             }
-            badTriangles.Append(TriId);
+            theBadTriangles.Append(TriId);
           }
         }
       }
@@ -1498,31 +1350,31 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
         {
           // Check deflection on edge 3
           mi2d = (xy1+xy2)*0.5;
-          caro->D0(mi2d.X(), mi2d.Y(), pDef);
+          theCaro->D0(mi2d.X(), mi2d.Y(), pDef);
           defl = pDef.SquareDistance((p1+p2)/2.);
           if (defl > maxdef) maxdef = defl;
           if (defl > sqdefface)
           {
-            if (isfirst) break;
+            if (theIsFirst) break;
             if (caninsert)
             {
               // Record new vertex
               aNbPnt++;
-              nbLocat++;
-              Location3d.Bind(nbLocat,pDef);
+              myNbLocat++;
+              myLocation3d.Bind(myNbLocat,pDef);
               mi2d.SetCoord((mi2d.X()-umin)/deltaX,(mi2d.Y()-vmin)/deltaY);              
-              InsVertex.Initialize(mi2d,nbLocat,MeshDS_Free);
-              InternalV.Append(InsVertex);
+              InsVertex.Initialize(mi2d,myNbLocat,MeshDS_Free);
+              theInternalV.Append(InsVertex);
             }
-            badTriangles.Append(TriId);
+            theBadTriangles.Append(TriId);
           }
         }
       }
       
       //check normal
-      if(isSpline && !BSpl.IsNull() && (badTriangles.IsEmpty() || badTriangles.Last() != TriId))      
+      if(isSpline && !BSpl.IsNull() && (theBadTriangles.IsEmpty() || theBadTriangles.Last() != TriId))
       {
-             gp_Dir N1(0,0,1), N2(0,0,1), N3(0,0,1);
+        gp_Dir N1(0,0,1), N2(0,0,1), N3(0,0,1);
         Standard_Integer aSt1, aSt2, aSt3;
         if(aNorMap.IsBound(v1)) {
           aSt1 = aStatMap.Find(v1);
@@ -1553,32 +1405,34 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
           aStatMap.Bind(v3,aSt3);
           aNorMap.Bind(v3,N3.XYZ());
         }
-              
-             Standard_Real anAngle1 = N2.Angle(N1);
+        
+        Standard_Real anAngle1 = N2.Angle(N1);
         Standard_Real anAngle2 = N3.Angle(N2);
         Standard_Real anAngle3 = N1.Angle(N3);
-             if(aSt1 < 1 && aSt2 < 1 && aSt3 < 1 && 
-          (anAngle1 > angle || anAngle2 > angle || anAngle3 > angle)) {
-           if (isfirst) {
+        if(aSt1 < 1 && aSt2 < 1 && aSt3 < 1 && 
+            (anAngle1 > myAngle || anAngle2 > myAngle || anAngle3 > myAngle)) {
+
+          if (theIsFirst) {
             maxdef = -1;
             break;
           }
-          // Record new vertex
+          // Record new vertex        
           aNbPnt++;
-          nbLocat++;
+          myNbLocat++;
           mi2d = (xy1+xy2+xy3)/3.;
-          caro->D0(mi2d.X(), mi2d.Y(), pDef);
-          Location3d.Bind(nbLocat,pDef);
+          theCaro->D0(mi2d.X(), mi2d.Y(), pDef);
+          myLocation3d.Bind(myNbLocat,pDef);
           mi2d.SetCoord((mi2d.X()-umin)/deltaX,(mi2d.Y()-vmin)/deltaY);              
-          InsVertex.Initialize(mi2d,nbLocat,MeshDS_Free);
-          InternalV.Append(InsVertex);
-          badTriangles.Append(TriId);
-             }   
+          InsVertex.Initialize(mi2d,myNbLocat,MeshDS_Free);
+          theInternalV.Append(InsVertex);
+          theBadTriangles.Append(TriId);
+        }   
       
         //In case if triangle is considerd as OK, we have to check three intermediate 
         //points to be sure that we free from wave effect. If it is OK triangle passed if not split in middle point
-        if(badTriangles.IsEmpty() || badTriangles.Last() != TriId)
+        if(theBadTriangles.IsEmpty() || theBadTriangles.Last() != TriId)
         {
+
           Bnd_Box2d aB2d;
           aB2d.Add(gp_Pnt2d(xy1)); aB2d.Add(gp_Pnt2d(xy2)); aB2d.Add(gp_Pnt2d(xy3));
 
@@ -1587,7 +1441,7 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
 
           if(aXMax1 - aXMin1 < ddu && aYMax1 - aYMin1 < ddv)
             continue;
-          
+
           mi2d = (xy1+xy2+xy3)/3.;
           gp_Pnt2d aP[3] = {mi2d+(xy1-mi2d)*2/3., mi2d+(xy2-mi2d)*2/3, mi2d+(xy3-mi2d)*2/3.};
           gp_Dir midDir(0,0,1);
@@ -1603,45 +1457,42 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
             anAngle[i] = dir.Angle(midDir);
           }
           
-          caro->D0(mi2d.X(), mi2d.Y(), pDef);
-
+          theCaro->D0(mi2d.X(), mi2d.Y(), pDef);
           aB2d.Add(gp_Pnt2d(xy1)); aB2d.Add(gp_Pnt2d(xy2)); aB2d.Add(gp_Pnt2d(xy3));
-          
           if(aSt[0] < 1 && aSt[1] < 1 && aSt[2] < 1 && aSt[3] < 1 &&
-            (anAngle[0] > angle || anAngle[1] > angle || anAngle[2] > angle) &&
+            (anAngle[0] > myAngle || anAngle[1] > myAngle || anAngle[2] > myAngle) &&
             (aXMax1 - aXMin1 > ddu || aYMax1 - aYMin1 > ddv))
           {
-            if (isfirst) {
+            if (theIsFirst) {
               maxdef = -1;
               break;
             }
             aNbPnt++;
-            nbLocat++;
-            caro->D0(mi2d.X(), mi2d.Y(), pDef);
-            Location3d.Bind(nbLocat,pDef);
+            myNbLocat++;
+            theCaro->D0(mi2d.X(), mi2d.Y(), pDef);
+            myLocation3d.Bind(myNbLocat,pDef);
             mi2d.SetCoord((mi2d.X()-umin)/deltaX,(mi2d.Y()-vmin)/deltaY);              
-            InsVertex.Initialize(mi2d,nbLocat,MeshDS_Free);
-            InternalV.Append(InsVertex);            
-            badTriangles.Append(TriId);
+            InsVertex.Initialize(mi2d,myNbLocat,MeshDS_Free);
+            theInternalV.Append(InsVertex);            
+            theBadTriangles.Append(TriId);
           }
         }
       }
     }
     
-    if (!isfirst && InternalV.Extent() > 0) 
+    if (!theIsFirst && theInternalV.Extent() > 0) 
     {
-      BRepMesh_Array1OfVertexOfDelaun verttab(1, InternalV.Extent());
-      BRepMesh_ListIteratorOfListOfVertex itVer(InternalV);
+      BRepMesh_Array1OfVertexOfDelaun verttab(1, theInternalV.Extent());
+      BRepMesh_ListIteratorOfListOfVertex itVer(theInternalV);
       Standard_Integer ipn = 1;
       for (; itVer.More(); itVer.Next())
         verttab(ipn++) = itVer.Value();
         
-      trigu.AddVertices(verttab);
+      theTrigu.AddVertices(verttab);
       nbInserted++;
     }
   }
-
-   if (maxdef < 0)
+  if (maxdef < 0)
     return maxdef;
   return Sqrt(maxdef);
 }
@@ -1650,16 +1501,16 @@ Standard_Real BRepMesh_FastDiscretFace::Control (const Handle(BRepAdaptor_HSurfa
 //function : AddInShape
 //purpose  : 
 //=======================================================================
-void BRepMesh_FastDiscretFace::AddInShape(const TopoDS_Face&  face,
-                                         const Standard_Real defface)
+void BRepMesh_FastDiscretFace::AddInShape(const TopoDS_Face&  theFace,
+                                          const Standard_Real theDefFace)
 {
 //  gp_Pnt Pt;
   BRep_Builder B;
-  TopLoc_Location loc = face.Location();
-  Handle(Poly_Triangulation) TOld = BRep_Tool::Triangulation(face, loc);
+  TopLoc_Location loc = theFace.Location();
+  Handle(Poly_Triangulation) TOld = BRep_Tool::Triangulation(theFace, loc);
   Handle(Poly_Triangulation) TNull;
   Handle(Poly_PolygonOnTriangulation) NullPoly;
-  B.UpdateFace(face,TNull);
+  B.UpdateFace(theFace,TNull);
 
   try{
   MeshDS_MapOfInteger::Iterator it;
@@ -1668,9 +1519,9 @@ void BRepMesh_FastDiscretFace::AddInShape(const TopoDS_Face&  face,
   Standard_Integer v1, v2, v3, iv1, iv2, iv3;
   Standard_Integer i, index;
   Standard_Boolean o1, o2, o3;
-  TopAbs_Orientation orFace = face.Orientation();
+  TopAbs_Orientation orFace = theFace.Orientation();
 
-  const MeshDS_MapOfInteger& TriMap = structure->ElemOfDomain();
+  const MeshDS_MapOfInteger& TriMap = myStructure->ElemOfDomain();
   it.Initialize(TriMap);
     
   nTri = TriMap.Extent();
@@ -1682,41 +1533,41 @@ void BRepMesh_FastDiscretFace::AddInShape(const TopoDS_Face&  face,
     i = 1;
     
     for (; it.More(); it.Next()) {
-      structure->GetElement(it.Key()).Edges(e1, e2, e3, o1, o2, o3);
+      myStructure->GetElement(it.Key()).Edges(e1, e2, e3, o1, o2, o3);
       
-      const BRepMesh_Edge& ve1=structure->GetLink(e1);
-      const BRepMesh_Edge& ve2=structure->GetLink(e2);
-      const BRepMesh_Edge& ve3=structure->GetLink(e3);
+      const BRepMesh_Edge& ve1=myStructure->GetLink(e1);
+      const BRepMesh_Edge& ve2=myStructure->GetLink(e2);
+      const BRepMesh_Edge& ve3=myStructure->GetLink(e3);
       
       if (o1) {
-             v1=ve1.FirstNode();
+        v1=ve1.FirstNode();
       }
       else {
-             v1=ve1.LastNode();
+        v1=ve1.LastNode();
       }
       if (o2)
       {
         v2=ve2.FirstNode();
-             v3=ve2.LastNode();
+        v3=ve2.LastNode();
       }
       else
       {
-             v3=ve2.FirstNode();
-       v2=ve2.LastNode();
+        v3=ve2.FirstNode();
+        v2=ve2.LastNode();
       }
       
-      iv1 = myvemap.FindIndex(v1);
-      if (iv1 == 0) iv1 = myvemap.Add(v1);
-      iv2 = myvemap.FindIndex(v2);
-      if (iv2 == 0) iv2 = myvemap.Add(v2);
-      iv3 = myvemap.FindIndex(v3);
-      if (iv3 == 0) iv3 = myvemap.Add(v3);
+      iv1 = myVemap.FindIndex(v1);
+      if (iv1 == 0) iv1 = myVemap.Add(v1);
+      iv2 = myVemap.FindIndex(v2);
+      if (iv2 == 0) iv2 = myVemap.Add(v2);
+      iv3 = myVemap.FindIndex(v3);
+      if (iv3 == 0) iv3 = myVemap.Add(v3);
       
       if (orFace == TopAbs_REVERSED) Tri(i++).Set(iv1, iv3, iv2);
       else Tri(i++).Set(iv1, iv2, iv3);
     }
     
-    Standard_Integer nbVertices = myvemap.Extent();
+    Standard_Integer nbVertices = myVemap.Extent();
     Handle(Poly_Triangulation) T = new Poly_Triangulation(nbVertices, nTri, Standard_True);
     Poly_Array1OfTriangle& Trian = T->ChangeTriangles();
     Trian = Tri;
@@ -1724,45 +1575,45 @@ void BRepMesh_FastDiscretFace::AddInShape(const TopoDS_Face&  face,
     TColgp_Array1OfPnt2d& Nodes2d = T->ChangeUVNodes();
     
     for (i = 1; i <= nbVertices; i++) {
-      index = myvemap.FindKey(i);
+      index = myVemap.FindKey(i);
       Nodes(i) = Pnt(index);
       Nodes2d(i).SetXY(Vertex(index).Coord());
     }
     
-    T->Deflection(defface);
+    T->Deflection(theDefFace);
     
     // stockage de la triangulation dans la BRep.
     BRep_Builder B1;
-    //TopLoc_Location loc = face.Location();
+    //TopLoc_Location loc = theFace.Location();
     if (!loc.IsIdentity()) {
       gp_Trsf tr = loc.Transformation();
       tr.Invert();
       for (i = Nodes.Lower(); i <= Nodes.Upper(); i++) 
-             Nodes(i).Transform(tr);
+        Nodes(i).Transform(tr);
     }
-    B1.UpdateFace(face, T);
+    B1.UpdateFace(theFace, T);
 
     // mise en place des polygones sur triangulation dans la face:
-    BRepMesh_DataMapIteratorOfDataMapOfShapePairOfPolygon It(internaledges);
+    BRepMesh_DataMapIteratorOfDataMapOfShapePairOfPolygon It(myInternaledges);
 
     for (; It.More(); It.Next()) {
       const BRepMesh_PairOfPolygon& pair = It.Value();
       const Handle(Poly_PolygonOnTriangulation)& NOD1 = pair.First();
       const Handle(Poly_PolygonOnTriangulation)& NOD2 = pair.Last();
       if ( NOD1 == NOD2 ) {
-             B.UpdateEdge(TopoDS::Edge(It.Key()), NullPoly, TOld,loc);
-             B.UpdateEdge(TopoDS::Edge(It.Key()), NOD1, T, loc);
+        B.UpdateEdge(TopoDS::Edge(It.Key()), NullPoly, TOld,loc);
+        B.UpdateEdge(TopoDS::Edge(It.Key()), NOD1, T, loc);
       }
       else {
-             B.UpdateEdge(TopoDS::Edge(It.Key()), NullPoly,   TOld,loc);
-             B.UpdateEdge(TopoDS::Edge(It.Key()), NOD1, NOD2, T, loc);
+        B.UpdateEdge(TopoDS::Edge(It.Key()), NullPoly,   TOld,loc);
+        B.UpdateEdge(TopoDS::Edge(It.Key()), NOD1, NOD2, T, loc);
       }
     }
   }
  }
  catch(Standard_Failure)
  {
-   //   MESH_FAILURE(face);
+   //   MESH_FAILURE(theFace);
  }
 }
 
@@ -1772,10 +1623,9 @@ void BRepMesh_FastDiscretFace::AddInShape(const TopoDS_Face&  face,
 //purpose  : 
 //=======================================================================
 
-const BRepMesh_Triangle& BRepMesh_FastDiscretFace::Triangle
-  (const Standard_Integer Index) const
+const BRepMesh_Triangle& BRepMesh_FastDiscretFace::Triangle(const Standard_Integer Index) const
 {
-  return structure->GetElement(Index);
+  return myStructure->GetElement(Index);
 }
 
 //=======================================================================
@@ -1785,7 +1635,7 @@ const BRepMesh_Triangle& BRepMesh_FastDiscretFace::Triangle
 
 /*Standard_Integer BRepMesh_FastDiscretFace::NbEdges() const
 {
-  return structure->NbLinks();
+  return myStructure->NbLinks();
 }*/
 
 //=======================================================================
@@ -1795,7 +1645,7 @@ const BRepMesh_Triangle& BRepMesh_FastDiscretFace::Triangle
 
 const BRepMesh_Edge& BRepMesh_FastDiscretFace::Edge(const Standard_Integer Index) const
 {
-  return structure->GetLink(Index);
+  return myStructure->GetLink(Index);
 }
 
 
@@ -1804,10 +1654,9 @@ const BRepMesh_Edge& BRepMesh_FastDiscretFace::Edge(const Standard_Integer Index
 //purpose  : 
 //=======================================================================
 
-const BRepMesh_Vertex& BRepMesh_FastDiscretFace::Vertex
-  (const Standard_Integer Index) const
+const BRepMesh_Vertex& BRepMesh_FastDiscretFace::Vertex(const Standard_Integer Index) const
 {
-  return structure->GetNode(Index);
+  return myStructure->GetNode(Index);
 }
 
 //=======================================================================
@@ -1817,7 +1666,7 @@ const BRepMesh_Vertex& BRepMesh_FastDiscretFace::Vertex
 
 const gp_Pnt& BRepMesh_FastDiscretFace::Pnt(const Standard_Integer Index) const
 {
-  return Location3d(structure->GetNode(Index).Location3d());
+  return myLocation3d(myStructure->GetNode(Index).Location3d());
 }
 
 //=======================================================================
@@ -1825,63 +1674,64 @@ const gp_Pnt& BRepMesh_FastDiscretFace::Pnt(const Standard_Integer Index) const
 //purpose  : 
 //=======================================================================
 
-gp_XY BRepMesh_FastDiscretFace::FindUV(const TopoDS_Vertex&   V,
-                                      const gp_Pnt2d&        XY, 
-                                      const Standard_Integer ip,
-                                      const Handle(BRepAdaptor_HSurface)& S,
-                                      const Standard_Real mindist) 
+gp_XY BRepMesh_FastDiscretFace::FindUV(const TopoDS_Vertex&                 theV,
+                                       const gp_Pnt2d&                      theXY,
+                                       const Standard_Integer               theIp,
+                                       const Handle(BRepAdaptor_HSurface)&  theSFace,
+                                       const Standard_Real                  theMinDist,
+                                       BRepMesh_DataMapOfIntegerListOfXY&   theLocation2dMap)
 {
-  gp_XY theUV;
-  if (mylocation2d.IsBound(ip))
+  gp_XY anUV;
+  if (theLocation2dMap.IsBound(theIp))
   {
-    BRepMesh_ListOfXY& L = mylocation2d.ChangeFind(ip);
-    theUV = L.First();
+    BRepMesh_ListOfXY& L = theLocation2dMap.ChangeFind(theIp);
+    anUV = L.First();
     if (L.Extent() != 1)
     {
       BRepMesh_ListIteratorOfListOfXY it(L);
       it.Next();
-      Standard_Real dd, dmin = XY.Distance(gp_Pnt2d(theUV));
+      Standard_Real dd, dmin = theXY.Distance(gp_Pnt2d(anUV));
       for (; it.More(); it.Next())
       {
-       dd = XY.Distance(gp_Pnt2d(it.Value()));
-       if (dd < dmin)
+        dd = theXY.Distance(gp_Pnt2d(it.Value()));
+        if (dd < dmin)
         {
-         theUV = it.Value();
-         dmin = dd;
-       }
+          anUV = it.Value();
+          dmin = dd;
+        }
       }
     }
 
-    const Standard_Real tol = Min(2. * BRep_Tool::Tolerance(V), mindist);
+    const Standard_Real tol = Min(2. * BRep_Tool::Tolerance(theV), theMinDist);
 
-    const Standard_Real Utol2d = .5 * (S->LastUParameter() - S->FirstUParameter());
-    const Standard_Real Vtol2d = .5 * (S->LastVParameter() - S->FirstVParameter());
+    const Standard_Real Utol2d = .5 * (theSFace->LastUParameter() - theSFace->FirstUParameter());
+    const Standard_Real Vtol2d = .5 * (theSFace->LastVParameter() - theSFace->FirstVParameter());
 
-    const gp_Pnt p1 = S->Value(theUV.X(), theUV.Y());
-    const gp_Pnt p2 = S->Value(XY.X(), XY.Y());
+    const gp_Pnt p1 = theSFace->Value(anUV.X(), anUV.Y());
+    const gp_Pnt p2 = theSFace->Value(theXY.X(), theXY.Y());
 
-    if (Abs(theUV.X() - XY.X()) > Utol2d ||
-        Abs(theUV.Y() - XY.Y()) > Vtol2d ||
-       !p1.IsEqual(p2, tol))
+    if (Abs(anUV.X() - theXY.X()) > Utol2d ||
+        Abs(anUV.Y() - theXY.Y()) > Vtol2d ||
+        !p1.IsEqual(p2, tol))
     {
-      theUV = XY.Coord();
-      L.Append(theUV);
+      anUV = theXY.Coord();
+      L.Append(anUV);
     }
   }
   else
   {
-    theUV = XY.Coord();
+    anUV = theXY.Coord();
     BRepMesh_ListOfXY L;
-    L.Append(theUV);
-    mylocation2d.Bind(ip, L);
+    L.Append(anUV);
+    theLocation2dMap.Bind(theIp, L);
   }
-  return theUV;
+  return anUV;
 }
 
 
 static Standard_Boolean GetVertexParameters(const TopoDS_Vertex& theVert, 
-                                         const TopoDS_Face& theFace,
-                                         gp_Pnt2d& thePoint)
+                                            const TopoDS_Face& theFace,
+                                            gp_Pnt2d& thePoint)
 {
   TopLoc_Location L;
   const Handle(Geom_Surface)& S = BRep_Tool::Surface(theFace,L);
@@ -1893,42 +1743,41 @@ static Standard_Boolean GetVertexParameters(const TopoDS_Vertex& theVert,
   while (itpr.More()) {
     if (itpr.Value()->IsPointOnSurface(S,L)) {
       thePoint.SetCoord(itpr.Value()->Parameter(),
-                    itpr.Value()->Parameter2());
+                        itpr.Value()->Parameter2());
       return Standard_True;
     }
     itpr.Next();
   }
   return Standard_False;
 }
+
 //=======================================================================
 //function : Add
-//purpose  : method intended to addition internav vertices in triangulation.
+//purpose  : method intended to addition internal myVertices in triangulation.
 //=======================================================================
-
 void BRepMesh_FastDiscretFace::Add(const TopoDS_Vertex&                theVert, 
-                              const TopoDS_Face&                  theFace, 
-                              const Handle(BRepAdaptor_HSurface)& thegFace)
-                              
+                                   const TopoDS_Face&                  theFace, 
+                                   const Handle(BRepAdaptor_HSurface)& thegFace)
 {
   const TopAbs_Orientation anOrient = theVert.Orientation();
   gp_Pnt2d uvXY;
   if( anOrient != TopAbs_INTERNAL || !GetVertexParameters(theVert,theFace,uvXY))
     return;
   Standard_Integer indVert =0;
-  if (vertices.IsBound(theVert))
-    indVert = vertices.Find(theVert);
+  if (myVertices.IsBound(theVert))
+    indVert = myVertices.Find(theVert);
   else
   {
-    nbLocat++;
-    Location3d.Bind(nbLocat, BRep_Tool::Pnt(theVert));
-    indVert = nbLocat;
-    vertices.Bind(theVert, indVert);
+    myNbLocat++;
+    myLocation3d.Bind(myNbLocat, BRep_Tool::Pnt(theVert));
+    indVert = myNbLocat;
+    myVertices.Bind(theVert, indVert);
   }
   Standard_Real mindist = BRep_Tool::Tolerance(theVert);
   // gp_Pnt2d uvXY = BRep_Tool::Parameters(theVert,theFace);
-  gp_XY anUV = FindUV(theVert, uvXY, indVert, thegFace, mindist);
+  gp_XY anUV = FindUV(theVert, uvXY, indVert, thegFace, mindist, myLocation2d);
   BRepMesh_Vertex vf(anUV, indVert, MeshDS_Fixed);
-  Standard_Integer ivff = structure->AddNode(vf);
-  Standard_Integer isvf = myvemap.FindIndex(ivff);
-  if (isvf == 0) isvf = myvemap.Add(ivff);  
+  Standard_Integer ivff = myStructure->AddNode(vf);
+  Standard_Integer isvf = myVemap.FindIndex(ivff);
+  if (isvf == 0) isvf = myVemap.Add(ivff);  
 }