]> OCCT Git - occt.git/commitdiff
0032008: Modeling Algorithms - disallow implicit copy of Extrema algorithms
authorkgv <kgv@opencascade.com>
Fri, 18 Dec 2020 11:29:59 +0000 (14:29 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 5 Mar 2021 14:31:07 +0000 (17:31 +0300)
Extrema_GenExtPS now prefers resizing of Array2 tables instead of managing tables by extra handles.
Removed unsafe casts to Adaptor3d_SurfacePtr/Adaptor3d_CurvePtr in Extrema classes.
Removed unsafe casts to curve adaptors in Extrema_ExtCC, Extrema_ExtCC2d classes.

Extrema_GenExtPS, Extrema_GenExtSS, Extrema_ExtCS -
copies by value are now disallowed;
several unexpected places copying the object have been fixed.

IntTools_Context - maps of void* have been replaced by typed maps.

52 files changed:
src/Adaptor3d/Adaptor3d_CurveOnSurfacePtr.hxx [deleted file]
src/Adaptor3d/Adaptor3d_CurvePtr.hxx [deleted file]
src/Adaptor3d/Adaptor3d_SurfacePtr.hxx [deleted file]
src/Adaptor3d/FILES
src/BOPAlgo/BOPAlgo_Tools.cxx
src/BRepFill/BRepFill_Filling.cxx
src/BRepFill/BRepFill_Filling.hxx
src/BRepGProp/BRepGProp_TFunction.cxx
src/BRepGProp/BRepGProp_TFunction.hxx
src/BRepGProp/BRepGProp_UFunction.cxx
src/BRepGProp/BRepGProp_UFunction.hxx
src/BRepGProp/BRepGProp_VinertGK.cxx
src/BRepGProp/BRepGProp_VinertGK.hxx
src/Extrema/Extrema_ExtCC.cxx
src/Extrema/Extrema_ExtCC.hxx
src/Extrema/Extrema_ExtCC2d.cxx
src/Extrema/Extrema_ExtCC2d.hxx
src/Extrema/Extrema_ExtCS.cxx
src/Extrema/Extrema_ExtCS.hxx
src/Extrema/Extrema_ExtPRevS.cxx
src/Extrema/Extrema_ExtPS.cxx
src/Extrema/Extrema_ExtPS.hxx
src/Extrema/Extrema_ExtSS.cxx
src/Extrema/Extrema_ExtSS.hxx
src/Extrema/Extrema_FuncExtCS.cxx
src/Extrema/Extrema_FuncExtCS.hxx
src/Extrema/Extrema_FuncExtSS.cxx
src/Extrema/Extrema_FuncExtSS.hxx
src/Extrema/Extrema_FuncPSNorm.cxx
src/Extrema/Extrema_FuncPSNorm.hxx
src/Extrema/Extrema_GenExtCS.cxx
src/Extrema/Extrema_GenExtCS.hxx
src/Extrema/Extrema_GenExtPS.cxx
src/Extrema/Extrema_GenExtPS.hxx
src/Extrema/Extrema_GenExtSS.cxx
src/Extrema/Extrema_GenExtSS.hxx
src/Extrema/Extrema_HArray2OfPOnSurfParams.hxx [deleted file]
src/Extrema/FILES
src/GeomAPI/GeomAPI_ExtremaCurveCurve.cxx
src/GeomAPI/GeomAPI_ExtremaCurveSurface.cxx
src/GeomFill/GeomFill_Darboux.cxx
src/GeomInt/GeomInt_IntSS_1.cxx
src/HLRBRep/HLRBRep_Intersector.cxx
src/IntTools/IntTools_BeanFaceIntersector.cxx
src/IntTools/IntTools_BeanFaceIntersector.hxx
src/IntTools/IntTools_Context.cxx
src/IntTools/IntTools_Context.hxx
src/ProjLib/ProjLib_CompProjectedCurve.cxx
src/ProjLib/ProjLib_PrjFunc.cxx
src/ProjLib/ProjLib_PrjFunc.hxx
src/ProjLib/ProjLib_PrjResolve.cxx
src/ProjLib/ProjLib_PrjResolve.hxx

diff --git a/src/Adaptor3d/Adaptor3d_CurveOnSurfacePtr.hxx b/src/Adaptor3d/Adaptor3d_CurveOnSurfacePtr.hxx
deleted file mode 100644 (file)
index c991c72..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Created on: 1992-10-08
-// Created by: Isabelle GRIGNON
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Adaptor3d_CurveOnSurfacePtr_HeaderFile
-#define _Adaptor3d_CurveOnSurfacePtr_HeaderFile
-
-class Adaptor3d_CurveOnSurface;
-typedef Adaptor3d_CurveOnSurface* Adaptor3d_CurveOnSurfacePtr;
-
-#endif // _Adaptor3d_CurveOnSurfacePtr_HeaderFile
diff --git a/src/Adaptor3d/Adaptor3d_CurvePtr.hxx b/src/Adaptor3d/Adaptor3d_CurvePtr.hxx
deleted file mode 100644 (file)
index ab8ae1f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Created on: 1992-10-08
-// Created by: Isabelle GRIGNON
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Adaptor3d_CurvePtr_HeaderFile
-#define _Adaptor3d_CurvePtr_HeaderFile
-
-class Adaptor3d_Curve;
-typedef Adaptor3d_Curve* Adaptor3d_CurvePtr;
-
-#endif // _Adaptor3d_CurvePtr_HeaderFile
diff --git a/src/Adaptor3d/Adaptor3d_SurfacePtr.hxx b/src/Adaptor3d/Adaptor3d_SurfacePtr.hxx
deleted file mode 100644 (file)
index 5d0471c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Created on: 1992-10-08
-// Created by: Isabelle GRIGNON
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Adaptor3d_SurfacePtr_HeaderFile
-#define _Adaptor3d_SurfacePtr_HeaderFile
-
-class Adaptor3d_Surface;
-typedef Adaptor3d_Surface* Adaptor3d_SurfacePtr;
-
-#endif // _Adaptor3d_SurfacePtr_HeaderFile
index 7bf779a5e11e534ef7d24885e3d37b099c974eb5..4ab747ad314aafe302a2cddd60103452c9ffa001 100644 (file)
@@ -2,8 +2,6 @@ Adaptor3d_Curve.cxx
 Adaptor3d_Curve.hxx
 Adaptor3d_CurveOnSurface.cxx
 Adaptor3d_CurveOnSurface.hxx
-Adaptor3d_CurveOnSurfacePtr.hxx
-Adaptor3d_CurvePtr.hxx
 Adaptor3d_HSurfaceTool.cxx
 Adaptor3d_HSurfaceTool.hxx
 Adaptor3d_HVertex.cxx
@@ -14,6 +12,5 @@ Adaptor3d_IsoCurve.cxx
 Adaptor3d_IsoCurve.hxx
 Adaptor3d_Surface.cxx
 Adaptor3d_Surface.hxx
-Adaptor3d_SurfacePtr.hxx
 Adaptor3d_TopolTool.cxx
 Adaptor3d_TopolTool.hxx
index 82ac4b0855c59b5a8aa35357e0f88270eec98eb9..e5f3c071a20a7c27d9778a15481e9e1283c5a482 100644 (file)
@@ -302,17 +302,13 @@ Standard_Real BOPAlgo_Tools::ComputeToleranceOfCB
   //
   // compute max tolerance for common blocks on faces
   if (aLFI.Extent()) {
-    Standard_Integer nF;
-    GeomAPI_ProjectPointOnSurf aProjPS;
-    TColStd_ListIteratorOfListOfInteger aItLI;
-    //
-    aItLI.Initialize(aLFI);
-    for (; aItLI.More(); aItLI.Next()) {
-      nF = aItLI.Value();
+    for (TColStd_ListIteratorOfListOfInteger aItLI (aLFI); aItLI.More(); aItLI.Next())
+    {
+      const Standard_Integer nF = aItLI.Value();
       const TopoDS_Face& aF = *(TopoDS_Face*)&theDS->Shape(nF);
       aTol = BRep_Tool::Tolerance(aF);
       //
-      aProjPS = aCtx->ProjPS(aF);
+      GeomAPI_ProjectPointOnSurf& aProjPS = aCtx->ProjPS(aF);
       //
       aT = aT1;
       for (Standard_Integer i=1; i <= aNbPnt; i++) {
index 856e63367414a3ef66a897a80111a38b2e2c9de0..546919e9aac9d610570e40b270fbf5e69d676e09 100644 (file)
@@ -14,8 +14,8 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <BRepFill_Filling.hxx>
 
-#include <Adaptor3d_CurveOnSurface.hxx>
 #include <Adaptor3d_CurveOnSurface.hxx>
 #include <BRep_Builder.hxx>
 #include <BRep_CurveRepresentation.hxx>
@@ -29,7 +29,6 @@
 #include <BRepFill_CurveConstraint.hxx>
 #include <BRepFill_EdgeFaceAndOrder.hxx>
 #include <BRepFill_FaceAndOrder.hxx>
-#include <BRepFill_Filling.hxx>
 #include <BRepLib.hxx>
 #include <BRepLib_MakeVertex.hxx>
 #include <BRepLib_MakeEdge.hxx>
@@ -393,7 +392,7 @@ void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder
              Constr->SetCurve2dOnSurf( Curve2d );
            }
        }
-      myBuilder.Add( Constr );
+      myBuilder->Add( Constr );
     }
 }
 
@@ -571,10 +570,8 @@ void BRepFill_Filling::FindExtremitiesOfHoles(const TopTools_ListOfShape& WireLi
 //======================================================================
 void BRepFill_Filling::Build()
 {
-  GeomPlate_BuildPlateSurface thebuild( myDegree, myNbPtsOnCur, myNbIter,
-                                        myTol2d, myTol3d, myTolAng, myTolCurv, myAnisotropie );
-
-  myBuilder = thebuild;
+  myBuilder.reset (new GeomPlate_BuildPlateSurface (myDegree, myNbPtsOnCur, myNbIter,
+                                                    myTol2d, myTol3d, myTolAng, myTolCurv, myAnisotropie));
   TopoDS_Edge CurEdge;
   TopoDS_Face CurFace;
   Standard_Integer i, j;
@@ -650,29 +647,33 @@ void BRepFill_Filling::Build()
     {
       Handle( BRepAdaptor_Surface ) HSurfInit = new BRepAdaptor_Surface();
       HSurfInit->Initialize( myInitFace );
-      myBuilder.LoadInitSurface( BRep_Tool::Surface( HSurfInit->Face() ) );
+      myBuilder->LoadInitSurface( BRep_Tool::Surface( HSurfInit->Face() ) );
     }
 
   //Adding constraints to myBuilder
   AddConstraints( myBoundary );
-  myBuilder.SetNbBounds( myBoundary.Length() );
+  myBuilder->SetNbBounds( myBoundary.Length() );
   AddConstraints( myConstraints );
   for (i = 1; i <= myPoints.Length(); i++)
-    myBuilder.Add( myPoints(i) );
+  {
+    myBuilder->Add (myPoints (i));
+  }
 
-  myBuilder.Perform();
-  if (myBuilder.IsDone())
+  myBuilder->Perform();
+  if (myBuilder->IsDone())
+  {
     myIsDone = Standard_True;
+  }
   else
-    {
-      myIsDone = Standard_False;
-      return;
-    }
+  {
+    myIsDone = Standard_False;
+    return;
+  }
 
-  Handle( GeomPlate_Surface ) GPlate = myBuilder.Surface();
-  Handle( Geom_BSplineSurface ) Surface;
+  Handle(GeomPlate_Surface) GPlate = myBuilder->Surface();
+  Handle(Geom_BSplineSurface) Surface;
   // Approximation
-  Standard_Real dmax = 1.1 * myBuilder.G0Error(); //???????????
+  Standard_Real dmax = 1.1 * myBuilder->G0Error(); //???????????
   //Standard_Real dmax = myTol3d;
   if (! myIsInitFaceGiven)
     {
@@ -680,9 +681,9 @@ void BRepFill_Filling::Build()
 
      TColgp_SequenceOfXY S2d;
      TColgp_SequenceOfXYZ S3d;
-     myBuilder.Disc2dContour(4,S2d);
-     myBuilder.Disc3dContour(4,0,S3d);
-     seuil = Max( myTol3d, 10*myBuilder.G0Error() ); //????????
+     myBuilder->Disc2dContour (4, S2d);
+     myBuilder->Disc3dContour (4, 0, S3d);
+     seuil = Max (myTol3d, 10 * myBuilder->G0Error()); //????????
      GeomPlate_PlateG0Criterion Criterion( S2d, S3d, seuil );
      GeomPlate_MakeApprox Approx( GPlate, Criterion, myTol3d, myMaxSegments, myMaxDeg );
      Surface = Approx.Surface();
@@ -697,7 +698,7 @@ void BRepFill_Filling::Build()
 
   //Build the final wire and final face
   TopTools_ListOfShape FinalEdges;
-  Handle(TColGeom2d_HArray1OfCurve) CurvesOnPlate = myBuilder.Curves2d();
+  Handle(TColGeom2d_HArray1OfCurve) CurvesOnPlate = myBuilder->Curves2d();
   BRep_Builder BB;
   for (i = 1; i <= myBoundary.Length(); i++)
   {
@@ -789,7 +790,7 @@ TopoDS_Face BRepFill_Filling::Face() const
 //==========================================================================
 Standard_Real BRepFill_Filling::G0Error() const
 {
-  return myBuilder.G0Error();
+  return myBuilder->G0Error();
 }
 
 //=======================================================================
@@ -799,7 +800,7 @@ Standard_Real BRepFill_Filling::G0Error() const
 //======================================================================
 Standard_Real BRepFill_Filling::G1Error() const
 {
-  return myBuilder.G1Error();
+  return myBuilder->G1Error();
 }
 
 //=======================================================================
@@ -809,7 +810,7 @@ Standard_Real BRepFill_Filling::G1Error() const
 //======================================================================
 Standard_Real BRepFill_Filling::G2Error() const
 {
-  return myBuilder.G2Error();
+  return myBuilder->G2Error();
 }
 
 //==========================================================================
@@ -819,7 +820,7 @@ Standard_Real BRepFill_Filling::G2Error() const
 //==========================================================================
 Standard_Real BRepFill_Filling::G0Error( const Standard_Integer Index )
 {
-  return myBuilder.G0Error( Index );
+  return myBuilder->G0Error (Index);
 }
 
 //==========================================================================
@@ -829,7 +830,7 @@ Standard_Real BRepFill_Filling::G0Error( const Standard_Integer Index )
 //==========================================================================
 Standard_Real BRepFill_Filling::G1Error( const Standard_Integer Index )
 {
-  return myBuilder.G1Error( Index );
+  return myBuilder->G1Error (Index);
 }
 
 //==========================================================================
@@ -839,5 +840,5 @@ Standard_Real BRepFill_Filling::G1Error( const Standard_Integer Index )
 //==========================================================================
 Standard_Real BRepFill_Filling::G2Error( const Standard_Integer Index )
 {
-  return myBuilder.G2Error( Index );
+  return myBuilder->G2Error (Index);
 }
index b37bad27dc86b0dcddedce5110a3d69e8577547d..558cdc3a18e66dd342c28a24755a64a7d51c4b6d 100644 (file)
 #ifndef _BRepFill_Filling_HeaderFile
 #define _BRepFill_Filling_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <GeomPlate_BuildPlateSurface.hxx>
 #include <BRepFill_SequenceOfEdgeFaceAndOrder.hxx>
 #include <BRepFill_SequenceOfFaceAndOrder.hxx>
+#include <GeomAbs_Shape.hxx>
+#include <GeomPlate_BuildPlateSurface.hxx>
 #include <GeomPlate_SequenceOfPointConstraint.hxx>
+#include <TopoDS_Face.hxx>
 #include <TopTools_DataMapOfShapeShape.hxx>
 #include <TopTools_ListOfShape.hxx>
-#include <TopoDS_Face.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-#include <GeomAbs_Shape.hxx>
 #include <TopTools_SequenceOfShape.hxx>
-class StdFail_NotDone;
-class Standard_OutOfRange;
-class Standard_ConstructionError;
-class TopoDS_Face;
+
+#include <memory>
+
 class TopoDS_Edge;
 class gp_Pnt;
-class TopoDS_Shape;
-
 
 //! N-Side Filling
 //! This algorithm avoids to build a face from:
@@ -63,8 +53,8 @@ class TopoDS_Shape;
 //! Limitations:
 //! * If some constraints are not compatible
 //! The algorithm does not take them into account.
-//! So the constraints will not be satisfyed in an area containing
-//! the incompatibilitries.
+//! So the constraints will not be satisfied in an area containing
+//! the incompatibilities.
 //! * The constraints defining the bound of the face have to be
 //! entered in order to have a continuous wire.
 //!
@@ -179,18 +169,8 @@ public:
   
   Standard_EXPORT Standard_Real G2Error (const Standard_Integer Index);
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-  
   //! Adds constraints to builder
   Standard_EXPORT void AddConstraints (const BRepFill_SequenceOfEdgeFaceAndOrder& SeqOfConstraints);
   
@@ -201,8 +181,9 @@ private:
   //! Can properly operate only with convex contour
   Standard_EXPORT void FindExtremitiesOfHoles (const TopTools_ListOfShape& WireList, TopTools_SequenceOfShape& VerSeq) const;
 
+private:
 
-  GeomPlate_BuildPlateSurface myBuilder;
+  opencascade::std::shared_ptr<GeomPlate_BuildPlateSurface> myBuilder;
   BRepFill_SequenceOfEdgeFaceAndOrder myBoundary;
   BRepFill_SequenceOfEdgeFaceAndOrder myConstraints;
   BRepFill_SequenceOfFaceAndOrder myFreeConstraints;
@@ -224,13 +205,6 @@ private:
   Standard_Boolean myIsInitFaceGiven;
   Standard_Boolean myIsDone;
 
-
 };
 
-
-
-
-
-
-
 #endif // _BRepFill_Filling_HeaderFile
index a1f93502ef28cd2cf503b35b66e789b9101bffce..f7422000b98ed8f30d467dd36f05ee3c05383730 100644 (file)
@@ -28,7 +28,7 @@
 BRepGProp_TFunction::BRepGProp_TFunction(const BRepGProp_Face   &theSurface,
                                          const gp_Pnt           &theVertex,
                                          const Standard_Boolean  IsByPoint,
-                                         const Standard_Address  theCoeffs,
+                                         const Standard_Real*    theCoeffs,
                                          const Standard_Real     theUMin,
                                          const Standard_Real     theTolerance):
   mySurface(theSurface),
index a9c298c2afeab013027b8897f3a2bb5524b3a3f9..baecc46400d39da9bec17658b1d492598841c200 100644 (file)
@@ -56,9 +56,14 @@ public:
   //! correspondingly) of the shift if the inertia is computed
   //! with respect to the point different then the location.
   //! If IsByPoint is equal to Standard_False, the number of the
-  //! coefficients is 4 and they represent the compbination of
+  //! coefficients is 4 and they represent the combination of
   //! plane parameters and shift values.
-  Standard_EXPORT BRepGProp_TFunction(const BRepGProp_Face& theSurface, const gp_Pnt& theVertex, const Standard_Boolean IsByPoint, const Standard_Address theCoeffs, const Standard_Real theUMin, const Standard_Real theTolerance);
+  Standard_EXPORT BRepGProp_TFunction (const BRepGProp_Face& theSurface,
+                                       const gp_Pnt& theVertex,
+                                       const Standard_Boolean IsByPoint,
+                                       const Standard_Real* theCoeffs,
+                                       const Standard_Real theUMin,
+                                       const Standard_Real theTolerance);
   
   Standard_EXPORT void Init();
   
index 14860e322f3ce7c25b25ebfb1c571295de190a16..1fdc71c27640fa2665379eeb638fc49a925379bf 100644 (file)
@@ -26,7 +26,7 @@
 BRepGProp_UFunction::BRepGProp_UFunction(const BRepGProp_Face   &theSurface,
                                          const gp_Pnt           &theVertex,
                                          const Standard_Boolean  IsByPoint,
-                                         const Standard_Address  theCoeffs)
+                                         const Standard_Real*    theCoeffs)
                                          : mySurface(theSurface),
                                          myVertex(theVertex),
                                          myCoeffs(theCoeffs),
@@ -95,7 +95,7 @@ Standard_Real BRepGProp_UFunction::VolumeValue(const Standard_Real  X,
     return thePMP0.Dot(aNorm.XYZ());
 
   // Volume and additional coefficients computation for ByPlane mode.
-  Standard_Real *aCoeff = (Standard_Real *)myCoeffs;
+  const Standard_Real* aCoeff = myCoeffs;
 
   theS  =   aNorm.X()*aCoeff[0] + aNorm.Y()*aCoeff[1] + aNorm.Z()*aCoeff[2];
   theD1 =   thePMP0.X()*aCoeff[0] + thePMP0.Y()*aCoeff[1]
@@ -132,7 +132,7 @@ Standard_Boolean BRepGProp_UFunction::CenterMassValue(const Standard_Real  X,
   }
 
   // Center of mass computation for ByPlane mode.
-  Standard_Real *aCoeff = (Standard_Real *)myCoeffs;
+  const Standard_Real* aCoeff = myCoeffs;
 
   switch (myValueType) {
   case GProp_CenterMassX:   F *= (aPmP0.X() - 0.5*aCoeff[0]*aD1); break;
@@ -158,7 +158,7 @@ Standard_Boolean BRepGProp_UFunction::InertiaValue(const Standard_Real  X,
   Standard_Real aD1;
   Standard_Real aParam1;
   Standard_Real aParam2;
-  Standard_Real *aCoeffs = (Standard_Real *)myCoeffs;
+  const Standard_Real* aCoeffs = myCoeffs;
 
   F = VolumeValue(X, aPmP0, aS, aD1);
 
index 3d2dee4c9ecb566c26e2b5ae3598c2c00ac0860d..1bc0da5e52cbed792432935587b14d172d28fdbd 100644 (file)
@@ -70,7 +70,7 @@ public:
   //! If IsByPoint is equal to Standard_False, the number of the
   //! coefficients is 4 and they represent the combination of
   //! plane parameters and shift values.
-  Standard_EXPORT BRepGProp_UFunction(const BRepGProp_Face& theSurface, const gp_Pnt& theVertex, const Standard_Boolean IsByPoint, const Standard_Address theCoeffs);
+  Standard_EXPORT BRepGProp_UFunction(const BRepGProp_Face& theSurface, const gp_Pnt& theVertex, const Standard_Boolean IsByPoint, const Standard_Real* theCoeffs);
   
   //! Setting the type of the value to be returned.
     void SetValueType (const GProp_ValueType theType);
@@ -82,18 +82,8 @@ public:
   //! Returns a value of the function.
   Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X, Standard_Real& F) Standard_OVERRIDE;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-  
   //! Private method. Returns the value for volume computation.
   //! Other returned values are:
   //! -  thePMP0 - PSurf(X,Y) minus Location.
@@ -120,7 +110,7 @@ private:
 
   BRepGProp_Face mySurface;
   gp_Pnt myVertex;
-  Standard_Address myCoeffs;
+  const Standard_Real* myCoeffs;
   Standard_Real myVParam;
   GProp_ValueType myValueType;
   Standard_Boolean myIsByPoint;
index 388d6741070e4b3402567be1afea4510480c5f8e..01737d7725524f204d30365d6c8036f0444dcae2 100644 (file)
@@ -138,7 +138,7 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face        &theSurface,
 {
   Standard_Real aShift[] = { 0., 0., 0. };
 
-  return PrivatePerform(theSurface, NULL, Standard_True, &aShift, theTolerance, 
+  return PrivatePerform(theSurface, NULL, Standard_True, aShift, theTolerance,
     theCGFlag, theIFlag);
 }
 
@@ -159,7 +159,7 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face        &theSurface,
 
   aXYZ.Coord(aShift[0], aShift[1], aShift[2]);
 
-  return PrivatePerform(theSurface, NULL, Standard_True, &aShift, theTolerance, 
+  return PrivatePerform(theSurface, NULL, Standard_True, aShift, theTolerance,
     theCGFlag, theIFlag);
 }
 
@@ -178,7 +178,7 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face        &theSurface,
   Standard_Real aShift[] = { 0., 0., 0. };
 
   return PrivatePerform(theSurface, &theDomain,
-    Standard_True, &aShift, theTolerance, 
+    Standard_True, aShift, theTolerance,
     theCGFlag, theIFlag);
 }
 
@@ -201,7 +201,7 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face        &theSurface,
   aXYZ.Coord(aShift[0], aShift[1], aShift[2]);
 
   return PrivatePerform(theSurface, &theDomain,
-    Standard_True, &aShift, theTolerance, 
+    Standard_True, aShift, theTolerance,
     theCGFlag, theIFlag);
 }
 
@@ -227,7 +227,7 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face        &theSurface,
   aCoeff[3] = aCoeff[3] - aCoeff[0]*aXLoc - aCoeff[1]*aYLoc - aCoeff[2]*aZLoc;
 
   return PrivatePerform(theSurface, NULL,
-    Standard_False, &aCoeff, theTolerance, 
+    Standard_False, aCoeff, theTolerance,
     theCGFlag, theIFlag);
 }
 
@@ -254,7 +254,7 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face        &theSurface,
   aCoeff[3] = aCoeff[3] - aCoeff[0]*aXLoc - aCoeff[1]*aYLoc - aCoeff[2]*aZLoc;
 
   return PrivatePerform(theSurface, &theDomain,
-    Standard_False, &aCoeff, theTolerance, 
+    Standard_False, aCoeff, theTolerance,
     theCGFlag, theIFlag);
 }
 
@@ -267,7 +267,7 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
 (BRepGProp_Face        &theSurface,
  const Standard_Address thePtrDomain,
  const Standard_Boolean IsByPoint,
- const Standard_Address theCoeffs,
+ const Standard_Real*   theCoeffs,
  const Standard_Real    theTolerance,
  const Standard_Boolean theCGFlag,
  const Standard_Boolean theIFlag)
@@ -275,7 +275,7 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
 {
 
   const Standard_Real aTTol = 1.e-9;
-  Standard_Real *aCoeffs = (Standard_Real *)theCoeffs;
+  const Standard_Real* aCoeffs = theCoeffs;
 
   // Compute the number of 2d bounding curves of the face.
   BRepGProp_Domain           *aPDomain = NULL;
@@ -357,8 +357,7 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
 
     // Get the spans on the curve.
     Handle(TColStd_HArray1OfReal) aTKnots;
-    BRepGProp_TFunction               aTFunc(theSurface, loc, IsByPoint, theCoeffs,
-      aUMin, aCrvTol);
+    BRepGProp_TFunction aTFunc (theSurface, loc, IsByPoint, theCoeffs, aUMin, aCrvTol);
 
     theSurface.GetTKnots(aTMin, aTMax, aTKnots);
 
index fde63e88752a9a5445c4262059c59d889eec32ea..54ed1e98b5115be46a93d540b3392ce2a6ee39e6 100644 (file)
@@ -147,21 +147,17 @@ public:
   //! Returns the absolut reached computation error.
     Standard_Real GetAbsolutError() const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-  
   //! Main method for computation of the global properties that
   //! is invoked by each Perform method.
-  Standard_EXPORT Standard_Real PrivatePerform (BRepGProp_Face& theSurface, const Standard_Address thePtrDomain, const Standard_Boolean IsByPoint, const Standard_Address theCoeffs, const Standard_Real theTolerance, const Standard_Boolean theCGFlag, const Standard_Boolean theIFlag);
+  Standard_EXPORT Standard_Real PrivatePerform (BRepGProp_Face& theSurface,
+                                                const Standard_Address thePtrDomain,
+                                                const Standard_Boolean IsByPoint,
+                                                const Standard_Real* theCoeffs,
+                                                const Standard_Real theTolerance,
+                                                const Standard_Boolean theCGFlag,
+                                                const Standard_Boolean theIFlag);
 
 
   Standard_Real myErrorReached;
index 3a36a87d55908b2a750e42f58b82616f3091cecb..fa77b80c79a142341e1d71554066d365dd7d3a7e 100644 (file)
@@ -112,16 +112,56 @@ Extrema_ExtCC::Extrema_ExtCC(const Adaptor3d_Curve& C1,
   Perform();
 }
 
+//=======================================================================
+//function : Initialize
+//purpose  :
+//=======================================================================
+void Extrema_ExtCC::Initialize (const Adaptor3d_Curve& C1,
+                                const Adaptor3d_Curve& C2,
+                                const Standard_Real TolC1,
+                                const Standard_Real TolC2)
+{
+  // myECC will be re-initialized by Perform()
+  myDone = Standard_False;
+  SetCurve (1, C1, C1.FirstParameter(), C1.LastParameter());
+  SetCurve (2, C2, C2.FirstParameter(), C2.LastParameter());
+  SetTolerance (1, TolC1);
+  SetTolerance (2, TolC2);
+  mydist11 = mydist12 = mydist21 = mydist22 = RealFirst();
+}
+
+//=======================================================================
+//function : Initialize
+//purpose  :
+//=======================================================================
+void Extrema_ExtCC::Initialize (const Adaptor3d_Curve& C1,
+                                const Adaptor3d_Curve& C2,
+                                const Standard_Real U1,
+                                const Standard_Real U2,
+                                const Standard_Real V1,
+                                const Standard_Real V2,
+                                const Standard_Real TolC1,
+                                const Standard_Real TolC2)
+{
+  // myECC will be re-initialized by Perform()
+  myDone = Standard_False;
+  SetCurve (1, C1, U1, U2);
+  SetCurve (2, C2, V1, V2);
+  SetTolerance (1, TolC1);
+  SetTolerance (2, TolC2);
+  mydist11 = mydist12 = mydist21 = mydist22 = RealFirst();
+}
+
 //=======================================================================
 //function : SetCurve
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void Extrema_ExtCC::SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C)
 {
   Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_ExtCC::SetCurve()")
   Standard_Integer anInd = theRank - 1;
-  myC[anInd] = (Standard_Address)&C;
+  myC[anInd] = &C;
 }
 
 //=======================================================================
@@ -171,8 +211,7 @@ void Extrema_ExtCC::SetTolerance (const Standard_Integer theRank, const Standard
 void Extrema_ExtCC::Perform()
 {  
   Standard_NullObject_Raise_if (!myC[0] || !myC[1], "Extrema_ExtCC::Perform()")
-  myECC.SetParams(*((Adaptor3d_Curve*)myC[0]), 
-                  *((Adaptor3d_Curve*)myC[1]), myInf[0], mySup[0], myInf[1], mySup[1]);
+  myECC.SetParams(*myC[0], *myC[1], myInf[0], mySup[0], myInf[1], mySup[1]);
   myECC.SetTolerance(Min(myTol[0], myTol[1]));
   myECC.SetSingleSolutionFlag(GetSingleSolutionFlag());
   myDone = Standard_False;
@@ -180,8 +219,8 @@ void Extrema_ExtCC::Perform()
   mySqDist.Clear();
   myIsPar = Standard_False;
 
-  GeomAbs_CurveType type1 = (*((Adaptor3d_Curve*)myC[0])).GetType();
-  GeomAbs_CurveType type2 = (*((Adaptor3d_Curve*)myC[1])).GetType();
+  GeomAbs_CurveType type1 = myC[0]->GetType();
+  GeomAbs_CurveType type2 = myC[1]->GetType();
   Standard_Real U11, U12, U21, U22, Tol = Min(myTol[0], myTol[1]);
 
   U11 = myInf[0];
@@ -189,10 +228,10 @@ void Extrema_ExtCC::Perform()
   U21 = myInf[1];
   U22 = mySup[1];
 
-  if (!Precision::IsInfinite(U11)) P1f = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]),  U11); 
-  if (!Precision::IsInfinite(U12)) P1l = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]),  U12);
-  if (!Precision::IsInfinite(U21)) P2f = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), U21);
-  if (!Precision::IsInfinite(U22)) P2l = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), U22);
+  if (!Precision::IsInfinite(U11)) P1f = Extrema_CurveTool::Value(*myC[0], U11);
+  if (!Precision::IsInfinite(U12)) P1l = Extrema_CurveTool::Value(*myC[0], U12);
+  if (!Precision::IsInfinite(U21)) P2f = Extrema_CurveTool::Value(*myC[1], U21);
+  if (!Precision::IsInfinite(U22)) P2l = Extrema_CurveTool::Value(*myC[1], U22);
   
 
   if (Precision::IsInfinite(U11) || Precision::IsInfinite(U21)) mydist11 = RealLast();
