From d6e050ac4455bdd067c3b7f8e9ac09d8d1aad412 Mon Sep 17 00:00:00 2001 From: kgv Date: Fri, 18 Dec 2020 14:29:59 +0300 Subject: [PATCH] 0032008: Modeling Algorithms - disallow implicit copy of Extrema algorithms 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. --- src/Adaptor3d/Adaptor3d_CurveOnSurfacePtr.hxx | 23 -- src/Adaptor3d/Adaptor3d_CurvePtr.hxx | 23 -- src/Adaptor3d/Adaptor3d_SurfacePtr.hxx | 23 -- src/Adaptor3d/FILES | 3 - src/BOPAlgo/BOPAlgo_Tools.cxx | 12 +- src/BRepFill/BRepFill_Filling.cxx | 59 ++-- src/BRepFill/BRepFill_Filling.hxx | 46 +-- src/BRepGProp/BRepGProp_TFunction.cxx | 2 +- src/BRepGProp/BRepGProp_TFunction.hxx | 9 +- src/BRepGProp/BRepGProp_UFunction.cxx | 8 +- src/BRepGProp/BRepGProp_UFunction.hxx | 14 +- src/BRepGProp/BRepGProp_VinertGK.cxx | 19 +- src/BRepGProp/BRepGProp_VinertGK.hxx | 18 +- src/Extrema/Extrema_ExtCC.cxx | 117 ++++--- src/Extrema/Extrema_ExtCC.hxx | 30 +- src/Extrema/Extrema_ExtCC2d.cxx | 98 +++--- src/Extrema/Extrema_ExtCC2d.hxx | 2 +- src/Extrema/Extrema_ExtCS.cxx | 12 +- src/Extrema/Extrema_ExtCS.hxx | 39 +-- src/Extrema/Extrema_ExtPRevS.cxx | 2 +- src/Extrema/Extrema_ExtPS.cxx | 2 +- src/Extrema/Extrema_ExtPS.hxx | 24 +- src/Extrema/Extrema_ExtSS.cxx | 2 +- src/Extrema/Extrema_ExtSS.hxx | 24 +- src/Extrema/Extrema_FuncExtCS.cxx | 25 +- src/Extrema/Extrema_FuncExtCS.hxx | 28 +- src/Extrema/Extrema_FuncExtSS.cxx | 8 +- src/Extrema/Extrema_FuncExtSS.hxx | 25 +- src/Extrema/Extrema_FuncPSNorm.cxx | 4 +- src/Extrema/Extrema_FuncPSNorm.hxx | 7 +- src/Extrema/Extrema_GenExtCS.cxx | 21 +- src/Extrema/Extrema_GenExtCS.hxx | 42 +-- src/Extrema/Extrema_GenExtPS.cxx | 89 +++--- src/Extrema/Extrema_GenExtPS.hxx | 60 +--- src/Extrema/Extrema_GenExtSS.cxx | 13 +- src/Extrema/Extrema_GenExtSS.hxx | 33 +- .../Extrema_HArray2OfPOnSurfParams.hxx | 27 -- src/Extrema/FILES | 1 - src/GeomAPI/GeomAPI_ExtremaCurveCurve.cxx | 9 +- src/GeomAPI/GeomAPI_ExtremaCurveSurface.cxx | 12 +- src/GeomFill/GeomFill_Darboux.cxx | 13 +- src/GeomInt/GeomInt_IntSS_1.cxx | 2 +- src/HLRBRep/HLRBRep_Intersector.cxx | 46 +-- src/IntTools/IntTools_BeanFaceIntersector.cxx | 43 ++- src/IntTools/IntTools_BeanFaceIntersector.hxx | 1 - src/IntTools/IntTools_Context.cxx | 291 +++++++----------- src/IntTools/IntTools_Context.hxx | 28 +- src/ProjLib/ProjLib_CompProjectedCurve.cxx | 31 +- src/ProjLib/ProjLib_PrjFunc.cxx | 5 +- src/ProjLib/ProjLib_PrjFunc.hxx | 33 +- src/ProjLib/ProjLib_PrjResolve.cxx | 4 +- src/ProjLib/ProjLib_PrjResolve.hxx | 33 +- 52 files changed, 542 insertions(+), 1003 deletions(-) delete mode 100644 src/Adaptor3d/Adaptor3d_CurveOnSurfacePtr.hxx delete mode 100644 src/Adaptor3d/Adaptor3d_CurvePtr.hxx delete mode 100644 src/Adaptor3d/Adaptor3d_SurfacePtr.hxx delete mode 100644 src/Extrema/Extrema_HArray2OfPOnSurfParams.hxx diff --git a/src/Adaptor3d/Adaptor3d_CurveOnSurfacePtr.hxx b/src/Adaptor3d/Adaptor3d_CurveOnSurfacePtr.hxx deleted file mode 100644 index c991c72e7f..0000000000 --- a/src/Adaptor3d/Adaptor3d_CurveOnSurfacePtr.hxx +++ /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 index ab8ae1fc0a..0000000000 --- a/src/Adaptor3d/Adaptor3d_CurvePtr.hxx +++ /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 index 5d0471cf9e..0000000000 --- a/src/Adaptor3d/Adaptor3d_SurfacePtr.hxx +++ /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 diff --git a/src/Adaptor3d/FILES b/src/Adaptor3d/FILES index 7bf779a5e1..4ab747ad31 100644 --- a/src/Adaptor3d/FILES +++ b/src/Adaptor3d/FILES @@ -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 diff --git a/src/BOPAlgo/BOPAlgo_Tools.cxx b/src/BOPAlgo/BOPAlgo_Tools.cxx index 82ac4b0855..e5f3c071a2 100644 --- a/src/BOPAlgo/BOPAlgo_Tools.cxx +++ b/src/BOPAlgo/BOPAlgo_Tools.cxx @@ -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++) { diff --git a/src/BRepFill/BRepFill_Filling.cxx b/src/BRepFill/BRepFill_Filling.cxx index 856e633674..546919e9aa 100644 --- a/src/BRepFill/BRepFill_Filling.cxx +++ b/src/BRepFill/BRepFill_Filling.cxx @@ -14,8 +14,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include -#include #include #include #include @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -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); } diff --git a/src/BRepFill/BRepFill_Filling.hxx b/src/BRepFill/BRepFill_Filling.hxx index b37bad27dc..558cdc3a18 100644 --- a/src/BRepFill/BRepFill_Filling.hxx +++ b/src/BRepFill/BRepFill_Filling.hxx @@ -17,30 +17,20 @@ #ifndef _BRepFill_Filling_HeaderFile #define _BRepFill_Filling_HeaderFile -#include -#include -#include - -#include #include #include +#include +#include #include +#include #include #include -#include -#include -#include -#include -#include #include -class StdFail_NotDone; -class Standard_OutOfRange; -class Standard_ConstructionError; -class TopoDS_Face; + +#include + 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 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 diff --git a/src/BRepGProp/BRepGProp_TFunction.cxx b/src/BRepGProp/BRepGProp_TFunction.cxx index a1f93502ef..f7422000b9 100644 --- a/src/BRepGProp/BRepGProp_TFunction.cxx +++ b/src/BRepGProp/BRepGProp_TFunction.cxx @@ -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), diff --git a/src/BRepGProp/BRepGProp_TFunction.hxx b/src/BRepGProp/BRepGProp_TFunction.hxx index a9c298c2af..baecc46400 100644 --- a/src/BRepGProp/BRepGProp_TFunction.hxx +++ b/src/BRepGProp/BRepGProp_TFunction.hxx @@ -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(); diff --git a/src/BRepGProp/BRepGProp_UFunction.cxx b/src/BRepGProp/BRepGProp_UFunction.cxx index 14860e322f..1fdc71c276 100644 --- a/src/BRepGProp/BRepGProp_UFunction.cxx +++ b/src/BRepGProp/BRepGProp_UFunction.cxx @@ -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); diff --git a/src/BRepGProp/BRepGProp_UFunction.hxx b/src/BRepGProp/BRepGProp_UFunction.hxx index 3d2dee4c9e..1bc0da5e52 100644 --- a/src/BRepGProp/BRepGProp_UFunction.hxx +++ b/src/BRepGProp/BRepGProp_UFunction.hxx @@ -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; diff --git a/src/BRepGProp/BRepGProp_VinertGK.cxx b/src/BRepGProp/BRepGProp_VinertGK.cxx index 388d674107..01737d7725 100644 --- a/src/BRepGProp/BRepGProp_VinertGK.cxx +++ b/src/BRepGProp/BRepGProp_VinertGK.cxx @@ -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); diff --git a/src/BRepGProp/BRepGProp_VinertGK.hxx b/src/BRepGProp/BRepGProp_VinertGK.hxx index fde63e8875..54ed1e98b5 100644 --- a/src/BRepGProp/BRepGProp_VinertGK.hxx +++ b/src/BRepGProp/BRepGProp_VinertGK.hxx @@ -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; diff --git a/src/Extrema/Extrema_ExtCC.cxx b/src/Extrema/Extrema_ExtCC.cxx index 3a36a87d55..fa77b80c79 100644 --- a/src/Extrema/Extrema_ExtCC.cxx +++ b/src/Extrema/Extrema_ExtCC.cxx @@ -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()) && diff --git a/src/Extrema/Extrema_ExtCC.hxx b/src/Extrema/Extrema_ExtCC.hxx index d2ee29c0f5..9521c2833e 100644 --- a/src/Extrema/Extrema_ExtCC.hxx +++ b/src/Extrema/Extrema_ExtCC.hxx @@ -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 diff --git a/src/Extrema/Extrema_ExtCC2d.cxx b/src/Extrema/Extrema_ExtCC2d.cxx index 2fc69569f1..56ec32728f 100644 --- a/src/Extrema/Extrema_ExtCC2d.cxx +++ b/src/Extrema/Extrema_ExtCC2d.cxx @@ -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; diff --git a/src/Extrema/Extrema_ExtCC2d.hxx b/src/Extrema/Extrema_ExtCC2d.hxx index 43267b29f7..b41eaa5ba2 100644 --- a/src/Extrema/Extrema_ExtCC2d.hxx +++ b/src/Extrema/Extrema_ExtCC2d.hxx @@ -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; diff --git a/src/Extrema/Extrema_ExtCS.cxx b/src/Extrema/Extrema_ExtCS.cxx index 91d87758de..5f85ef99d1 100644 --- a/src/Extrema/Extrema_ExtCS.cxx +++ b/src/Extrema/Extrema_ExtCS.cxx @@ -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; diff --git a/src/Extrema/Extrema_ExtCS.hxx b/src/Extrema/Extrema_ExtCS.hxx index 316688fdb9..689a8f67fa 100644 --- a/src/Extrema/Extrema_ExtCS.hxx +++ b/src/Extrema/Extrema_ExtCS.hxx @@ -21,18 +21,12 @@ #include #include -#include -#include #include #include #include -#include #include #include -#include -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 diff --git a/src/Extrema/Extrema_ExtPRevS.cxx b/src/Extrema/Extrema_ExtPRevS.cxx index 93e3347ca9..dcf52c1b8c 100644 --- a/src/Extrema/Extrema_ExtPRevS.cxx +++ b/src/Extrema/Extrema_ExtPRevS.cxx @@ -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) diff --git a/src/Extrema/Extrema_ExtPS.cxx b/src/Extrema/Extrema_ExtPS.cxx index ba8da723a5..341758fa28 100644 --- a/src/Extrema/Extrema_ExtPS.cxx +++ b/src/Extrema/Extrema_ExtPS.cxx @@ -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; diff --git a/src/Extrema/Extrema_ExtPS.hxx b/src/Extrema/Extrema_ExtPS.hxx index 18dada3651..e207b95742 100644 --- a/src/Extrema/Extrema_ExtPS.hxx +++ b/src/Extrema/Extrema_ExtPS.hxx @@ -21,8 +21,6 @@ #include #include -#include -#include #include #include #include @@ -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 diff --git a/src/Extrema/Extrema_ExtSS.cxx b/src/Extrema/Extrema_ExtSS.cxx index 52845d39e6..b6b002c366 100644 --- a/src/Extrema/Extrema_ExtSS.cxx +++ b/src/Extrema/Extrema_ExtSS.cxx @@ -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; diff --git a/src/Extrema/Extrema_ExtSS.hxx b/src/Extrema/Extrema_ExtSS.hxx index 141229011f..64956956c7 100644 --- a/src/Extrema/Extrema_ExtSS.hxx +++ b/src/Extrema/Extrema_ExtSS.hxx @@ -21,8 +21,6 @@ #include #include -#include -#include #include #include #include @@ -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 diff --git a/src/Extrema/Extrema_FuncExtCS.cxx b/src/Extrema/Extrema_FuncExtCS.cxx index 230dfeb17a..a4889c43b8 100644 --- a/src/Extrema/Extrema_FuncExtCS.cxx +++ b/src/Extrema/Extrema_FuncExtCS.cxx @@ -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; -} - diff --git a/src/Extrema/Extrema_FuncExtCS.hxx b/src/Extrema/Extrema_FuncExtCS.hxx index 4a07792a3c..70aa2b2cfb 100644 --- a/src/Extrema/Extrema_FuncExtCS.hxx +++ b/src/Extrema/Extrema_FuncExtCS.hxx @@ -21,8 +21,6 @@ #include #include -#include -#include #include #include #include @@ -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 diff --git a/src/Extrema/Extrema_FuncExtSS.cxx b/src/Extrema/Extrema_FuncExtSS.cxx index b311ef0c0e..10ac91d078 100644 --- a/src/Extrema/Extrema_FuncExtSS.cxx +++ b/src/Extrema/Extrema_FuncExtSS.cxx @@ -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(); diff --git a/src/Extrema/Extrema_FuncExtSS.hxx b/src/Extrema/Extrema_FuncExtSS.hxx index f8423716ef..a432b3758c 100644 --- a/src/Extrema/Extrema_FuncExtSS.hxx +++ b/src/Extrema/Extrema_FuncExtSS.hxx @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -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 diff --git a/src/Extrema/Extrema_FuncPSNorm.cxx b/src/Extrema/Extrema_FuncPSNorm.cxx index d73d0b9740..c234091f97 100644 --- a/src/Extrema/Extrema_FuncPSNorm.cxx +++ b/src/Extrema/Extrema_FuncPSNorm.cxx @@ -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(); diff --git a/src/Extrema/Extrema_FuncPSNorm.hxx b/src/Extrema/Extrema_FuncPSNorm.hxx index 275f0f249f..f11f46e3ed 100644 --- a/src/Extrema/Extrema_FuncPSNorm.hxx +++ b/src/Extrema/Extrema_FuncPSNorm.hxx @@ -21,16 +21,13 @@ #include #include -#include -#include #include #include #include #include #include #include -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; diff --git a/src/Extrema/Extrema_GenExtCS.cxx b/src/Extrema/Extrema_GenExtCS.cxx index a193ba32b7..0642f5dccc 100644 --- a/src/Extrema/Extrema_GenExtCS.cxx +++ b/src/Extrema/Extrema_GenExtCS.cxx @@ -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; -} - diff --git a/src/Extrema/Extrema_GenExtCS.hxx b/src/Extrema/Extrema_GenExtCS.hxx index 2f043a8ef6..758850aed9 100644 --- a/src/Extrema/Extrema_GenExtCS.hxx +++ b/src/Extrema/Extrema_GenExtCS.hxx @@ -17,21 +17,9 @@ #ifndef _Extrema_GenExtCS_HeaderFile #define _Extrema_GenExtCS_HeaderFile -#include -#include -#include - -#include -#include -#include #include -#include #include -#include -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 diff --git a/src/Extrema/Extrema_GenExtPS.cxx b/src/Extrema/Extrema_GenExtPS.cxx index 0c90446570..43a82c55f7 100644 --- a/src/Extrema/Extrema_GenExtPS.cxx +++ b/src/Extrema/Extrema_GenExtPS.cxx @@ -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)); } } } diff --git a/src/Extrema/Extrema_GenExtPS.hxx b/src/Extrema/Extrema_GenExtPS.hxx index 389469ca13..3f64783bd3 100644 --- a/src/Extrema/Extrema_GenExtPS.hxx +++ b/src/Extrema/Extrema_GenExtPS.hxx @@ -17,30 +17,16 @@ #ifndef _Extrema_GenExtPS_HeaderFile #define _Extrema_GenExtPS_HeaderFile -#include -#include -#include - -#include -#include -#include -#include -#include #include +#include +#include +#include #include -#include #include #include #include -#include -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 diff --git a/src/Extrema/Extrema_GenExtSS.cxx b/src/Extrema/Extrema_GenExtSS.cxx index 6db3f8eb6d..42dcedd1f8 100644 --- a/src/Extrema/Extrema_GenExtSS.cxx +++ b/src/Extrema/Extrema_GenExtSS.cxx @@ -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; -} - diff --git a/src/Extrema/Extrema_GenExtSS.hxx b/src/Extrema/Extrema_GenExtSS.hxx index cc36cf50c7..5e3e5ed0b4 100644 --- a/src/Extrema/Extrema_GenExtSS.hxx +++ b/src/Extrema/Extrema_GenExtSS.hxx @@ -21,19 +21,12 @@ #include #include -#include -#include -#include #include #include -#include -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 index 2d3c758707..0000000000 --- a/src/Extrema/Extrema_HArray2OfPOnSurfParams.hxx +++ /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 -#include -#include - -DEFINE_HARRAY2(Extrema_HArray2OfPOnSurfParams, Extrema_Array2OfPOnSurfParams) - - -#endif diff --git a/src/Extrema/FILES b/src/Extrema/FILES index 1e3d13ee43..5f3d2ed048 100644 --- a/src/Extrema/FILES +++ b/src/Extrema/FILES @@ -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 diff --git a/src/GeomAPI/GeomAPI_ExtremaCurveCurve.cxx b/src/GeomAPI/GeomAPI_ExtremaCurveCurve.cxx index f474c36f1c..ba64d0f9f0 100644 --- a/src/GeomAPI/GeomAPI_ExtremaCurveCurve.cxx +++ b/src/GeomAPI/GeomAPI_ExtremaCurveCurve.cxx @@ -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 ); diff --git a/src/GeomAPI/GeomAPI_ExtremaCurveSurface.cxx b/src/GeomAPI/GeomAPI_ExtremaCurveSurface.cxx index 657815bb69..6dd37749b3 100644 --- a/src/GeomAPI/GeomAPI_ExtremaCurveSurface.cxx +++ b/src/GeomAPI/GeomAPI_ExtremaCurveSurface.cxx @@ -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) { diff --git a/src/GeomFill/GeomFill_Darboux.cxx b/src/GeomFill/GeomFill_Darboux.cxx index 9aa6e2f518..f9d862741f 100644 --- a/src/GeomFill/GeomFill_Darboux.cxx +++ b/src/GeomFill/GeomFill_Darboux.cxx @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -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(myTrimmed.get())->GetCurve(); + Handle(Adaptor3d_Surface) mySupport = static_cast(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(myTrimmed.get())->GetCurve(); + Handle(Adaptor3d_Surface) mySupport = static_cast(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(myTrimmed.get())->GetCurve(); + Handle(Adaptor3d_Surface) mySupport = static_cast(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, diff --git a/src/GeomInt/GeomInt_IntSS_1.cxx b/src/GeomInt/GeomInt_IntSS_1.cxx index c0637caee8..9ad1877196 100644 --- a/src/GeomInt/GeomInt_IntSS_1.cxx +++ b/src/GeomInt/GeomInt_IntSS_1.cxx @@ -134,7 +134,7 @@ //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) { diff --git a/src/HLRBRep/HLRBRep_Intersector.cxx b/src/HLRBRep/HLRBRep_Intersector.cxx index 9abd175f0e..bb48231ef2 100644 --- a/src/HLRBRep/HLRBRep_Intersector.cxx +++ b/src/HLRBRep/HLRBRep_Intersector.cxx @@ -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; diff --git a/src/IntTools/IntTools_BeanFaceIntersector.cxx b/src/IntTools/IntTools_BeanFaceIntersector.cxx index 93deb28bfd..0909c74360 100644 --- a/src/IntTools/IntTools_BeanFaceIntersector.cxx +++ b/src/IntTools/IntTools_BeanFaceIntersector.cxx @@ -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())) + } } } diff --git a/src/IntTools/IntTools_BeanFaceIntersector.hxx b/src/IntTools/IntTools_BeanFaceIntersector.hxx index 694646027a..7ee7b6e069 100644 --- a/src/IntTools/IntTools_BeanFaceIntersector.hxx +++ b/src/IntTools/IntTools_BeanFaceIntersector.hxx @@ -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; diff --git a/src/IntTools/IntTools_Context.cxx b/src/IntTools/IntTools_Context.cxx index b6c45959b3..7d18e8c83e 100644 --- a/src/IntTools/IntTools_Context.cxx +++ b/src/IntTools/IntTools_Context.cxx @@ -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::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::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::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::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::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::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::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::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::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::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 +} diff --git a/src/IntTools/IntTools_Context.hxx b/src/IntTools/IntTools_Context.hxx index 3ec1dcf554..2d29989439 100644 --- a/src/IntTools/IntTools_Context.hxx +++ b/src/IntTools/IntTools_Context.hxx @@ -245,28 +245,20 @@ Standard_EXPORT virtual ~IntTools_Context(); protected: - typedef NCollection_DataMap DataMapOfShapeAddress; - typedef NCollection_DataMap 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 myFClass2dMap; + NCollection_DataMap myProjPSMap; + NCollection_DataMap myProjPCMap; + NCollection_DataMap mySClassMap; + NCollection_DataMap myProjPTMap; + NCollection_DataMap myHatcherMap; + NCollection_DataMap myProjSDataMap; + NCollection_DataMap myBndBoxDataMap; + NCollection_DataMap mySurfAdaptorMap; + NCollection_DataMap myOBBMap; // Map of oriented bounding boxes Standard_Integer myCreateFlag; Standard_Real myPOnSTolerance; - private: diff --git a/src/ProjLib/ProjLib_CompProjectedCurve.cxx b/src/ProjLib/ProjLib_CompProjectedCurve.cxx index 84edacc25b..65e525a39c 100644 --- a/src/ProjLib/ProjLib_CompProjectedCurve.cxx +++ b/src/ProjLib/ProjLib_CompProjectedCurve.cxx @@ -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 &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(); diff --git a/src/ProjLib/ProjLib_PrjFunc.cxx b/src/ProjLib/ProjLib_PrjFunc.cxx index 24291af29d..3eb225c9b4 100644 --- a/src/ProjLib/ProjLib_PrjFunc.cxx +++ b/src/ProjLib/ProjLib_PrjFunc.cxx @@ -24,7 +24,8 @@ #include #include -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.); } - - diff --git a/src/ProjLib/ProjLib_PrjFunc.hxx b/src/ProjLib/ProjLib_PrjFunc.hxx index a0c3ee37c9..7224fd8aa5 100644 --- a/src/ProjLib/ProjLib_PrjFunc.hxx +++ b/src/ProjLib/ProjLib_PrjFunc.hxx @@ -21,19 +21,12 @@ #include #include -#include -#include -#include -#include #include -#include #include -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 diff --git a/src/ProjLib/ProjLib_PrjResolve.cxx b/src/ProjLib/ProjLib_PrjResolve.cxx index e6455485f0..abd0f3ea8d 100644 --- a/src/ProjLib/ProjLib_PrjResolve.cxx +++ b/src/ProjLib/ProjLib_PrjResolve.cxx @@ -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) diff --git a/src/ProjLib/ProjLib_PrjResolve.hxx b/src/ProjLib/ProjLib_PrjResolve.hxx index 94929c2df7..75ab66b1e3 100644 --- a/src/ProjLib/ProjLib_PrjResolve.hxx +++ b/src/ProjLib/ProjLib_PrjResolve.hxx @@ -21,19 +21,10 @@ #include #include -#include -#include -#include #include -#include -#include -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