@@ -223,27 +262,27 @@ void Extrema_ExtCC::Perform()
     }
     switch (aType2) {
     case GeomAbs_Line: {
-      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Line(), Tol);
+      Extrema_ExtElC Xtrem (myC[anInd1]->Line(), myC[anInd2]->Line(), Tol);
       PrepareResults(Xtrem, isInverse, U11, U12, U21, U22);
       break;
     }
     case GeomAbs_Circle: {
-      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Circle(), Tol);
+      Extrema_ExtElC Xtrem (myC[anInd1]->Line(), myC[anInd2]->Circle(), Tol);
       PrepareResults(Xtrem, isInverse, U11, U12, U21, U22);
       break;
     }
     case GeomAbs_Ellipse: {
-      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Ellipse());
+      Extrema_ExtElC Xtrem (myC[anInd1]->Line(), myC[anInd2]->Ellipse());
       PrepareResults(Xtrem, isInverse, U11, U12, U21, U22);
       break;
     }
     case GeomAbs_Hyperbola: {
-      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Hyperbola());
+      Extrema_ExtElC Xtrem (myC[anInd1]->Line(), myC[anInd2]->Hyperbola());
       PrepareResults(Xtrem, isInverse, U11, U12, U21, U22);
       break;
     }
     case GeomAbs_Parabola: {
-      Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Parabola());
+      Extrema_ExtElC Xtrem (myC[anInd1]->Line(), myC[anInd2]->Parabola());
       PrepareResults(Xtrem, isInverse, U11, U12, U21, U22);
       break;
     }
@@ -252,7 +291,7 @@ void Extrema_ExtCC::Perform()
   } else if (type1 == GeomAbs_Circle && type2 == GeomAbs_Circle) {
     //analytical case - two circles
     Standard_Boolean bIsDone;
-    Extrema_ExtElC CCXtrem ((*((Adaptor3d_Curve*)myC[0])).Circle(), (*((Adaptor3d_Curve*)myC[1])).Circle());
+    Extrema_ExtElC CCXtrem (myC[0]->Circle(), myC[1]->Circle());
     bIsDone = CCXtrem.IsDone();
     if(bIsDone) {
       PrepareResults(CCXtrem, Standard_False, U11, U12, U21, U22);
@@ -375,9 +414,8 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
   if (!myIsPar)
     return;
 
-  const GeomAbs_CurveType aType1 = Extrema_CurveTool::GetType(*((Adaptor3d_Curve*) myC[0]));
-  const GeomAbs_CurveType aType2 = Extrema_CurveTool::GetType(*((Adaptor3d_Curve*) myC[1]));
-  
+  const GeomAbs_CurveType aType1 = Extrema_CurveTool::GetType (*myC[0]);
+  const GeomAbs_CurveType aType2 = Extrema_CurveTool::GetType (*myC[1]);
   if (((aType1 != GeomAbs_Line) && (aType1 != GeomAbs_Circle)) ||
       ((aType2 != GeomAbs_Line) && (aType2 != GeomAbs_Circle)))
   {
@@ -394,11 +432,10 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
     //The projection of the circle's location to the trimmed line must exist.
     const Standard_Boolean isReversed = (aType1 != GeomAbs_Circle);
     const gp_Pnt aPonC = !isReversed ?
-                      Extrema_CurveTool::Value(*((Adaptor3d_Curve*) myC[0]), theUt11) :
-                      Extrema_CurveTool::Value(*((Adaptor3d_Curve*) myC[1]), theUt21);
+                      Extrema_CurveTool::Value (*myC[0], theUt11) :
+                      Extrema_CurveTool::Value (*myC[1], theUt21);
 
-    const gp_Lin aL = !isReversed ? ((Adaptor3d_Curve*) myC[1])->Line() :
-                                    ((Adaptor3d_Curve*) myC[0])->Line();
+    const gp_Lin aL = myC[!isReversed ? 1 : 0]->Line();
     const Extrema_ExtPElC ExtPLin(aPonC, aL, Precision::Confusion(),
                                   !isReversed ? theUt21 : theUt11,
                                   !isReversed ? theUt22 : theUt12);
@@ -438,8 +475,8 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
 
       myIsPar = Standard_False;
 
-      const gp_Lin aLin1 = ((Adaptor3d_Curve*) myC[0])->Line();
-      const gp_Lin aLin2 = ((Adaptor3d_Curve*) myC[1])->Line();
+      const gp_Lin aLin1 = myC[0]->Line();
+      const gp_Lin aLin2 = myC[1]->Line();
       const Standard_Boolean isOpposite(aLin1.Direction().Dot(aLin2.Direction()) < 0.0);
 
       Bnd_Range aRange2(theUt21, theUt22);
@@ -516,12 +553,12 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
     //  the range [V1-PI, V2-PI]. All ranges must be adjusted to correspond
     //  periodic range before checking of intersection.
 
-    const gp_Circ aWorkCirc = ((Adaptor3d_Curve*) myC[1])->Circle();
+    const gp_Circ aWorkCirc = myC[1]->Circle();
     const Standard_Real aPeriod = M_PI + M_PI;
     gp_Vec aVTg1;
     gp_Pnt aP11;
-    const gp_Pnt aP12 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*) myC[0]), theUt12);
-    Extrema_CurveTool::D1(*((Adaptor3d_Curve*) myC[0]), theUt11, aP11, aVTg1);
+    const gp_Pnt aP12 = Extrema_CurveTool::Value (*myC[0], theUt12);
+    Extrema_CurveTool::D1 (*myC[0], theUt11, aP11, aVTg1);
 
     const Bnd_Range aRange(theUt21, theUt22);
     Bnd_Range aProjRng1;
@@ -531,7 +568,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
 
     Standard_Real aPar1 = ElCLib::InPeriod(ElCLib::Parameter(aWorkCirc, aP11),
                                            theUt21, theUt21 + aPeriod);
-    const gp_Vec aVTg2 = Extrema_CurveTool::DN(*((Adaptor3d_Curve*) myC[1]), aPar1, 1);
+    const gp_Vec aVTg2 = Extrema_CurveTool::DN (*myC[1], aPar1, 1);
     
     // Check if circles have same/opposite directions
     const Standard_Boolean isOpposite(aVTg1.Dot(aVTg2) < 0.0);
@@ -593,7 +630,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
         aRng.GetIntermediatePoint(0.5, aPar);
         const gp_Pnt aPCirc2 = ElCLib::Value(aPar, aWorkCirc);
         Extrema_ExtPElC ExtPCir(aPCirc2,
-                                Extrema_CurveTool::Circle(*((Adaptor3d_Curve*) myC[0])),
+                                Extrema_CurveTool::Circle (*myC[0]),
                                 Precision::Confusion(), theUt11, theUt12);
 
         Standard_Real aMinSqD = ExtPCir.SquareDistance(1);
@@ -645,7 +682,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
         const Extrema_POnCurv aP2(aPar, aPCirc2);
 
         Extrema_ExtPElC ExtPCir(aPCirc2,
-                                Extrema_CurveTool::Circle(*((Adaptor3d_Curve*) myC[0])),
+                                Extrema_CurveTool::Circle (*myC[0]),
                                 Precision::Confusion(), theUt11, theUt12);
 
         Standard_Boolean isFound = !myIsPar;
@@ -723,11 +760,13 @@ void Extrema_ExtCC::PrepareResults(const Extrema_ExtElC&  AlgExt,
          U = P2.Parameter();
        }
 
-       if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[0]))) {
-         U = ElCLib::InPeriod(U, Ut11, Ut11+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[0])));
+       if (Extrema_CurveTool::IsPeriodic (*myC[0]))
+       {
+         U = ElCLib::InPeriod(U, Ut11, Ut11+Extrema_CurveTool::Period (*myC[0]));
        }
-       if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[1]))) {
-         U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[1])));
+       if (Extrema_CurveTool::IsPeriodic (*myC[1]))
+       {
+         U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Extrema_CurveTool::Period (*myC[1]));
        }
 
        if ((U  >= Ut11 - RealEpsilon())  && 
@@ -790,13 +829,13 @@ void Extrema_ExtCC::PrepareResults(const Extrema_ECC&   AlgExt,
         U2 = P2.Parameter();
 
         // Check points to be into param space.
-        if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*) myC[0])))
+        if (Extrema_CurveTool::IsPeriodic (*myC[0]))
         {
-          U = ElCLib::InPeriod(U, Ut11, Ut11 + Extrema_CurveTool::Period(*((Adaptor3d_Curve*) myC[0])));
+          U = ElCLib::InPeriod(U, Ut11, Ut11 + Extrema_CurveTool::Period (*myC[0]));
         }
-        if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*) myC[1])))
+        if (Extrema_CurveTool::IsPeriodic (*myC[1]))
         {
-          U2 = ElCLib::InPeriod(U2, Ut21, Ut21 + Extrema_CurveTool::Period(*((Adaptor3d_Curve*) myC[1])));
+          U2 = ElCLib::InPeriod(U2, Ut21, Ut21 + Extrema_CurveTool::Period (*myC[1]));
         }
 
         if ((U >= Ut11 - RealEpsilon()) &&
index d2ee29c0f54eb86edb7d3e5cd86046c74a800db1..9521c2833e034730ad46504a81da840f6649e84f 100644 (file)
@@ -53,6 +53,22 @@ public:
   
   //! It calculates all the distances.
   Standard_EXPORT Extrema_ExtCC(const Adaptor3d_Curve& C1, const Adaptor3d_Curve& C2, const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Real TolC1 = 1.0e-10, const Standard_Real TolC2 = 1.0e-10);
+
+  //! Initializes but does not perform algorithm.
+  Standard_EXPORT void Initialize (const Adaptor3d_Curve& C1,
+                                   const Adaptor3d_Curve& C2,
+                                   const Standard_Real TolC1 = 1.0e-10,
+                                   const Standard_Real TolC2 = 1.0e-10);
+
+  //! Initializes but does not perform algorithm.
+  Standard_EXPORT void Initialize (const Adaptor3d_Curve& C1,
+                                   const Adaptor3d_Curve& C2,
+                                   const Standard_Real U1,
+                                   const Standard_Real U2,
+                                   const Standard_Real V1,
+                                   const Standard_Real V2,
+                                   const Standard_Real TolC1 = 1.0e-10,
+                                   const Standard_Real TolC2 = 1.0e-10);
   
   Standard_EXPORT void SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C);
   
@@ -126,6 +142,11 @@ protected:
 
 private:
 
+  // disallow copies
+  Extrema_ExtCC            (Extrema_ExtCC& );
+  Extrema_ExtCC& operator= (Extrema_ExtCC& );
+
+private:
 
   Standard_Boolean myIsFindSingleSolution; // Default value is false.
   Extrema_ECC myECC;
@@ -133,7 +154,7 @@ private:
   Standard_Boolean myIsPar;
   Extrema_SequenceOfPOnCurv mypoints;
   TColStd_SequenceOfReal mySqDist;
-  Standard_Address myC[2];
+  const Adaptor3d_Curve* myC[2];
   Standard_Real myInf[2];
   Standard_Real mySup[2];
   Standard_Real myTol[2];
@@ -146,13 +167,6 @@ private:
   Standard_Real mydist21;
   Standard_Real mydist22;
 
-
 };
 
-
-
-
-
-
-
 #endif // _Extrema_ExtCC_HeaderFile
index 2fc69569f1df150d57545da2f004fd5cbad640f1..56ec32728f1ff18a154680b4535225dcd37f08ae 100644 (file)
@@ -87,7 +87,7 @@ void Extrema_ExtCC2d::Initialize(const Adaptor2d_Curve2d&        C2,
                                  const Standard_Real  TolC1,
                                  const Standard_Real  TolC2)
 {
-  myC = (Standard_Address)&C2;
+  myC = &C2;
   myv1 = V1;
   myv2 = V2;
   mytolc1 = TolC1;
@@ -102,7 +102,7 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
 {
   mypoints.Clear();
   mySqDist.Clear();
-  GeomAbs_CurveType type1 = Extrema_Curve2dTool::GetType(C1), type2 = Extrema_Curve2dTool::GetType(*((Adaptor2d_Curve2d*)myC));
+  GeomAbs_CurveType type1 = Extrema_Curve2dTool::GetType(C1), type2 = Extrema_Curve2dTool::GetType (*myC);
   Standard_Real U11, U12, U21, U22, Tol = Min(mytolc1, mytolc2);
 //  Extrema_POnCurv2d P1, P2;
   mynbext = 0;
@@ -115,8 +115,8 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
   U22 = myv2;
   P1f = Extrema_Curve2dTool::Value(C1, U11);
   P1l = Extrema_Curve2dTool::Value(C1, U12);
-  P2f = Extrema_Curve2dTool::Value(*((Adaptor2d_Curve2d*)myC), U21);
-  P2l = Extrema_Curve2dTool::Value(*((Adaptor2d_Curve2d*)myC), U22);
+  P2f = Extrema_Curve2dTool::Value(*myC, U21);
+  P2l = Extrema_Curve2dTool::Value(*myC, U22);
 
 
   switch(type1) {
@@ -128,36 +128,36 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
     switch(type2) {
       case GeomAbs_Line: {
        inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Circle(C1), Tol);
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*myC), Extrema_Curve2dTool::Circle(C1), Tol);
        Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
         }
        break;
       case GeomAbs_Circle: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Circle(*myC));
        Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI);
         }
        break;
       case GeomAbs_Ellipse: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Ellipse(*myC));
        Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI );
         }
        break;
       case GeomAbs_Parabola: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Parabola(*myC));
        Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
       }
        break;
       case GeomAbs_Hyperbola: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Hyperbola(*myC));
        Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0. );
       }
        break;
       default: {
-          Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+          Extrema_ECC2d aParamSolver(C1, *myC);
           aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
           aParamSolver.Perform();
           Standard_Real Period2 = 0.;
-          if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+          if (Extrema_Curve2dTool::IsPeriodic(*myC)) Period2 = Extrema_Curve2dTool::Period(*myC);
           Results(aParamSolver, U11, U12, U21, U22, 2*M_PI,Period2);
         }
        break;
@@ -173,46 +173,46 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
     switch(type2) {
       case GeomAbs_Line: {
         inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Ellipse(C1));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*myC), Extrema_Curve2dTool::Ellipse(C1));
        Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
         }
        break;
       case GeomAbs_Circle: {
        inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Ellipse(C1));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*myC), Extrema_Curve2dTool::Ellipse(C1));
        Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI);
         }
        break;
       case GeomAbs_Ellipse:
         {
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22,2*M_PI, 2*M_PI);
         }
        break;
       case GeomAbs_Parabola: {
-       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Parabola(*myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22, 2*M_PI, 0.);
       }
        break;
       case GeomAbs_Hyperbola: {
-       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Hyperbola(*myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22, 2*M_PI, 0.);
       }
        break;
       default: {
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Standard_Real Period2 = 0.;
-       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       if (Extrema_Curve2dTool::IsPeriodic(*myC)) Period2 = Extrema_Curve2dTool::Period(*myC);
        Results(aParamSolver, U11, U12, U21, U22, 2*M_PI,Period2);
         }
        break;
@@ -228,28 +228,28 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
     switch(type2) {
       case GeomAbs_Line: {
        inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*myC), Extrema_Curve2dTool::Parabola(C1));
        Results(Xtrem, U11, U12, U21, U22, 0., 0.);
         }
        break;
       case GeomAbs_Circle: {
        inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*myC), Extrema_Curve2dTool::Parabola(C1));
        Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
         }
        break;
       case GeomAbs_Ellipse: {
        //inverse = Standard_True;
-       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(*myC), Extrema_Curve2dTool::Parabola(C1));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22, 0., 2*M_PI);
         }
        break;
       case GeomAbs_Parabola: {
-       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Parabola(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Parabola(C1), Extrema_Curve2dTool::Parabola(*myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22, 0., 0.);
@@ -257,19 +257,19 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
        break;
       case GeomAbs_Hyperbola: {
        //inverse = Standard_True;
-       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(*myC), Extrema_Curve2dTool::Parabola(C1));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22, 0., 0.);
       }
        break;
       default: {
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Standard_Real Period2 = 0.;
-       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       if (Extrema_Curve2dTool::IsPeriodic(*myC)) Period2 = Extrema_Curve2dTool::Period(*myC);
        Results(aParamSolver, U11, U12, U21, U22, 0., Period2);
         }
        break;
@@ -285,47 +285,47 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
     switch(type2) {
       case GeomAbs_Line: {
        inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*myC), Extrema_Curve2dTool::Hyperbola(C1));
        Results(Xtrem, U11, U12, U21, U22, 0., 0.);
         }
        break;
       case GeomAbs_Circle: {
        inverse = Standard_True;
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*myC), Extrema_Curve2dTool::Hyperbola(C1));
        Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
         }
        break;
       case GeomAbs_Ellipse: {
        //inverse = Standard_True;
-       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(*myC), Extrema_Curve2dTool::Hyperbola(C1));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22, 0., 2*M_PI );
         }
        break;
       case GeomAbs_Parabola: {
-       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(C1), Extrema_Curve2dTool::Parabola(*myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22, 0., 0.);
       }
        break;
       case GeomAbs_Hyperbola: {
-       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       //Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(C1), Extrema_Curve2dTool::Hyperbola(*myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Results(aParamSolver, U11, U12, U21, U22, 0., 0.);
       }
        break;
       default: {
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Standard_Real Period2 = 0.;
-       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       if (Extrema_Curve2dTool::IsPeriodic(*myC)) Period2 = Extrema_Curve2dTool::Period(*myC);
        Results(aParamSolver, U11, U12, U21, U22, 0., Period2);
         }
        break;
@@ -340,36 +340,36 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
 
     switch(type2) {
       case GeomAbs_Line: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Tol);
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Line(*myC), Tol);
        Results(Xtrem, U11, U12, U21, U22, 0., 0.);
         } 
        break;
       case GeomAbs_Circle: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Tol);
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Circle(*myC), Tol);
        Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
         }
        break;
       case GeomAbs_Ellipse: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Ellipse(*myC));
        Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
         }
        break;
       case GeomAbs_Parabola: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Parabola(*myC));
        Results(Xtrem, U11, U12, U21, U22, 0., 0.);
       }
        break;
       case GeomAbs_Hyperbola: {
-       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
+       Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Hyperbola(*myC));
        Results(Xtrem, U11, U12, U21, U22, 0., 0.);
       }
        break;
       default: {
-       Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+       Extrema_ECC2d aParamSolver(C1, *myC);
         aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
         aParamSolver.Perform();
        Standard_Real Period2 = 0.;
-       if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+       if (Extrema_Curve2dTool::IsPeriodic(*myC)) Period2 = Extrema_Curve2dTool::Period(*myC);
        Results(aParamSolver, U11, U12, U21, U22, 0., Period2);
         }
        break;
@@ -381,13 +381,13 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d&       C1,
     // La premiere courbe est une BezierCurve ou une BSplineCurve:
     //
   default: {
-    Extrema_ECC2d aParamSolver(C1, *((Adaptor2d_Curve2d*)myC));
+    Extrema_ECC2d aParamSolver(C1, *myC);
     aParamSolver.SetSingleSolutionFlag(GetSingleSolutionFlag());
     aParamSolver.Perform();
     Standard_Real Period1 = 0.;
     if (Extrema_Curve2dTool::IsPeriodic(C1)) Period1 = Extrema_Curve2dTool::Period(C1);
     Standard_Real Period2 = 0.;
-    if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
+    if (Extrema_Curve2dTool::IsPeriodic(*myC)) Period2 = Extrema_Curve2dTool::Period(*myC);
     Results(aParamSolver, U11, U12, U21, U22, Period1, Period2);
     }
     break;
index 43267b29f784cb5700046f0dbf7e3a2fa43b9eb5..b41eaa5ba21625d47d25f44ca4452e4faa27142a 100644 (file)
@@ -107,7 +107,7 @@ private:
   TColStd_SequenceOfReal mySqDist;
   Standard_Integer mynbext;
   Standard_Boolean inverse;
-  Standard_Address myC;
+  const Adaptor2d_Curve2d* myC;
   Standard_Real myv1;
   Standard_Real myv2;
   Standard_Real mytolc1;
index 91d87758dea33041c98721bb8ca80dbc1ca3911b..5f85ef99d1ac843247d04234a688ec5fae2b62d1 100644 (file)
@@ -63,9 +63,7 @@ Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve&   C,
   const Standard_Real    TolS)
 
 {
-  Initialize(S, S.FirstUParameter(), S.LastUParameter(), 
-    S.FirstVParameter(), S.LastVParameter(), 
-    TolC, TolS);
+  Initialize (S, TolC, TolS);
   Perform(C, C.FirstParameter(), C.LastParameter());
 }
 
@@ -85,6 +83,12 @@ Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve&   C,
   Perform(C, UCinf, UCsup);
 }
 
+void Extrema_ExtCS::Initialize (const Adaptor3d_Surface& S, const Standard_Real TolC, const Standard_Real TolS)
+{
+  Initialize (S, S.FirstUParameter(), S.LastUParameter(),
+              S.FirstVParameter(), S.LastVParameter(),
+              TolC, TolS);
+}
 
 void Extrema_ExtCS::Initialize(const Adaptor3d_Surface& S,
   const Standard_Real    Uinf, 
@@ -94,7 +98,7 @@ void Extrema_ExtCS::Initialize(const Adaptor3d_Surface& S,
   const Standard_Real    TolC,
   const Standard_Real    TolS)
 {
-  myS = (Adaptor3d_SurfacePtr)&S;
+  myS = &S;
   myIsPar = Standard_False;
   myuinf  = Uinf;
   myusup  = Usup;
index 316688fdb9adc6246be44fe5a58d57c90699774a..689a8f67fa66368fcfcf536925bb7f7294067094 100644 (file)
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Adaptor3d_SurfacePtr.hxx>
-#include <Standard_Boolean.hxx>
 #include <Extrema_ExtElCS.hxx>
 #include <Extrema_SequenceOfPOnSurf.hxx>
 #include <Extrema_SequenceOfPOnCurv.hxx>
-#include <Standard_Real.hxx>
 #include <TColStd_SequenceOfReal.hxx>
 #include <GeomAbs_SurfaceType.hxx>
-#include <Standard_Integer.hxx>
-class StdFail_NotDone;
-class Standard_OutOfRange;
-class Standard_TypeMismatch;
+
 class Adaptor3d_Curve;
 class Adaptor3d_Surface;
 class Extrema_POnCurv;
@@ -59,7 +53,10 @@ public:
   //! UCinf and UCmax are the start and end parameters
   //! of the curve.
   Standard_EXPORT Extrema_ExtCS(const Adaptor3d_Curve& C, const Adaptor3d_Surface& S, const Standard_Real UCinf, const Standard_Real UCsup, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolC, const Standard_Real TolS);
-  
+
+  //! Initializes the fields of the algorithm.
+  Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Real TolC, const Standard_Real TolS);
+
   //! Initializes the fields of the algorithm.
   Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolC, const Standard_Real TolS);
   
@@ -83,24 +80,19 @@ public:
   //! Returns the point of the Nth resulting distance.
   Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnCurv& P1, Extrema_POnSurf& P2) const;
 
+private:
 
-
-
-protected:
-
-
-
-
+  Standard_EXPORT Standard_Boolean AddSolution (const Adaptor3d_Curve& Curve, const Standard_Real T, const Standard_Real U, const Standard_Real V, const gp_Pnt& PointOnCurve, const gp_Pnt& PointOnSurf, const Standard_Real SquareDist);
 
 private:
 
-  
-  Standard_EXPORT Standard_Boolean AddSolution (const Adaptor3d_Curve& Curve, const Standard_Real T, const Standard_Real U, const Standard_Real V, const gp_Pnt& PointOnCurve, const gp_Pnt& PointOnSurf, const Standard_Real SquareDist);
-  
-  Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const;
+  // disallow copies
+  Extrema_ExtCS            (Extrema_ExtCS& );
+  Extrema_ExtCS& operator= (Extrema_ExtCS& );
 
+private:
 
-  Adaptor3d_SurfacePtr myS;
+  const Adaptor3d_Surface* myS;
   Standard_Boolean myDone;
   Standard_Boolean myIsPar;
   Extrema_ExtElCS myExtElCS;
@@ -117,13 +109,6 @@ private:
   TColStd_SequenceOfReal mySqDist;
   GeomAbs_SurfaceType myStype;
 
-
 };
 
-
-
-
-
-
-
 #endif // _Extrema_ExtCS_HeaderFile
index 93e3347ca99e3095166450c05dd78036d0bd3530..dcf52c1b8c90f2e676c696a1205d3c803392a345 100644 (file)
@@ -187,7 +187,7 @@ static Standard_Boolean IsOriginalPnt (const gp_Pnt& P,
 //=======================================================================
 
 static Standard_Boolean IsExtremum (const Standard_Real U, const Standard_Real V,
-                                   const gp_Pnt& P, const Adaptor3d_SurfacePtr& S,
+                                   const gp_Pnt& P, const Adaptor3d_Surface* S,
                                    gp_Pnt& E,        Standard_Real& Dist2,
                                    const Standard_Boolean IsVSup,
                                    const Standard_Boolean IsMin)
index ba8da723a58a774713f8a0cbe22bd47ce0569bda..341758fa28e9d61165072b944ee443adcf8f36f8 100644 (file)
@@ -230,7 +230,7 @@ void Extrema_ExtPS::Initialize (const Adaptor3d_Surface& theS,
                                 const Standard_Real      theTolU,
                                 const Standard_Real      theTolV)
 {
-  myS = (Adaptor3d_SurfacePtr)&theS;
+  myS = &theS;
   myuinf = theUinf;
   myusup = theUsup;
   myvinf = theVinf;
index 18dada36514925b8f8275262513a689b36769d03..e207b95742c432e91d6cf390eac56108767fe422 100644 (file)
@@ -21,8 +21,6 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Adaptor3d_SurfacePtr.hxx>
-#include <Standard_Boolean.hxx>
 #include <Extrema_ExtPElS.hxx>
 #include <Extrema_GenExtPS.hxx>
 #include <Extrema_SequenceOfPOnSurf.hxx>
@@ -110,24 +108,13 @@ public:
   
   Standard_EXPORT void SetAlgo (const Extrema_ExtAlgo A);
 
-
-
-
-protected:
-
-
-
-
-
 private:
-
-  
-  Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const;
   
   Standard_EXPORT void TreatSolution (const Extrema_POnSurf& PS, const Standard_Real Val);
 
+private:
 
-  Adaptor3d_SurfacePtr myS;
+  const Adaptor3d_Surface* myS;
   Standard_Boolean myDone;
   Extrema_ExtPElS myExtPElS;
   Extrema_GenExtPS myExtPS;
@@ -151,13 +138,6 @@ private:
   Handle(Extrema_ExtPExtS) myExtPExtS;
   Handle(Extrema_ExtPRevS) myExtPRevS;
 
-
 };
 
-
-
-
-
-
-
 #endif // _Extrema_ExtPS_HeaderFile
index 52845d39e67c1067418b0e7838d87e0eee82472c..b6b002c3666af6ab313f076d5aedf548118deecc 100644 (file)
@@ -88,7 +88,7 @@ void Extrema_ExtSS::Initialize(const Adaptor3d_Surface&  S2,
                               const Standard_Real Vsup2,
                               const Standard_Real TolS2)
 {
-  myS2 = (Adaptor3d_SurfacePtr)&S2;
+  myS2 = &S2;
   myIsPar = Standard_False;
   myuinf2  = Uinf2;
   myusup2  = Usup2;
index 141229011fe4b5d8b27ff84b3b4738e05df7d707..64956956c74e4c806d029b9dc98066d88c031c97 100644 (file)
@@ -21,8 +21,6 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Adaptor3d_SurfacePtr.hxx>
-#include <Standard_Boolean.hxx>
 #include <Extrema_ExtElSS.hxx>
 #include <Extrema_SequenceOfPOnSurf.hxx>
 #include <Standard_Real.hxx>
@@ -77,22 +75,9 @@ public:
   //! Returns the point of the Nth resulting distance.
   Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnSurf& P1, Extrema_POnSurf& P2) const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-  
-  Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const;
-
-
-  Adaptor3d_SurfacePtr myS2;
+  const Adaptor3d_Surface* myS2;
   Standard_Boolean myDone;
   Standard_Boolean myIsPar;
   Extrema_ExtElSS myExtElSS;
@@ -111,13 +96,6 @@ private:
   TColStd_SequenceOfReal mySqDist;
   GeomAbs_SurfaceType myStype;
 
-
 };
 
-
-
-
-
-
-
 #endif // _Extrema_ExtSS_HeaderFile
index 230dfeb17ae848901df6e3e532758d9d48562efc..a4889c43b8ae3c8831a0a02d13706222d60ed313 100644 (file)
@@ -80,8 +80,8 @@ les algorithmes math_FunctionRoot et math_FunctionRoots.
 void Extrema_FuncExtCS::Initialize(const Adaptor3d_Curve& C, 
                                   const Adaptor3d_Surface& S)
 {
-  myC = (Adaptor3d_CurvePtr)&C;
-  myS = (Adaptor3d_SurfacePtr)&S;
+  myC = &C;
+  myS = &S;
   myCinit = Standard_True;
   mySinit = Standard_True;
   myPoint1.Clear();
@@ -267,24 +267,3 @@ const Extrema_POnSurf& Extrema_FuncExtCS::PointOnSurface(const Standard_Integer
   if (!myCinit || !mySinit) throw Standard_TypeMismatch();
   return myPoint2.Value(N);
 }
-
-//=======================================================================
-//function : Bidon1
-//purpose  : 
-//=======================================================================
-
-Adaptor3d_SurfacePtr Extrema_FuncExtCS::Bidon1() const 
-{
-  return (Adaptor3d_SurfacePtr)0L;
-}
-
-//=======================================================================
-//function : Bidon2
-//purpose  : 
-//=======================================================================
-
-Adaptor3d_CurvePtr Extrema_FuncExtCS::Bidon2() const 
-{
-  return (Adaptor3d_CurvePtr)0L;
-}
-
index 4a07792a3caab71b7f5a9c9533c37c14e000b757..70aa2b2cfbb6016e4c8ec03214195686ed270430 100644 (file)
@@ -21,8 +21,6 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Adaptor3d_CurvePtr.hxx>
-#include <Adaptor3d_SurfacePtr.hxx>
 #include <gp_Pnt.hxx>
 #include <Standard_Real.hxx>
 #include <TColStd_SequenceOfReal.hxx>
@@ -84,25 +82,10 @@ public:
   //! Return the Nth extremum on S.
   Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-  
-  Standard_EXPORT Adaptor3d_SurfacePtr Bidon1() const;
-  
-  Standard_EXPORT Adaptor3d_CurvePtr Bidon2() const;
-
-
-  Adaptor3d_CurvePtr myC;
-  Adaptor3d_SurfacePtr myS;
+  const Adaptor3d_Curve* myC;
+  const Adaptor3d_Surface* myS;
   gp_Pnt myP1;
   gp_Pnt myP2;
   Standard_Real myt;
@@ -114,13 +97,6 @@ private:
   Standard_Boolean myCinit;
   Standard_Boolean mySinit;
 
-
 };
 
-
-
-
-
-
-
 #endif // _Extrema_FuncExtCS_HeaderFile
index b311ef0c0ecd0126f19846196375e73fed033a2a..10ac91d078ec13ca360401b65af52a9d37ad0fec 100644 (file)
@@ -79,8 +79,8 @@ Extrema_FuncExtSS::Extrema_FuncExtSS (const Adaptor3d_Surface& S1,
   myU2(0.0),
   myV2(0.0)
 {
-  myS1 = (Adaptor3d_SurfacePtr)&S1;
-  myS2 = (Adaptor3d_SurfacePtr)&S2;
+  myS1 = &S1;
+  myS2 = &S2;
   myS1init = Standard_True;
   myS2init = Standard_True;
 }
@@ -93,8 +93,8 @@ Extrema_FuncExtSS::Extrema_FuncExtSS (const Adaptor3d_Surface& S1,
 void Extrema_FuncExtSS::Initialize(const Adaptor3d_Surface& S1,
                                   const Adaptor3d_Surface& S2)
 {
-  myS1 = (Adaptor3d_SurfacePtr)&S1;
-  myS2 = (Adaptor3d_SurfacePtr)&S2;
+  myS1 = &S1;
+  myS2 = &S2;
   myS1init = Standard_True;
   myS2init = Standard_True;
   myPoint1.Clear();
index f8423716efe69a7b97b1bf2cbeb844510e6e4e1a..a432b3758c3bef918993e74039f7d88d3d9a3a84 100644 (file)
@@ -21,7 +21,6 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Adaptor3d_SurfacePtr.hxx>
 #include <gp_Pnt.hxx>
 #include <Standard_Real.hxx>
 #include <TColStd_SequenceOfReal.hxx>
@@ -80,23 +79,10 @@ public:
   //! Renvoie le Nieme extremum sur S2.
   Standard_EXPORT const Extrema_POnSurf& PointOnS2 (const Standard_Integer N) const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-  
-  Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const;
-
-
-  Adaptor3d_SurfacePtr myS1;
-  Adaptor3d_SurfacePtr myS2;
+  const Adaptor3d_Surface* myS1;
+  const Adaptor3d_Surface* myS2;
   gp_Pnt myP1;
   gp_Pnt myP2;
   Standard_Real myU1;
@@ -109,13 +95,6 @@ private:
   Standard_Boolean myS1init;
   Standard_Boolean myS2init;
 
-
 };
 
-
-
-
-
-
-
 #endif // _Extrema_FuncExtSS_HeaderFile
index d73d0b9740a4fc69fa32efcd465290a6e1bac41c..c234091f9755d36f1aae579ff8803bd31ebbb475 100644 (file)
@@ -41,7 +41,7 @@ Extrema_FuncPSNorm::Extrema_FuncPSNorm (const gp_Pnt& P,
   myV(0.0)
 {
   myP = P;
-  myS = (Adaptor3d_SurfacePtr)&S;
+  myS = &S;
   myPinit = Standard_True;
   mySinit = Standard_True;
 }
@@ -49,7 +49,7 @@ Extrema_FuncPSNorm::Extrema_FuncPSNorm (const gp_Pnt& P,
 //=============================================================================
 void Extrema_FuncPSNorm::Initialize(const Adaptor3d_Surface& S)
 {
-  myS = (Adaptor3d_SurfacePtr)&S;
+  myS = &S;
   mySinit = Standard_True;
   myPoint.Clear();
   mySqDist.Clear();
index 275f0f249f358e2262a4f4e417469fa06041b600..f11f46e3edec582be5dcd6f9d84c443cbd4ddbb2 100644 (file)
 #include <Standard_DefineAlloc.hxx>
 
 #include <gp_Pnt.hxx>
-#include <Adaptor3d_SurfacePtr.hxx>
-#include <Standard_Real.hxx>
 #include <TColStd_SequenceOfReal.hxx>
 #include <Extrema_SequenceOfPOnSurf.hxx>
 #include <Standard_Boolean.hxx>
 #include <math_FunctionSetWithDerivatives.hxx>
 #include <Standard_Integer.hxx>
 #include <math_Vector.hxx>
-class Standard_OutOfRange;
-class gp_Pnt;
+
 class Adaptor3d_Surface;
 class math_Matrix;
 class Extrema_POnSurf;
@@ -102,7 +99,7 @@ public:
 private:
 
   gp_Pnt myP;
-  Adaptor3d_SurfacePtr myS;
+  const Adaptor3d_Surface* myS;
   Standard_Real myU;
   Standard_Real myV;
   gp_Pnt myPs;
index a193ba32b700d16b8bc03170bb811e7eeedc6349..0642f5dccca36a7da38856f9031773b263c9832c 100644 (file)
@@ -191,7 +191,7 @@ void Extrema_GenExtCS::Initialize (const Adaptor3d_Surface& S,
                                    const Standard_Real Vsup,
                                    const Standard_Real Tol2)
 {
-  myS = (Adaptor3d_SurfacePtr)&S;
+  myS = &S;
   myusample = NbU;
   myvsample = NbV;
   myumin = Umin;
@@ -791,22 +791,3 @@ const Extrema_POnSurf& Extrema_GenExtCS::PointOnSurface(const Standard_Integer N
 
   return myF.PointOnSurface(N);
 }
-
-//=======================================================================
-//function : BidonSurface
-//purpose  : 
-//=======================================================================
-Adaptor3d_SurfacePtr Extrema_GenExtCS::BidonSurface() const 
-{
-  return (Adaptor3d_SurfacePtr)0L;
-}
-
-//=======================================================================
-//function : BidonCurve
-//purpose  : 
-//=======================================================================
-Adaptor3d_CurvePtr Extrema_GenExtCS::BidonCurve() const 
-{
-  return (Adaptor3d_CurvePtr)0L;
-}
-
index 2f043a8ef691a2782cc53c19d34c479cf4bcce36..758850aed96a56a3e834cda2b9649d4854b60cff 100644 (file)
 #ifndef _Extrema_GenExtCS_HeaderFile
 #define _Extrema_GenExtCS_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_Integer.hxx>
 #include <Extrema_FuncExtCS.hxx>
-#include <Adaptor3d_SurfacePtr.hxx>
 #include <TColgp_HArray2OfPnt.hxx>
-#include <Adaptor3d_CurvePtr.hxx>
 
-class StdFail_NotDone;
-class Standard_OutOfRange;
-class Standard_TypeMismatch;
 class Adaptor3d_Curve;
 class Adaptor3d_Surface;
 class Extrema_POnCurv;
@@ -97,22 +85,8 @@ public:
   //! Returns the point of the Nth resulting distance.
   Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-  
-  Standard_EXPORT Adaptor3d_CurvePtr BidonCurve() const;
-  
-  Standard_EXPORT Adaptor3d_SurfacePtr BidonSurface() const;
-
   Standard_EXPORT void GlobMinGenCS(const Adaptor3d_Curve& theC,
     const Standard_Integer theNbParticles,
     const math_Vector& theTUVinf,
@@ -131,6 +105,13 @@ private:
     const math_Vector& theTUVsup,
     math_Vector& theTUV);
 
+private:
+
+  // disallow copies
+  Extrema_GenExtCS            (const Extrema_GenExtCS& );
+  Extrema_GenExtCS& operator= (const Extrema_GenExtCS& );
+
+private:
 
   Standard_Boolean myDone;
   Standard_Real mytmin;
@@ -145,16 +126,9 @@ private:
   Standard_Real mytol1;
   Standard_Real mytol2;
   Extrema_FuncExtCS myF;
-  Adaptor3d_SurfacePtr myS;
+  const Adaptor3d_Surface* myS;
   Handle(TColgp_HArray2OfPnt) mySurfPnts;
 
-
 };
 
-
-
-
-
-
-
 #endif // _Extrema_GenExtCS_HeaderFile
index 0c904465705fb12565b9e6816503a5dcbfbf2bfb..43a82c55f728c1fe1afb2476c20bfb6783f89db7 100644 (file)
@@ -295,7 +295,7 @@ void Extrema_GenExtPS::Initialize(const Adaptor3d_Surface& S,
                                   const Standard_Real    TolU, 
                                   const Standard_Real    TolV)
 {
-  myS = (Adaptor3d_SurfacePtr)&S;
+  myS = &S;
   myusample = NbU;
   myvsample = NbV;
   mytolu = TolU;
@@ -550,8 +550,7 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt &thePoint)
     }
 
     //If flag was changed and extrema not reinitialized Extrema would fail
-    myPoints = new Extrema_HArray2OfPOnSurfParams
-      (0, myusample + 1, 0, myvsample + 1);
+    myPoints.Resize (0, myusample + 1, 0, myvsample + 1, false);
     // Calculation of distances
   
     for ( NoU = 1 ; NoU <= myusample; NoU++ ) {
@@ -562,28 +561,24 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt &thePoint)
 
         aParam.SetElementType(Extrema_Node);
         aParam.SetIndices(NoU, NoV);
-        myPoints->SetValue(NoU, NoV, aParam);
+        myPoints.SetValue(NoU, NoV, aParam);
       }
     }
 
-    myFacePntParams = 
-      new Extrema_HArray2OfPOnSurfParams(0, myusample, 0, myvsample);
-
-    myUEdgePntParams =
-      new Extrema_HArray2OfPOnSurfParams(1, myusample - 1, 1, myvsample);
-    myVEdgePntParams =
-      new Extrema_HArray2OfPOnSurfParams(1, myusample, 1, myvsample - 1);
+    myFacePntParams .Resize (0, myusample,     0, myvsample, false);
+    myUEdgePntParams.Resize (1, myusample - 1, 1, myvsample, false);
+    myVEdgePntParams.Resize (1, myusample,     1, myvsample - 1, false);
 
     // Fill boundary with negative square distance.
     // It is used for computation of Maximum.
     for (NoV = 0; NoV <= myvsample + 1; NoV++) {
-      myPoints->ChangeValue(0, NoV).SetSqrDistance(-1.);
-      myPoints->ChangeValue(myusample + 1, NoV).SetSqrDistance(-1.);
+      myPoints.ChangeValue(0, NoV).SetSqrDistance(-1.);
+      myPoints.ChangeValue(myusample + 1, NoV).SetSqrDistance(-1.);
     }
 
     for (NoU = 1; NoU <= myusample; NoU++) {
-      myPoints->ChangeValue(NoU, 0).SetSqrDistance(-1.);
-      myPoints->ChangeValue(NoU, myvsample + 1).SetSqrDistance(-1.);
+      myPoints.ChangeValue(NoU, 0).SetSqrDistance(-1.);
+      myPoints.ChangeValue(NoU, myvsample + 1).SetSqrDistance(-1.);
     }
     
     myInit = Standard_True;
@@ -593,7 +588,7 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt &thePoint)
   // Step 1. Compute distances to nodes.
   for ( NoU = 1 ; NoU <= myusample; NoU++ ) {
     for ( NoV = 1 ; NoV <= myvsample; NoV++) {
-      Extrema_POnSurfParams &aParam = myPoints->ChangeValue(NoU, NoV);
+      Extrema_POnSurfParams &aParam = myPoints.ChangeValue(NoU, NoV);
 
       aParam.SetSqrDistance(thePoint.SquareDistance(aParam.Value()));
     }
@@ -613,24 +608,24 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt &thePoint)
     {
       for ( NoV = 1 ; NoV <= myvsample; NoV++)
       {
-        const Extrema_POnSurfParams &aParam0 = myPoints->Value(NoU, NoV);
+        const Extrema_POnSurfParams &aParam0 = myPoints.Value(NoU, NoV);
 
         if (NoU < myusample)
         {
           // Compute parameters to UEdge.
-          const Extrema_POnSurfParams &aParam1 = myPoints->Value(NoU + 1, NoV);
+          const Extrema_POnSurfParams &aParam1 = myPoints.Value(NoU + 1, NoV);
           const Extrema_POnSurfParams &anEdgeParam = ComputeEdgeParameters(Standard_True, aParam0, aParam1, thePoint, aDiffTol);
 
-          myUEdgePntParams->SetValue(NoU, NoV, anEdgeParam);
+          myUEdgePntParams.SetValue(NoU, NoV, anEdgeParam);
         }
 
         if (NoV < myvsample)
         {
           // Compute parameters to VEdge.
-          const Extrema_POnSurfParams &aParam1 = myPoints->Value(NoU, NoV + 1);
+          const Extrema_POnSurfParams &aParam1 = myPoints.Value(NoU, NoV + 1);
           const Extrema_POnSurfParams &anEdgeParam = ComputeEdgeParameters(Standard_False, aParam0, aParam1, thePoint, aDiffTol);
 
-          myVEdgePntParams->SetValue(NoU, NoV, anEdgeParam);
+          myVEdgePntParams.SetValue(NoU, NoV, anEdgeParam);
         }
       }
     }
@@ -646,10 +641,10 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt &thePoint)
 
     for ( NoU = 1 ; NoU < myusample; NoU++ ) {
       for ( NoV = 1 ; NoV < myvsample; NoV++) {
-        const Extrema_POnSurfParams &aUE0 = myUEdgePntParams->Value(NoU, NoV);
-        const Extrema_POnSurfParams &aUE1 = myUEdgePntParams->Value(NoU, NoV+1);
-        const Extrema_POnSurfParams &aVE0 = myVEdgePntParams->Value(NoU, NoV);
-        const Extrema_POnSurfParams &aVE1 = myVEdgePntParams->Value(NoU+1, NoV);
+        const Extrema_POnSurfParams &aUE0 = myUEdgePntParams.Value(NoU, NoV);
+        const Extrema_POnSurfParams &aUE1 = myUEdgePntParams.Value(NoU, NoV+1);
+        const Extrema_POnSurfParams &aVE0 = myVEdgePntParams.Value(NoU, NoV);
+        const Extrema_POnSurfParams &aVE1 = myVEdgePntParams.Value(NoU+1, NoV);
 
         aSqrDist01 = aUE0.Value().SquareDistance(aUE1.Value());
         aDiffDist = Abs(aUE0.GetSqrDistance() - aUE1.GetSqrDistance());
@@ -677,7 +672,7 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt &thePoint)
           const Extrema_POnSurfParams &aEMin =
             aUEMin.GetSqrDistance() < aVEMin.GetSqrDistance() ? aUEMin : aVEMin;
 
-          myFacePntParams->SetValue(NoU, NoV, aEMin);
+          myFacePntParams.SetValue(NoU, NoV, aEMin);
         } else {
           // Find closest point inside the face.
           Standard_Real aU[2];
@@ -699,20 +694,20 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt &thePoint)
           aParam.SetElementType(Extrema_Face);
           aParam.SetSqrDistance(thePoint.SquareDistance(aParam.Value()));
           aParam.SetIndices(NoU, NoV);
-          myFacePntParams->SetValue(NoU, NoV, aParam);
+          myFacePntParams.SetValue(NoU, NoV, aParam);
         }
       }
     }
 
     // Fill boundary with RealLast square distance.
     for (NoV = 0; NoV <= myvsample; NoV++) {
-      myFacePntParams->ChangeValue(0, NoV).SetSqrDistance(RealLast());
-      myFacePntParams->ChangeValue(myusample, NoV).SetSqrDistance(RealLast());
+      myFacePntParams.ChangeValue(0, NoV).SetSqrDistance(RealLast());
+      myFacePntParams.ChangeValue(myusample, NoV).SetSqrDistance(RealLast());
     }
 
     for (NoU = 1; NoU < myusample; NoU++) {
-      myFacePntParams->ChangeValue(NoU, 0).SetSqrDistance(RealLast());
-      myFacePntParams->ChangeValue(NoU, myvsample).SetSqrDistance(RealLast());
+      myFacePntParams.ChangeValue(NoU, 0).SetSqrDistance(RealLast());
+      myFacePntParams.ChangeValue(NoU, myvsample).SetSqrDistance(RealLast());
     }
   }
 }
@@ -831,7 +826,7 @@ void Extrema_GenExtPS::Perform(const gp_Pnt& P)
       for (NoU = 1; NoU < myusample; NoU++) {
         for (NoV = 1; NoV < myvsample; NoV++) {
           const Extrema_POnSurfParams &aParam =
-            myFacePntParams->Value(NoU, NoV);
+            myFacePntParams.Value(NoU, NoV);
 
           isMin = Standard_False;
           anElemType = aParam.GetElementType();
@@ -857,7 +852,7 @@ void Extrema_GenExtPS::Perform(const gp_Pnt& P)
                 (anElemType == Extrema_Node && (iU == 1 || iU == myusample))) {
                 // Check the down face.
                 const Extrema_POnSurfParams &aDownParam =
-                    myFacePntParams->Value(NoU, NoV - 1);
+                    myFacePntParams.Value(NoU, NoV - 1);
 
                 if (aDownParam.GetElementType() == anElemType) {
                   aDownParam.GetIndices(iU2, iV2);
@@ -867,7 +862,7 @@ void Extrema_GenExtPS::Perform(const gp_Pnt& P)
                 (anElemType == Extrema_Node && (iV == 1 || iV == myvsample))) {
                 // Check the right face.
                 const Extrema_POnSurfParams &aRightParam =
-                    myFacePntParams->Value(NoU - 1, NoV);
+                    myFacePntParams.Value(NoU - 1, NoV);
 
                 if (aRightParam.GetElementType() == anElemType) {
                   aRightParam.GetIndices(iU2, iV2);
@@ -879,9 +874,9 @@ void Extrema_GenExtPS::Perform(const gp_Pnt& P)
                 isMin = Standard_True;
 
                 const Extrema_POnSurfParams *anOtherParam[3] =
-                { &myFacePntParams->Value(NoU, NoV - 1),     // Down
-                  &myFacePntParams->Value(NoU - 1, NoV - 1), // Lower-left
-                  &myFacePntParams->Value(NoU - 1, NoV) };   // Left
+                { &myFacePntParams.Value(NoU, NoV - 1),     // Down
+                  &myFacePntParams.Value(NoU - 1, NoV - 1), // Lower-left
+                  &myFacePntParams.Value(NoU - 1, NoV) };   // Left
 
                 for (i = 0; i < 3 && isMin; i++) {
                   if (anOtherParam[i]->GetElementType() == Extrema_Node) {
@@ -910,15 +905,15 @@ void Extrema_GenExtPS::Perform(const gp_Pnt& P)
       {
         for (NoV = 1; NoV <= myvsample; NoV++)
         {
-          const Extrema_POnSurfParams &aParamMain = myPoints->Value(NoU, NoV);
-          const Extrema_POnSurfParams &aParam1 = myPoints->Value(NoU - 1, NoV - 1);
-          const Extrema_POnSurfParams &aParam2 = myPoints->Value(NoU - 1, NoV);
-          const Extrema_POnSurfParams &aParam3 = myPoints->Value(NoU - 1, NoV + 1);
-          const Extrema_POnSurfParams &aParam4 = myPoints->Value(NoU, NoV - 1);
-          const Extrema_POnSurfParams &aParam5 = myPoints->Value(NoU, NoV + 1);
-          const Extrema_POnSurfParams &aParam6 = myPoints->Value(NoU + 1, NoV - 1);
-          const Extrema_POnSurfParams &aParam7 = myPoints->Value(NoU + 1, NoV);
-          const Extrema_POnSurfParams &aParam8 = myPoints->Value(NoU + 1, NoV + 1);
+          const Extrema_POnSurfParams &aParamMain = myPoints.Value(NoU, NoV);
+          const Extrema_POnSurfParams &aParam1 = myPoints.Value(NoU - 1, NoV - 1);
+          const Extrema_POnSurfParams &aParam2 = myPoints.Value(NoU - 1, NoV);
+          const Extrema_POnSurfParams &aParam3 = myPoints.Value(NoU - 1, NoV + 1);
+          const Extrema_POnSurfParams &aParam4 = myPoints.Value(NoU, NoV - 1);
+          const Extrema_POnSurfParams &aParam5 = myPoints.Value(NoU, NoV + 1);
+          const Extrema_POnSurfParams &aParam6 = myPoints.Value(NoU + 1, NoV - 1);
+          const Extrema_POnSurfParams &aParam7 = myPoints.Value(NoU + 1, NoV);
+          const Extrema_POnSurfParams &aParam8 = myPoints.Value(NoU + 1, NoV + 1);
 
           Dist = aParamMain.GetSqrDistance();
 
@@ -932,7 +927,7 @@ void Extrema_GenExtPS::Perform(const gp_Pnt& P)
               (aParam8.GetSqrDistance() <= Dist))
           {
             // Find maximum.
-            FindSolution(P, myPoints->Value(NoU, NoV));
+            FindSolution(P, myPoints.Value(NoU, NoV));
           }
         }
       }
index 389469ca137e277eb97c476f57987cb3b6ef32bb..3f64783bd32fbc9a7340036db7e7643d5173c052 100644 (file)
 #ifndef _Extrema_GenExtPS_HeaderFile
 #define _Extrema_GenExtPS_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_Integer.hxx>
-#include <Extrema_HArray2OfPOnSurfParams.hxx>
-#include <Extrema_HUBTreeOfSphere.hxx>
 #include <Bnd_HArray1OfSphere.hxx>
+#include <Extrema_Array2OfPOnSurfParams.hxx>
+#include <Extrema_POnSurfParams.hxx>
+#include <Extrema_HUBTreeOfSphere.hxx>
 #include <Extrema_FuncPSNorm.hxx>
-#include <Adaptor3d_SurfacePtr.hxx>
 #include <Extrema_ExtFlag.hxx>
 #include <Extrema_ExtAlgo.hxx>
 #include <TColStd_HArray1OfReal.hxx>
-#include <Extrema_POnSurfParams.hxx>
-class StdFail_NotDone;
-class Standard_OutOfRange;
-class Standard_TypeMismatch;
-class gp_Pnt;
-class Adaptor3d_Surface;
-class Extrema_POnSurf;
-class Extrema_POnSurfParams;
 
+class Adaptor3d_Surface;
 
 //! It calculates all the extremum distances
 //! between a point and a surface.
@@ -51,7 +37,6 @@ public:
 
   DEFINE_STANDARD_ALLOC
 
-  
   Standard_EXPORT Extrema_GenExtPS();
   
   //! It calculates all the distances.
@@ -107,19 +92,7 @@ public:
   //! Returns the point of the Nth resulting distance.
   Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
-
-  
-  Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const;
   
   Standard_EXPORT void BuildTree();
   
@@ -134,6 +107,13 @@ private:
   //! Compute new edge parameters.
   Standard_EXPORT const Extrema_POnSurfParams& ComputeEdgeParameters (const Standard_Boolean IsUEdge, const Extrema_POnSurfParams& theParam0, const Extrema_POnSurfParams& theParam1, const gp_Pnt& thePoints, const Standard_Real theDiffTol);
 
+private:
+
+  // disallow copies
+  Extrema_GenExtPS            (const Extrema_GenExtPS& );
+  Extrema_GenExtPS& operator= (const Extrema_GenExtPS& );
+
+private:
 
   Standard_Boolean myDone;
   Standard_Boolean myInit;
@@ -145,27 +125,21 @@ private:
   Standard_Integer myvsample;
   Standard_Real mytolu;
   Standard_Real mytolv;
-  Handle(Extrema_HArray2OfPOnSurfParams) myPoints;
+
+  Extrema_Array2OfPOnSurfParams myPoints;
   Extrema_HUBTreeOfSphere mySphereUBTree;
   Handle(Bnd_HArray1OfSphere) mySphereArray;
   Extrema_FuncPSNorm myF;
-  Adaptor3d_SurfacePtr myS;
+  const Adaptor3d_Surface* myS;
   Extrema_ExtFlag myFlag;
   Extrema_ExtAlgo myAlgo;
   Handle(TColStd_HArray1OfReal) myUParams;
   Handle(TColStd_HArray1OfReal) myVParams;
-  Handle(Extrema_HArray2OfPOnSurfParams) myFacePntParams;
-  Handle(Extrema_HArray2OfPOnSurfParams) myUEdgePntParams;
-  Handle(Extrema_HArray2OfPOnSurfParams) myVEdgePntParams;
+  Extrema_Array2OfPOnSurfParams myFacePntParams;
+  Extrema_Array2OfPOnSurfParams myUEdgePntParams;
+  Extrema_Array2OfPOnSurfParams myVEdgePntParams;
   Extrema_POnSurfParams myGridParam;
 
-
 };
 
-
-
-
-
-
-
 #endif // _Extrema_GenExtPS_HeaderFile
index 6db3f8eb6d49a0ffd123514f35d7859acd08cad3..42dcedd1f829ddedd76484ed7db1c40cbd07ca9e 100644 (file)
@@ -190,7 +190,7 @@ void Extrema_GenExtSS::Initialize(const Adaptor3d_Surface& S2,
                                  const Standard_Real V2sup, 
                                  const Standard_Real Tol2)
 {
-  myS2 = (Adaptor3d_SurfacePtr)&S2;
+  myS2 = &S2;
   mypoints1 = new TColgp_HArray2OfPnt(0,NbU+1,0,NbV+1);
   mypoints2 = new TColgp_HArray2OfPnt(0,NbU+1,0,NbV+1);
   myusample = NbU;
@@ -464,14 +464,3 @@ const Extrema_POnSurf& Extrema_GenExtSS::PointOnS2(const Standard_Integer N) con
 
   return myF.PointOnS2(N);
 }
-
-//=======================================================================
-//function : Bidon
-//purpose  : 
-//=======================================================================
-
-Adaptor3d_SurfacePtr Extrema_GenExtSS::Bidon() const 
-{
-  return (Adaptor3d_SurfacePtr)0L;
-}
-
index cc36cf50c7f9b9cdcc40ba10aa0903d996fe3746..5e3e5ed0b42c6cd241add40859712e8f1b541312 100644 (file)
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Standard_Boolean.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_Integer.hxx>
 #include <TColgp_HArray2OfPnt.hxx>
 #include <Extrema_FuncExtSS.hxx>
-#include <Adaptor3d_SurfacePtr.hxx>
-class StdFail_NotDone;
-class Standard_OutOfRange;
-class Standard_TypeMismatch;
+
 class Adaptor3d_Surface;
 class Extrema_POnSurf;
 
-
 //! It calculates all the extremum distances
 //! between two surfaces.
 //! These distances can be minimum or maximum.
@@ -93,20 +86,13 @@ public:
   //! Returns the point of the Nth resulting distance.
   Standard_EXPORT const Extrema_POnSurf& PointOnS2 (const Standard_Integer N) const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-  
-  Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const;
+  // disallow copies
+  Extrema_GenExtSS            (const Extrema_GenExtSS& );
+  Extrema_GenExtSS& operator= (const Extrema_GenExtSS& );
 
+private:
 
   Standard_Boolean myDone;
   Standard_Boolean myInit;
@@ -125,15 +111,8 @@ private:
   Standard_Real mytol1;
   Standard_Real mytol2;
   Extrema_FuncExtSS myF;
-  Adaptor3d_SurfacePtr myS2;
-
+  const Adaptor3d_Surface* myS2;
 
 };
 
-
-
-
-
-
-
 #endif // _Extrema_GenExtSS_HeaderFile
diff --git a/src/Extrema/Extrema_HArray2OfPOnSurfParams.hxx b/src/Extrema/Extrema_HArray2OfPOnSurfParams.hxx
deleted file mode 100644 (file)
index 2d3c758..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Created on: 1991-02-26
-// Created by: Isabelle GRIGNON
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef Extrema_HArray2OfPOnSurfParams_HeaderFile
-#define Extrema_HArray2OfPOnSurfParams_HeaderFile
-
-#include <Extrema_POnSurfParams.hxx>
-#include <Extrema_Array2OfPOnSurfParams.hxx>
-#include <NCollection_DefineHArray2.hxx>
-
-DEFINE_HARRAY2(Extrema_HArray2OfPOnSurfParams, Extrema_Array2OfPOnSurfParams)
-
-
-#endif
index 1e3d13ee43e19b2c01e38661f46d3785f8abf943..5f3d2ed048dd1a8396f8b03938be59d71a5a7dcb 100644 (file)
@@ -110,7 +110,6 @@ Extrema_HArray1OfPOnSurf.hxx
 Extrema_HArray2OfPOnCurv.hxx
 Extrema_HArray2OfPOnCurv2d.hxx
 Extrema_HArray2OfPOnSurf.hxx
-Extrema_HArray2OfPOnSurfParams.hxx
 Extrema_HUBTreeOfSphere.hxx
 Extrema_LocateExtCC.cxx
 Extrema_LocateExtCC.hxx
index f474c36f1c0ddceda22942b970ce25a354451456..ba64d0f9f05864a75667d3371c6c5e93fc906e1b 100644 (file)
@@ -86,9 +86,9 @@ void GeomAPI_ExtremaCurveCurve::Init
   Standard_Real Tol = Precision::PConfusion();
   myC1.Load(C1);
   myC2.Load(C2);
-  Extrema_ExtCC theExtCC(myC1, myC2, Tol,Tol);
-  myExtCC = theExtCC;
 
+  myExtCC.Initialize (myC1, myC2, Tol,Tol);
+  myExtCC.Perform();
   myIsDone = myExtCC.IsDone() && ( myExtCC.NbExt() > 0);
 
   if ( myIsDone) {
@@ -128,8 +128,9 @@ void GeomAPI_ExtremaCurveCurve::Init
   Standard_Real Tol = Precision::PConfusion();
   myC1.Load(C1);
   myC2.Load(C2);
-  Extrema_ExtCC theExtCC(myC1,myC2,U1min,U1max,U2min,U2max,Tol,Tol);
-  myExtCC = theExtCC;
+
+  myExtCC.Initialize (myC1,myC2,U1min,U1max,U2min,U2max,Tol,Tol);
+  myExtCC.Perform();
 
   myIsDone = myExtCC.IsDone() && ( myExtCC.NbExt() > 0 );
 
index 657815bb697183701753ba7e0b1385f9824d34ed..6dd37749b3504d2f040640d12231c6bf9bc53a86 100644 (file)
@@ -84,9 +84,8 @@ void GeomAPI_ExtremaCurveSurface::Init
   GeomAdaptor_Surface TheSurface (Surface);
 
   Standard_Real Tol = Precision::PConfusion();
-  Extrema_ExtCS theExtCS(TheCurve,TheSurface,Tol,Tol);
-  myExtCS = theExtCS;
-
+  myExtCS.Initialize (TheSurface, Tol, Tol);
+  myExtCS.Perform (TheCurve, TheCurve.FirstParameter(), TheCurve.LastParameter());
   myIsDone = myExtCS.IsDone() && (myExtCS.IsParallel() || myExtCS.NbExt() > 0);
 
   if ( myIsDone) {
@@ -126,10 +125,9 @@ void GeomAPI_ExtremaCurveSurface::Init
   GeomAdaptor_Surface TheSurface (Surface, Umin, Umax, Vmin, Vmax);
 
   Standard_Real Tol = Precision::PConfusion();
-  Extrema_ExtCS theExtCS(TheCurve,TheSurface,
-                             Wmin,Wmax,Umin,Umax,Vmin,Vmax,Tol,Tol);
-  myExtCS = theExtCS;
-
+  myExtCS.Initialize (TheSurface,
+                      Umin,Umax,Vmin,Vmax,Tol,Tol);
+  myExtCS.Perform (TheCurve, Wmin, Wmax);
   myIsDone = myExtCS.IsDone() && (myExtCS.IsParallel() || myExtCS.NbExt() > 0);
 
   if ( myIsDone) {
index 9aa6e2f518ab5ad096be808222e4c8d571cf6e62..f9d862741f3081ed6f4c9fd4c418de2a92f2581d 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <Adaptor2d_Curve2d.hxx>
 #include <Adaptor3d_CurveOnSurface.hxx>
-#include <Adaptor3d_CurveOnSurfacePtr.hxx>
 #include <Adaptor3d_Curve.hxx>
 #include <Adaptor3d_Surface.hxx>
 #include <CSLib.hxx>
@@ -274,8 +273,8 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Darboux::Copy() const
   gp_Vec2d D2d;
   gp_Pnt S;
   gp_Vec dS_du, dS_dv;
-  Handle(Adaptor2d_Curve2d) myCurve2d = Adaptor3d_CurveOnSurfacePtr(myTrimmed.get())->GetCurve();
-  Handle(Adaptor3d_Surface) mySupport = Adaptor3d_CurveOnSurfacePtr(myTrimmed.get())->GetSurface();
+  Handle(Adaptor2d_Curve2d) myCurve2d = static_cast<Adaptor3d_CurveOnSurface*>(myTrimmed.get())->GetCurve();
+  Handle(Adaptor3d_Surface) mySupport = static_cast<Adaptor3d_CurveOnSurface*>(myTrimmed.get())->GetSurface();
   Standard_Integer OrderU, OrderV;
   myCurve2d->D1(Param, C2d, D2d);
 
@@ -307,8 +306,8 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Darboux::Copy() const
   gp_Vec2d D2d, D2_2d;
   gp_Pnt S;
   gp_Vec dS_du, dS_dv, d2S_du, d2S_dv, d2S_duv, F, DF;
-  Handle(Adaptor2d_Curve2d) myCurve2d = Adaptor3d_CurveOnSurfacePtr(myTrimmed.get())->GetCurve();
-  Handle(Adaptor3d_Surface) mySupport = Adaptor3d_CurveOnSurfacePtr(myTrimmed.get())->GetSurface();
+  Handle(Adaptor2d_Curve2d) myCurve2d = static_cast<Adaptor3d_CurveOnSurface*>(myTrimmed.get())->GetCurve();
+  Handle(Adaptor3d_Surface) mySupport = static_cast<Adaptor3d_CurveOnSurface*>(myTrimmed.get())->GetSurface();
 //  Standard_Integer Order;
   myCurve2d->D2(Param, C2d, D2d, D2_2d);
   mySupport->D2(C2d.X(), C2d.Y(), S, dS_du, dS_dv, 
@@ -347,8 +346,8 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Darboux::Copy() const
   gp_Pnt S;
   gp_Vec dS_du, dS_dv, d2S_du, d2S_dv, d2S_duv, 
          d3S_du, d3S_dv, d3S_duuv, d3S_duvv, F, DF, D2F;
-  Handle(Adaptor2d_Curve2d) myCurve2d = Adaptor3d_CurveOnSurfacePtr(myTrimmed.get())->GetCurve();
-  Handle(Adaptor3d_Surface) mySupport = Adaptor3d_CurveOnSurfacePtr(myTrimmed.get())->GetSurface();
+  Handle(Adaptor2d_Curve2d) myCurve2d = static_cast<Adaptor3d_CurveOnSurface*>(myTrimmed.get())->GetCurve();
+  Handle(Adaptor3d_Surface) mySupport = static_cast<Adaptor3d_CurveOnSurface*>(myTrimmed.get())->GetSurface();
 //  Standard_Integer Order;
   myCurve2d->D3(Param, C2d, D2d, D2_2d, D3_2d);
   mySupport->D3(C2d.X(), C2d.Y(), S, dS_du, dS_dv, 
index c0637caee85b0f525b27b7d33fe70fb9d7f5da31..9ad1877196948a5daed54ba60de37c700729f8bc 100644 (file)
 //function : ParametersOfNearestPointOnSurface
 //purpose  : 
 //=======================================================================
-static Standard_Boolean ParametersOfNearestPointOnSurface(const Extrema_ExtPS theExtr,
+static Standard_Boolean ParametersOfNearestPointOnSurface(const Extrema_ExtPS& theExtr,
                                                           Standard_Real& theU,
                                                           Standard_Real& theV)
 {
index 9abd175f0e9c7117e06477146e4cd4cb8a280d67..bb48231ef2325e9164d92455f0f66368964144bc 100644 (file)
@@ -104,7 +104,7 @@ void  HLRBRep_Intersector::Perform (const Standard_Address A1,
 #endif
 
 
-  Standard_Address myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
+  HLRBRep_Curve* myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
 
   myTypePerform = 1;
 
@@ -116,10 +116,10 @@ void  HLRBRep_Intersector::Perform (const Standard_Address A1,
   d = b - a;
   if (da1 != 0) a = a + d * da1;
   if (db1 != 0) b = b - d * db1;
-  ((HLRBRep_Curve*)myC1)->D0(a,pa);
-  ((HLRBRep_Curve*)myC1)->D0(b,pb);
-  a = ((HLRBRep_Curve*)myC1)->Parameter2d(a);
-  b = ((HLRBRep_Curve*)myC1)->Parameter2d(b);
+  myC1->D0(a,pa);
+  myC1->D0(b,pb);
+  a = myC1->Parameter2d(a);
+  b = myC1->Parameter2d(b);
   IntRes2d_Domain D1(pa,a,(Standard_Real)ta,pb,b,(Standard_Real)tb);
 
   //modified by jgv, 18.04.2016 for OCC27341
@@ -152,8 +152,8 @@ void  HLRBRep_Intersector::Perform (const Standard_Integer /*nA*/,
 //    return;
 //  }
 
-  Standard_Address myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
-  Standard_Address myC2 = ((HLRBRep_EdgeData*) A2)->Curve();
+  HLRBRep_Curve* myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
+  HLRBRep_Curve* myC2 = ((HLRBRep_EdgeData*) A2)->Curve();
 
   myTypePerform = 1;
 
@@ -191,7 +191,7 @@ void  HLRBRep_Intersector::Perform (const Standard_Integer /*nA*/,
 
     if (da1 != 0)  { 
       //-- a = a + d * da1;
-      ((HLRBRep_Curve*)myC1)->D1(a1,pa1,va1);
+      myC1->D1(a1,pa1,va1);
       Standard_Real qwe=va1.Magnitude();
       if(qwe>1e-12) { 
        dd=pdist*decalagea1/qwe;
@@ -209,7 +209,7 @@ void  HLRBRep_Intersector::Perform (const Standard_Integer /*nA*/,
     
     if (db1 != 0) { 
       //-- b = b - d * db1;
-      ((HLRBRep_Curve*)myC1)->D1(b1,pb1,vb1);
+      myC1->D1(b1,pb1,vb1);
       Standard_Real qwe=vb1.Magnitude();
       if(qwe>1e-12) { 
        dd=pdist*decalageb1/qwe;
@@ -234,11 +234,11 @@ void  HLRBRep_Intersector::Perform (const Standard_Integer /*nA*/,
 
 
     
-    ((HLRBRep_Curve*)myC1)->D0(a1,pa1);
-    ((HLRBRep_Curve*)myC1)->D0(b1,pb1);
+    myC1->D0(a1,pa1);
+    myC1->D0(b1,pb1);
     
-    a1 = ((HLRBRep_Curve*)myC1)->Parameter2d(a1);
-    b1 = ((HLRBRep_Curve*)myC1)->Parameter2d(b1);
+    a1 = myC1->Parameter2d(a1);
+    b1 = myC1->Parameter2d(b1);
     
     if(EnBout) { 
       ta=tb=-1.;
@@ -305,11 +305,11 @@ void  HLRBRep_Intersector::Perform (const Standard_Integer /*nA*/,
 
 
     
-    ((HLRBRep_Curve*)myC2)->D0(a2,pa2);
-    ((HLRBRep_Curve*)myC2)->D0(b2,pb2);
+    myC2->D0(a2,pa2);
+    myC2->D0(b2,pb2);
     
-    a2 = ((HLRBRep_Curve*)myC2)->Parameter2d(a2);
-    b2 = ((HLRBRep_Curve*)myC2)->Parameter2d(b2);
+    a2 = myC2->Parameter2d(a2);
+    b2 = myC2->Parameter2d(b2);
     
     if(EnBout) { 
       ta=tb=-1.;
@@ -405,15 +405,15 @@ void  HLRBRep_Intersector::SimulateOnePoint(const Standard_Address A1,
 #ifdef PERF
   NbIntersSimulate++;
 #endif
-  Standard_Address myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
-  Standard_Address myC2 = ((HLRBRep_EdgeData*) A2)->Curve();
+  HLRBRep_Curve* myC1 = ((HLRBRep_EdgeData*) A1)->Curve();
+  HLRBRep_Curve* myC2 = ((HLRBRep_EdgeData*) A2)->Curve();
 
-  Standard_Real u3= ((HLRBRep_Curve*)myC1)->Parameter3d(u);
-  Standard_Real v3= ((HLRBRep_Curve*)myC2)->Parameter3d(v);
+  Standard_Real u3= myC1->Parameter3d(u);
+  Standard_Real v3= myC2->Parameter3d(v);
   gp_Pnt2d P13,P23;   
   gp_Vec2d T13,T23;
-  ((HLRBRep_Curve*)myC1)->D1(u3,P13,T13);
-  ((HLRBRep_Curve*)myC2)->D1(v3,P23,T23);
+  myC1->D1(u3,P13,T13);
+  myC2->D1(v3,P23,T23);
   
   IntRes2d_Transition Tr1,Tr2;
   IntRes2d_Position Pos1,Pos2;
index 93deb28bfdf61eb40ac58fa6a388694769707984..0909c74360f05b953c2e7e5c4d08f28263bf4a24 100644 (file)
@@ -930,28 +930,27 @@ void IntTools_BeanFaceIntersector::ComputeUsingExtremum()
     }
 
     GeomAdaptor_Curve aGACurve(aCurve, anarg1, anarg2);
-    Extrema_ExtCS theExtCS;
-    theExtCS.Initialize(aGASurface, myUMinParameter, myUMaxParameter,
-                                    myVMinParameter, myVMaxParameter,  Tol, Tol);
+    Extrema_ExtCS anExtCS;
+    anExtCS.Initialize(aGASurface, myUMinParameter, myUMaxParameter,
+                                   myVMinParameter, myVMaxParameter,  Tol, Tol);
     Standard_Real first = aCurve->FirstParameter(), last = aCurve->LastParameter();
     if (aCurve->IsPeriodic() || 
        (anarg1 >= first - Precision::PConfusion() && anarg2 <= last + Precision::PConfusion()))
     {
-      //Extrema_ExtCS theExtCS(aGACurve, aGASurface, Tol, Tol);
-      theExtCS.Perform(aGACurve, anarg1, anarg2);
+      //Extrema_ExtCS anExtCS (aGACurve, aGASurface, Tol, Tol);
+      anExtCS.Perform (aGACurve, anarg1, anarg2);
     }
-
-    myExtrema = theExtCS; 
     
-    if(myExtrema.IsDone() && (myExtrema.NbExt() || myExtrema.IsParallel())) {
+    if (anExtCS.IsDone() && (anExtCS.NbExt() || anExtCS.IsParallel()))
+    {
       Standard_Integer anOldNbRanges = myRangeManager.Length();
-      
-      if (myExtrema.IsParallel()) {
-        
-        if (myMinSqDistance > myExtrema.SquareDistance (1))
-          myMinSqDistance = myExtrema.SquareDistance (1);
 
-        if(myExtrema.SquareDistance(1) < myCriteria * myCriteria) {
+      if (anExtCS.IsParallel())
+      {
+        const Standard_Real aSqDist = anExtCS.SquareDistance (1);
+        myMinSqDistance = Min (myMinSqDistance, aSqDist);
+        if (aSqDist < myCriteria * myCriteria)
+        {
           Standard_Real U1, V1, U2, V2;
           Standard_Real adistance1 = Distance(anarg1, U1, V1);
           Standard_Real adistance2 = Distance(anarg2, U2, V2);
@@ -1015,12 +1014,13 @@ void IntTools_BeanFaceIntersector::ComputeUsingExtremum()
       else {
         Standard_Boolean solutionfound = Standard_False;
         
-        for(Standard_Integer j = 1 ; j <= myExtrema.NbExt(); j++) {
-          
-          if(myExtrema.SquareDistance(j) < myCriteria * myCriteria) {
+        for(Standard_Integer j = 1 ; j <= anExtCS.NbExt(); j++)
+        {
+          if (anExtCS.SquareDistance(j) < myCriteria * myCriteria)
+          {
             Extrema_POnCurv p1;
             Extrema_POnSurf p2;
-            myExtrema.Points(j, p1, p2);
+            anExtCS.Points (j, p1, p2);
             Standard_Real U, V;
             p2.Parameter(U, V);
             
@@ -1034,9 +1034,8 @@ void IntTools_BeanFaceIntersector::ComputeUsingExtremum()
             }
           }
 
-          if (myMinSqDistance > myExtrema.SquareDistance (j))
-            myMinSqDistance = myExtrema.SquareDistance (j);
-        } //end for
+          myMinSqDistance = Min (myMinSqDistance, anExtCS.SquareDistance (j));
+        }
         
         if(!solutionfound) {
           myRangeManager.SetFlag(i, 1);
@@ -1047,7 +1046,7 @@ void IntTools_BeanFaceIntersector::ComputeUsingExtremum()
       if(adifference > 0) {
         i+=adifference;
       }
-    } // end if(myExtrema.IsDone() && (myExtrema.NbExt() || myExtrema.IsParallel()))
+    }
   }
 }
 
index 694646027a0eae5e1baac64b766dd3146aa57e12..7ee7b6e069af383f67e7480e5daae0eed2f07403 100644 (file)
@@ -182,7 +182,6 @@ private:
   Standard_Real myFaceTolerance;
   Standard_Real myCurveResolution;
   Standard_Real myCriteria;
-  Extrema_ExtCS myExtrema;
   GeomAPI_ProjectPointOnSurf myProjector;
   IntTools_MarkedRangeSet myRangeManager;
   Handle(IntTools_Context) myContext;
index b6c45959b31a2a3abe6fe5834ab69a7a635bf029..7d18e8c83e48fbec6069486eea40299659e36b2c 100644 (file)
@@ -99,114 +99,98 @@ IntTools_Context::IntTools_Context
 //=======================================================================
 IntTools_Context::~IntTools_Context()
 {
-  Standard_Address anAdr;
-  DataMapOfShapeAddress::Iterator aIt;
-  DataMapOfTransientAddress::Iterator aIt1;
-  //
-  IntTools_FClass2d* pFClass2d;
-  //
-  aIt.Initialize(myFClass2dMap);
-  for (; aIt.More(); aIt.Next()) {
-    anAdr=aIt.Value();
-    pFClass2d=(IntTools_FClass2d*)anAdr;
+  for (NCollection_DataMap<TopoDS_Shape, IntTools_FClass2d*, TopTools_ShapeMapHasher>::Iterator anIt (myFClass2dMap);
+       anIt.More(); anIt.Next())
+  {
+    IntTools_FClass2d* pFClass2d = anIt.Value();;
     (*pFClass2d).~IntTools_FClass2d();
-    myAllocator->Free(anAdr); 
+    myAllocator->Free (pFClass2d);
   }
   myFClass2dMap.Clear();
-  //
+
   clearCachedPOnSProjectors();
-  //
-  GeomAPI_ProjectPointOnCurve* pProjPC;
-  aIt.Initialize(myProjPCMap);
-  for (; aIt.More(); aIt.Next()) {
-    anAdr=aIt.Value();
-    pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
+  for (NCollection_DataMap<TopoDS_Shape, GeomAPI_ProjectPointOnCurve*, TopTools_ShapeMapHasher>::Iterator anIt (myProjPCMap);
+       anIt.More(); anIt.Next())
+  {
+    GeomAPI_ProjectPointOnCurve* pProjPC = anIt.Value();
     (*pProjPC).~GeomAPI_ProjectPointOnCurve();
-    myAllocator->Free(anAdr); 
+    myAllocator->Free (pProjPC);
   }
   myProjPCMap.Clear();
-  //
-  //
-  BRepClass3d_SolidClassifier* pSC;
-  aIt.Initialize(mySClassMap);
-  for (; aIt.More(); aIt.Next()) {
-    anAdr=aIt.Value();
-    pSC=(BRepClass3d_SolidClassifier*)anAdr;
+
+  for (NCollection_DataMap<TopoDS_Shape, BRepClass3d_SolidClassifier*, TopTools_ShapeMapHasher>::Iterator anIt (mySClassMap);
+       anIt.More(); anIt.Next())
+  {
+    BRepClass3d_SolidClassifier* pSC = anIt.Value();
     (*pSC).~BRepClass3d_SolidClassifier();
-    myAllocator->Free(anAdr); 
+    myAllocator->Free (pSC);
   }
   mySClassMap.Clear();
-  //
-  GeomAPI_ProjectPointOnCurve* pProjPT;
-  aIt1.Initialize(myProjPTMap);
-  for (; aIt1.More(); aIt1.Next()) {
-    anAdr=aIt1.Value();
-    pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
+
+  for (NCollection_DataMap<Handle(Geom_Curve), GeomAPI_ProjectPointOnCurve*, TColStd_MapTransientHasher>::Iterator anIt (myProjPTMap);
+       anIt.More(); anIt.Next())
+  {
+    GeomAPI_ProjectPointOnCurve* pProjPT = anIt.Value();
     (*pProjPT).~GeomAPI_ProjectPointOnCurve();
-    myAllocator->Free(anAdr); 
+    myAllocator->Free (pProjPT);
   }
   myProjPTMap.Clear();
-  //
-  Geom2dHatch_Hatcher* pHatcher;
-  aIt.Initialize(myHatcherMap);
-  for (; aIt.More(); aIt.Next()) {
-    anAdr=aIt.Value();
-    pHatcher=(Geom2dHatch_Hatcher*)anAdr;
+
+  for (NCollection_DataMap<TopoDS_Shape, Geom2dHatch_Hatcher*, TopTools_ShapeMapHasher>::Iterator anIt (myHatcherMap);
+       anIt.More(); anIt.Next())
+  {
+    Geom2dHatch_Hatcher* pHatcher = anIt.Value();
     (*pHatcher).~Geom2dHatch_Hatcher();
-    myAllocator->Free(anAdr);
+    myAllocator->Free (pHatcher);
   }
   myHatcherMap.Clear();
-  //
-  IntTools_SurfaceRangeLocalizeData* pSData = NULL;
-  aIt.Initialize(myProjSDataMap);
-  for (; aIt.More(); aIt.Next()) {
-    anAdr=aIt.Value();
-    pSData = (IntTools_SurfaceRangeLocalizeData*)anAdr;
+
+  for (NCollection_DataMap<TopoDS_Shape, IntTools_SurfaceRangeLocalizeData*, TopTools_ShapeMapHasher>::Iterator anIt (myProjSDataMap);
+       anIt.More(); anIt.Next())
+  {
+    IntTools_SurfaceRangeLocalizeData* pSData = anIt.Value();
     (*pSData).~IntTools_SurfaceRangeLocalizeData();
-    myAllocator->Free(anAdr);
+    myAllocator->Free (pSData);
   }
   myProjSDataMap.Clear();
-  //
-  Bnd_Box* pBox;
-  aIt.Initialize(myBndBoxDataMap);
-  for (; aIt.More(); aIt.Next()) {
-    anAdr=aIt.Value();
-    pBox=(Bnd_Box*)anAdr;
+
+  for (NCollection_DataMap<TopoDS_Shape, Bnd_Box*, TopTools_ShapeMapHasher>::Iterator anIt (myBndBoxDataMap);
+       anIt.More(); anIt.Next())
+  {
+    Bnd_Box* pBox = anIt.Value();
     (*pBox).~Bnd_Box();
-    myAllocator->Free(anAdr); 
+    myAllocator->Free (pBox);
   }
   myBndBoxDataMap.Clear();
-  //
-  BRepAdaptor_Surface* pSurfAdaptor;
-  aIt.Initialize(mySurfAdaptorMap);
-  for (; aIt.More(); aIt.Next()) {
-    anAdr=aIt.Value();
-    pSurfAdaptor=(BRepAdaptor_Surface*)anAdr;
+
+  for (NCollection_DataMap<TopoDS_Shape, BRepAdaptor_Surface*, TopTools_ShapeMapHasher>::Iterator anIt (mySurfAdaptorMap);
+       anIt.More(); anIt.Next())
+  {
+    BRepAdaptor_Surface* pSurfAdaptor = anIt.Value();
     (*pSurfAdaptor).~BRepAdaptor_Surface();
-    myAllocator->Free(anAdr);
+    myAllocator->Free (pSurfAdaptor);
   }
   mySurfAdaptorMap.Clear();
-  //
-  Bnd_OBB* pOBB;
-  aIt.Initialize(myOBBMap);
-  for (; aIt.More(); aIt.Next()) {
-    anAdr=aIt.Value();
-    pOBB=(Bnd_OBB*)anAdr;
+
+  for (NCollection_DataMap<TopoDS_Shape, Bnd_OBB*, TopTools_ShapeMapHasher>::Iterator anIt (myOBBMap);
+       anIt.More(); anIt.Next())
+  {
+    Bnd_OBB* pOBB = anIt.Value();
     (*pOBB).~Bnd_OBB();
-    myAllocator->Free(anAdr);
+    myAllocator->Free (pOBB);
   }
   myOBBMap.Clear();
 }
+
 //=======================================================================
 //function : BndBox
 //purpose  : 
 //=======================================================================
 Bnd_Box& IntTools_Context::BndBox(const TopoDS_Shape& aS)
 {
-  Standard_Address anAdr;
-  Bnd_Box* pBox;
-  //
-  if (!myBndBoxDataMap.IsBound(aS)) {
+  Bnd_Box* pBox = NULL;
+  if (!myBndBoxDataMap.Find (aS, pBox))
+  {
     //
     pBox=(Bnd_Box*)myAllocator->Allocate(sizeof(Bnd_Box));
     new (pBox) Bnd_Box();
@@ -214,15 +198,11 @@ Bnd_Box& IntTools_Context::BndBox(const TopoDS_Shape& aS)
     Bnd_Box &aBox=*pBox;
     BRepBndLib::Add(aS, aBox);
     //
-    anAdr=(Standard_Address)pBox;
-    myBndBoxDataMap.Bind(aS, anAdr);
-  }
-  else {
-    anAdr=myBndBoxDataMap.Find(aS);
-    pBox=(Bnd_Box*)anAdr;
+    myBndBoxDataMap.Bind (aS, pBox);
   }
   return *pBox;
 }
+
 //=======================================================================
 //function : IsInfiniteFace
 //purpose  : 
@@ -244,10 +224,9 @@ Standard_Boolean IntTools_Context::IsInfiniteFace
 //=======================================================================
 IntTools_FClass2d& IntTools_Context::FClass2d(const TopoDS_Face& aF)
 {
-  Standard_Address anAdr;
-  IntTools_FClass2d* pFClass2d;
-  //
-  if (!myFClass2dMap.IsBound(aF)) {
+  IntTools_FClass2d* pFClass2d = NULL;
+  if (!myFClass2dMap.Find (aF, pFClass2d))
+  {
     Standard_Real aTolF;
     TopoDS_Face aFF;
     //
@@ -258,25 +237,20 @@ IntTools_FClass2d& IntTools_Context::FClass2d(const TopoDS_Face& aF)
     pFClass2d=(IntTools_FClass2d*)myAllocator->Allocate(sizeof(IntTools_FClass2d));
     new (pFClass2d) IntTools_FClass2d(aFF, aTolF);
     //
-    anAdr=(Standard_Address)pFClass2d;
-    myFClass2dMap.Bind(aFF, anAdr);
-  }
-  else {
-    anAdr=myFClass2dMap.Find(aF);
-    pFClass2d=(IntTools_FClass2d*)anAdr;
+    myFClass2dMap.Bind(aFF, pFClass2d);
   }
   return *pFClass2d;
 }
+
 //=======================================================================
 //function : ProjPS
 //purpose  : 
 //=======================================================================
 GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
 {
-  Standard_Address anAdr;
-  GeomAPI_ProjectPointOnSurf* pProjPS;
-  if (!myProjPSMap.IsBound(aF)) {
+  GeomAPI_ProjectPointOnSurf* pProjPS = NULL;
+  if (!myProjPSMap.Find (aF, pProjPS))
+  {
     Standard_Real Umin, Usup, Vmin, Vsup;
     UVBounds(aF, Umin, Usup, Vmin, Vsup);
     const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF);
@@ -284,15 +258,9 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
     pProjPS=(GeomAPI_ProjectPointOnSurf*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf));
     new (pProjPS) GeomAPI_ProjectPointOnSurf();
     pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, myPOnSTolerance);
-    pProjPS->SetExtremaFlag(Extrema_ExtFlag_MIN);
+    pProjPS->SetExtremaFlag(Extrema_ExtFlag_MIN); ///
     //
-    anAdr=(Standard_Address)pProjPS;
-    myProjPSMap.Bind(aF, anAdr);
-  }
-  
-  else {
-    anAdr=myProjPSMap.Find(aF);
-    pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
+    myProjPSMap.Bind(aF, pProjPS);
   }
   return *pProjPS;
 }
@@ -302,10 +270,9 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
 //=======================================================================
 GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPC(const TopoDS_Edge& aE)
 {
-  Standard_Address anAdr;
-  GeomAPI_ProjectPointOnCurve* pProjPC;
-  if (!myProjPCMap.IsBound(aE)) {
+  GeomAPI_ProjectPointOnCurve* pProjPC = NULL;
+  if (!myProjPCMap.Find (aE, pProjPC))
+  {
     Standard_Real f, l;
     //
     Handle(Geom_Curve)aC3D=BRep_Tool::Curve (aE, f, l);
@@ -314,13 +281,7 @@ GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPC(const TopoDS_Edge& aE)
     new (pProjPC) GeomAPI_ProjectPointOnCurve();
     pProjPC->Init(aC3D, f, l);
     //
-    anAdr=(Standard_Address)pProjPC;
-    myProjPCMap.Bind(aE, anAdr);
-  }
-  
-  else {
-    anAdr=myProjPCMap.Find(aE);
-    pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
+    myProjPCMap.Bind(aE, pProjPC);
   }
   return *pProjPC;
 }
@@ -333,10 +294,9 @@ GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPT
   (const Handle(Geom_Curve)& aC3D)
 
 {
-  Standard_Address anAdr;
-  GeomAPI_ProjectPointOnCurve* pProjPT;
-  if (!myProjPTMap.IsBound(aC3D)) {
+  GeomAPI_ProjectPointOnCurve* pProjPT = NULL;
+  if (!myProjPTMap.Find (aC3D, pProjPT))
+  {
     Standard_Real f, l;
     f=aC3D->FirstParameter();
     l=aC3D->LastParameter();
@@ -345,16 +305,11 @@ GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPT
     new (pProjPT) GeomAPI_ProjectPointOnCurve();
     pProjPT->Init(aC3D, f, l);
     //
-    anAdr=(Standard_Address)pProjPT;
-    myProjPTMap.Bind(aC3D, anAdr);
-  }
-  
-  else {
-    anAdr=myProjPTMap.Find(aC3D);
-    pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
+    myProjPTMap.Bind (aC3D, pProjPT);
   }
   return *pProjPT;
 }
+
 //=======================================================================
 //function : SolidClassifier
 //purpose  : 
@@ -362,21 +317,13 @@ GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPT
 BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier
   (const TopoDS_Solid& aSolid)
 {
-  Standard_Address anAdr;
-  BRepClass3d_SolidClassifier* pSC;
-  if (!mySClassMap.IsBound(aSolid)) {
-    //
+  BRepClass3d_SolidClassifier* pSC = NULL;
+  if (!mySClassMap.Find (aSolid, pSC))
+  {
     pSC=(BRepClass3d_SolidClassifier*)myAllocator->Allocate(sizeof(BRepClass3d_SolidClassifier));
     new (pSC) BRepClass3d_SolidClassifier(aSolid);
     //
-    anAdr=(Standard_Address)pSC;
-    mySClassMap.Bind(aSolid, anAdr);
-  }
-  
-  else {
-    anAdr=mySClassMap.Find(aSolid);
-    pSC =(BRepClass3d_SolidClassifier*)anAdr;
+    mySClassMap.Bind (aSolid, pSC);
   }
   return *pSC;
 }
@@ -388,21 +335,14 @@ BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier
 BRepAdaptor_Surface& IntTools_Context::SurfaceAdaptor
   (const TopoDS_Face& theFace)
 {
-  Standard_Address anAdr;
-  BRepAdaptor_Surface* pBAS;
-  if (!mySurfAdaptorMap.IsBound(theFace)) {
+  BRepAdaptor_Surface* pBAS = NULL;
+  if (!mySurfAdaptorMap.Find (theFace, pBAS))
+  {
     //
     pBAS=(BRepAdaptor_Surface*)myAllocator->Allocate(sizeof(BRepAdaptor_Surface));
     new (pBAS) BRepAdaptor_Surface(theFace, Standard_True);
     //
-    anAdr=(Standard_Address)pBAS;
-    mySurfAdaptorMap.Bind(theFace, anAdr);
-  }
-  
-  else {
-    anAdr=mySurfAdaptorMap.Find(theFace);
-    pBAS =(BRepAdaptor_Surface*)anAdr;
+    mySurfAdaptorMap.Bind (theFace, pBAS);
   }
   return *pBAS;
 }
@@ -413,10 +353,9 @@ BRepAdaptor_Surface& IntTools_Context::SurfaceAdaptor
 //=======================================================================
 Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF)
 {
-  Standard_Address anAdr;
-  Geom2dHatch_Hatcher* pHatcher;
-  //
-  if (!myHatcherMap.IsBound(aF)) {
+  Geom2dHatch_Hatcher* pHatcher = NULL;
+  if (!myHatcherMap.Find (aF, pHatcher))
+  {
     Standard_Real aTolArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
     Standard_Real aU1, aU2, aEpsT;
     TopAbs_Orientation aOrE;
@@ -461,15 +400,8 @@ Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF)
       pHatcher->AddElement(aGAC, aOrE);
     }// for (; aExp.More() ; aExp.Next()) {
     //
-    anAdr=(Standard_Address)pHatcher;
-    myHatcherMap.Bind(aFF, anAdr);
-  }//if (!myHatcherMap.IsBound(aF)) {
-  //
-  else {
-    anAdr=myHatcherMap.Find(aF);
-    pHatcher=(Geom2dHatch_Hatcher*)anAdr;
+    myHatcherMap.Bind (aFF, pHatcher);
   }
-
   return *pHatcher;
 }
 
@@ -480,10 +412,8 @@ Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF)
 Bnd_OBB& IntTools_Context::OBB(const TopoDS_Shape& aS,
                                const Standard_Real theGap)
 {
-  Standard_Address anAdr;
-  Bnd_OBB* pBox;
-  //
-  if (!myOBBMap.IsBound(aS))
+  Bnd_OBB* pBox = NULL;
+  if (!myOBBMap.Find (aS, pBox))
   {
     pBox = (Bnd_OBB*)myAllocator->Allocate(sizeof(Bnd_OBB));
     new (pBox) Bnd_OBB();
@@ -492,13 +422,7 @@ Bnd_OBB& IntTools_Context::OBB(const TopoDS_Shape& aS,
     BRepBndLib::AddOBB(aS, aBox);
     aBox.Enlarge(theGap);
     //
-    anAdr = (Standard_Address)pBox;
-    myOBBMap.Bind(aS, anAdr);
-  }
-  else
-  {
-    anAdr = myOBBMap.Find(aS);
-    pBox = (Bnd_OBB*)anAdr;
+    myOBBMap.Bind(aS, pBox);
   }
   return *pBox;
 }
@@ -510,10 +434,9 @@ Bnd_OBB& IntTools_Context::OBB(const TopoDS_Shape& aS,
 IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData
   (const TopoDS_Face& aF) 
 {
-  Standard_Address anAdr;
-  IntTools_SurfaceRangeLocalizeData* pSData;
-  //
-  if (!myProjSDataMap.IsBound(aF)) {
+  IntTools_SurfaceRangeLocalizeData* pSData = NULL;
+  if (!myProjSDataMap.Find (aF, pSData))
+  {
     pSData=(IntTools_SurfaceRangeLocalizeData*)
       myAllocator->Allocate(sizeof(IntTools_SurfaceRangeLocalizeData));
     new (pSData) IntTools_SurfaceRangeLocalizeData
@@ -522,16 +445,9 @@ IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData
        10. * Precision::PConfusion(), 
        10. * Precision::PConfusion());
     //
-    anAdr=(Standard_Address)pSData;
-    myProjSDataMap.Bind(aF, anAdr);
-  }
-  
-  else {
-    anAdr=myProjSDataMap.Find(aF);
-    pSData=(IntTools_SurfaceRangeLocalizeData*)anAdr;
+    myProjSDataMap.Bind (aF, pSData);
   }
   return *pSData;
-
 }
 
 //=======================================================================
@@ -1121,13 +1037,12 @@ void IntTools_Context::SetPOnSProjectionTolerance(const Standard_Real theValue)
 //=======================================================================
 void IntTools_Context::clearCachedPOnSProjectors()
 {
-  GeomAPI_ProjectPointOnSurf* pProjPS;
-  DataMapOfShapeAddress::Iterator aIt(myProjPSMap);
-  for (; aIt.More(); aIt.Next()) {
-    Standard_Address anAdr=aIt.Value();
-    pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
+  for (NCollection_DataMap<TopoDS_Shape, GeomAPI_ProjectPointOnSurf*, TopTools_ShapeMapHasher>::Iterator aIt(myProjPSMap);
+       aIt.More(); aIt.Next())
+  {
+    GeomAPI_ProjectPointOnSurf* pProjPS = aIt.Value();
     (*pProjPS).~GeomAPI_ProjectPointOnSurf();
-    myAllocator->Free(anAdr); 
+    myAllocator->Free (pProjPS);
   }
   myProjPSMap.Clear();
 }
@@ -1147,4 +1062,4 @@ void IntTools_Context::UVBounds(const TopoDS_Face& theFace,
   UMax = aBAS.LastUParameter ();
   VMin = aBAS.FirstVParameter();
   VMax = aBAS.LastVParameter ();
-}
\ No newline at end of file
+}
index 3ec1dcf554a2e5125499d435cecb3e6e1b2f5642..2d299894395a52f240880fac8a78f9fa3b5f1c1d 100644 (file)
@@ -245,28 +245,20 @@ Standard_EXPORT virtual  ~IntTools_Context();
 
 protected:
 
-  typedef NCollection_DataMap<TopoDS_Shape,
-                              Standard_Address,
-                              TopTools_ShapeMapHasher> DataMapOfShapeAddress;
-  typedef NCollection_DataMap<Handle(Standard_Transient),
-                              Standard_Address,
-                              TColStd_MapTransientHasher> DataMapOfTransientAddress;
-
   Handle(NCollection_BaseAllocator) myAllocator;
-  DataMapOfShapeAddress myFClass2dMap;
-  DataMapOfShapeAddress myProjPSMap;
-  DataMapOfShapeAddress myProjPCMap;
-  DataMapOfShapeAddress mySClassMap;
-  DataMapOfTransientAddress myProjPTMap;
-  DataMapOfShapeAddress myHatcherMap;
-  DataMapOfShapeAddress myProjSDataMap;
-  DataMapOfShapeAddress myBndBoxDataMap;
-  DataMapOfShapeAddress mySurfAdaptorMap;
-  DataMapOfShapeAddress myOBBMap; // Map of oriented bounding boxes
+  NCollection_DataMap<TopoDS_Shape, IntTools_FClass2d*, TopTools_ShapeMapHasher>           myFClass2dMap;
+  NCollection_DataMap<TopoDS_Shape, GeomAPI_ProjectPointOnSurf*, TopTools_ShapeMapHasher>  myProjPSMap;
+  NCollection_DataMap<TopoDS_Shape, GeomAPI_ProjectPointOnCurve*, TopTools_ShapeMapHasher> myProjPCMap;
+  NCollection_DataMap<TopoDS_Shape, BRepClass3d_SolidClassifier*, TopTools_ShapeMapHasher> mySClassMap;
+  NCollection_DataMap<Handle(Geom_Curve), GeomAPI_ProjectPointOnCurve*, TColStd_MapTransientHasher> myProjPTMap;
+  NCollection_DataMap<TopoDS_Shape, Geom2dHatch_Hatcher*, TopTools_ShapeMapHasher> myHatcherMap;
+  NCollection_DataMap<TopoDS_Shape, IntTools_SurfaceRangeLocalizeData*, TopTools_ShapeMapHasher> myProjSDataMap;
+  NCollection_DataMap<TopoDS_Shape, Bnd_Box*, TopTools_ShapeMapHasher> myBndBoxDataMap;
+  NCollection_DataMap<TopoDS_Shape, BRepAdaptor_Surface*, TopTools_ShapeMapHasher> mySurfAdaptorMap;
+  NCollection_DataMap<TopoDS_Shape, Bnd_OBB*, TopTools_ShapeMapHasher> myOBBMap; // Map of oriented bounding boxes
   Standard_Integer myCreateFlag;
   Standard_Real myPOnSTolerance;
 
-
 private:
 
   
index 84edacc25b6e113edbdfde0d5b42056050091b2a..65e525a39caa2a258ff3e178f5ed33888ec7925d 100644 (file)
@@ -87,13 +87,11 @@ struct SplitDS
     myPerMinParam(0.0),
     myPerMaxParam(0.0),
     myPeriodicDir(0),
-    myExtCC(NULL),
+    myExtCCCurve1(NULL),
+    myExtCCLast2DParam(0.0),
     myExtPS(NULL)
   { }
 
-  // Assignment operator is forbidden.
-  void operator=(const SplitDS &theSplitDS);
-
   const Handle(Adaptor3d_Curve) myCurve;
   const Handle(Adaptor3d_Surface) mySurface;
   NCollection_Vector<Standard_Real> &mySplits;
@@ -102,8 +100,16 @@ struct SplitDS
   Standard_Real myPerMaxParam;
   Standard_Integer myPeriodicDir;
 
-  Extrema_ExtCC *myExtCC;
+  Adaptor3d_CurveOnSurface* myExtCCCurve1;
+  Standard_Real  myExtCCLast2DParam;
+
   Extrema_ExtPS *myExtPS;
+
+private:
+
+  // Assignment operator is forbidden.
+  void operator=(const SplitDS &theSplitDS);
+
 };
 
   //! Compute split points in the parameter space of the curve.
@@ -1876,13 +1882,8 @@ void SplitOnDirection(SplitDS & theSplitDS)
   Handle(Geom2d_Curve) aC2GC = new Geom2d_Line(aStartPnt, aDir);
   Handle(Geom2dAdaptor_Curve) aC = new Geom2dAdaptor_Curve(aC2GC, 0, aLast2DParam);
   Adaptor3d_CurveOnSurface  aCOnS(aC, theSplitDS.mySurface);
-
-  Extrema_ExtCC anExtCC;
-  anExtCC.SetCurve(1, aCOnS);
-  anExtCC.SetCurve(2, *theSplitDS.myCurve);
-  anExtCC.SetSingleSolutionFlag(Standard_True); // Search only one solution since multiple invocations are needed.
-  anExtCC.SetRange(1, 0, aLast2DParam);
-  theSplitDS.myExtCC = &anExtCC;
+  theSplitDS.myExtCCCurve1 = &aCOnS;
+  theSplitDS.myExtCCLast2DParam = aLast2DParam;
 
   FindSplitPoint(theSplitDS,
                  theSplitDS.myCurve->FirstParameter(), // Initial curve range.
@@ -1899,7 +1900,11 @@ void FindSplitPoint(SplitDS &theSplitDS,
                     const Standard_Real theMaxParam)
 {
   // Make extrema copy to avoid dependencies between different levels of the recursion.
-  Extrema_ExtCC anExtCC(*theSplitDS.myExtCC);
+  Extrema_ExtCC anExtCC;
+  anExtCC.SetCurve(1, *theSplitDS.myExtCCCurve1);
+  anExtCC.SetCurve(2, *theSplitDS.myCurve);
+  anExtCC.SetSingleSolutionFlag (Standard_True); // Search only one solution since multiple invocations are needed.
+  anExtCC.SetRange(1, 0, theSplitDS.myExtCCLast2DParam);
   anExtCC.SetRange(2, theMinParam, theMaxParam);
   anExtCC.Perform();
 
index 24291af29d585d4418022f900ba64edf329c88fc..3eb225c9b4188ebc97df900d56d7e594e89df6a2 100644 (file)
@@ -24,7 +24,8 @@
 #include <ProjLib_PrjFunc.hxx>
 #include <Standard_ConstructionError.hxx>
 
-ProjLib_PrjFunc::ProjLib_PrjFunc(const Adaptor3d_CurvePtr & C,const Standard_Real FixVal,const Adaptor3d_SurfacePtr & S, const Standard_Integer Fix) : myCurve(C), mySurface(S), myt(0), myU(0), myV(0), myFix(Fix)
+ProjLib_PrjFunc::ProjLib_PrjFunc (const Adaptor3d_Curve* C, const Standard_Real FixVal, const Adaptor3d_Surface* S, const Standard_Integer Fix)
+: myCurve(C), mySurface(S), myt(0), myU(0), myV(0), myFix(Fix)
 {
   myNorm=Min(1.,Min(mySurface->UResolution(1.),mySurface->VResolution(1.)));
 // myNorm=1.;
@@ -136,5 +137,3 @@ gp_Pnt2d ProjLib_PrjFunc::Solution() const
   // pout NT, meme si on n'y passe pas.
   return gp_Pnt2d(0.,0.);
 }
-
-
index a0c3ee37c940a003592ff1232efdc3605d4d646a..7224fd8aa5594a7788f4da91d1646903f8afb07c 100644 (file)
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Adaptor3d_CurvePtr.hxx>
-#include <Adaptor3d_SurfacePtr.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_Integer.hxx>
 #include <math_FunctionSetWithDerivatives.hxx>
-#include <Standard_Boolean.hxx>
 #include <math_Vector.hxx>
-class Standard_ConstructionError;
+
 class math_Matrix;
 class gp_Pnt2d;
 
-
-
 class ProjLib_PrjFunc  : public math_FunctionSetWithDerivatives
 {
 public:
@@ -41,7 +34,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   
-  Standard_EXPORT ProjLib_PrjFunc(const Adaptor3d_CurvePtr& C, const Standard_Real FixVal, const Adaptor3d_SurfacePtr& S, const Standard_Integer Fix);
+  Standard_EXPORT ProjLib_PrjFunc(const Adaptor3d_Curve* C, const Standard_Real FixVal, const Adaptor3d_Surface* S, const Standard_Integer Fix);
   
   //! returns the number of variables of the function.
   Standard_EXPORT Standard_Integer NbVariables() const;
@@ -70,34 +63,16 @@ public:
   //! returns  point  on  surface
   Standard_EXPORT gp_Pnt2d Solution() const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-
-
-  Adaptor3d_CurvePtr myCurve;
-  Adaptor3d_SurfacePtr mySurface;
+  const Adaptor3d_Curve* myCurve;
+  const Adaptor3d_Surface* mySurface;
   Standard_Real myt;
   Standard_Real myU;
   Standard_Real myV;
   Standard_Integer myFix;
   Standard_Real myNorm;
 
-
 };
 
-
-
-
-
-
-
 #endif // _ProjLib_PrjFunc_HeaderFile
index e6455485f0a1b7b78fbc53c9bfc1392a15d9af52..abd0f3ea8dbcff74faa13e2ebe413a11ac5c92b3 100644 (file)
@@ -32,8 +32,8 @@ ProjLib_PrjResolve::ProjLib_PrjResolve(const Adaptor3d_Curve& C,const Adaptor3d_
 {
   if (myFix > 3 || myFix < 1) throw Standard_ConstructionError();
   mySolution = gp_Pnt2d(0.,0.);
-  myCurve    = (Adaptor3d_CurvePtr)&C;
-  mySurface  = (Adaptor3d_SurfacePtr)&S; 
+  myCurve    = &C;
+  mySurface  = &S; 
 }
 
 // void ProjLib_PrjResolve::Perform(const Standard_Real t, const Standard_Real U, const Standard_Real  V, const gp_Pnt2d& Tol2d, const gp_Pnt2d& Inf, const gp_Pnt2d& Sup, const Standard_Real FuncTol, const Standard_Boolean StrictInside)
index 94929c2df741f85918f16c765a31740f6c1e950e..75ab66b1e3b6dce281d3cf31f1415b50ae06c0f1 100644 (file)
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
-#include <Adaptor3d_CurvePtr.hxx>
-#include <Adaptor3d_SurfacePtr.hxx>
-#include <Standard_Boolean.hxx>
 #include <gp_Pnt2d.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Real.hxx>
-class Standard_DomainError;
-class Standard_ConstructionError;
-class StdFail_NotDone;
+
 class Adaptor3d_Curve;
 class Adaptor3d_Surface;
-class gp_Pnt2d;
-
 
 
 class ProjLib_PrjResolve 
@@ -59,32 +50,14 @@ public:
   //! Returns the point of the extremum distance.
   Standard_EXPORT gp_Pnt2d Solution() const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-
-
-  Adaptor3d_CurvePtr myCurve;
-  Adaptor3d_SurfacePtr mySurface;
+  const Adaptor3d_Curve* myCurve;
+  const Adaptor3d_Surface* mySurface;
   Standard_Boolean myDone;
   gp_Pnt2d mySolution;
   Standard_Integer myFix;
 
-
 };
 
-
-
-
-
-
-
 #endif // _ProjLib_PrjResolve_HeaderFile