mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
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.
This commit is contained in:
@@ -87,13 +87,11 @@ struct SplitDS
|
||||
myPerMinParam(0.0),
|
||||
myPerMaxParam(0.0),
|
||||
myPeriodicDir(0),
|
||||
myExtCC(NULL),
|
||||
myExtCCCurve1(NULL),
|
||||
myExtCCLast2DParam(0.0),
|
||||
myExtPS(NULL)
|
||||
{ }
|
||||
|
||||
// Assignment operator is forbidden.
|
||||
void operator=(const SplitDS &theSplitDS);
|
||||
|
||||
const Handle(Adaptor3d_Curve) myCurve;
|
||||
const Handle(Adaptor3d_Surface) mySurface;
|
||||
NCollection_Vector<Standard_Real> &mySplits;
|
||||
@@ -102,8 +100,16 @@ struct SplitDS
|
||||
Standard_Real myPerMaxParam;
|
||||
Standard_Integer myPeriodicDir;
|
||||
|
||||
Extrema_ExtCC *myExtCC;
|
||||
Adaptor3d_CurveOnSurface* myExtCCCurve1;
|
||||
Standard_Real myExtCCLast2DParam;
|
||||
|
||||
Extrema_ExtPS *myExtPS;
|
||||
|
||||
private:
|
||||
|
||||
// Assignment operator is forbidden.
|
||||
void operator=(const SplitDS &theSplitDS);
|
||||
|
||||
};
|
||||
|
||||
//! Compute split points in the parameter space of the curve.
|
||||
@@ -1876,13 +1882,8 @@ void SplitOnDirection(SplitDS & theSplitDS)
|
||||
Handle(Geom2d_Curve) aC2GC = new Geom2d_Line(aStartPnt, aDir);
|
||||
Handle(Geom2dAdaptor_Curve) aC = new Geom2dAdaptor_Curve(aC2GC, 0, aLast2DParam);
|
||||
Adaptor3d_CurveOnSurface aCOnS(aC, theSplitDS.mySurface);
|
||||
|
||||
Extrema_ExtCC anExtCC;
|
||||
anExtCC.SetCurve(1, aCOnS);
|
||||
anExtCC.SetCurve(2, *theSplitDS.myCurve);
|
||||
anExtCC.SetSingleSolutionFlag(Standard_True); // Search only one solution since multiple invocations are needed.
|
||||
anExtCC.SetRange(1, 0, aLast2DParam);
|
||||
theSplitDS.myExtCC = &anExtCC;
|
||||
theSplitDS.myExtCCCurve1 = &aCOnS;
|
||||
theSplitDS.myExtCCLast2DParam = aLast2DParam;
|
||||
|
||||
FindSplitPoint(theSplitDS,
|
||||
theSplitDS.myCurve->FirstParameter(), // Initial curve range.
|
||||
@@ -1899,7 +1900,11 @@ void FindSplitPoint(SplitDS &theSplitDS,
|
||||
const Standard_Real theMaxParam)
|
||||
{
|
||||
// Make extrema copy to avoid dependencies between different levels of the recursion.
|
||||
Extrema_ExtCC anExtCC(*theSplitDS.myExtCC);
|
||||
Extrema_ExtCC anExtCC;
|
||||
anExtCC.SetCurve(1, *theSplitDS.myExtCCCurve1);
|
||||
anExtCC.SetCurve(2, *theSplitDS.myCurve);
|
||||
anExtCC.SetSingleSolutionFlag (Standard_True); // Search only one solution since multiple invocations are needed.
|
||||
anExtCC.SetRange(1, 0, theSplitDS.myExtCCLast2DParam);
|
||||
anExtCC.SetRange(2, theMinParam, theMaxParam);
|
||||
anExtCC.Perform();
|
||||
|
||||
|
@@ -24,7 +24,8 @@
|
||||
#include <ProjLib_PrjFunc.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
ProjLib_PrjFunc::ProjLib_PrjFunc(const Adaptor3d_CurvePtr & C,const Standard_Real FixVal,const Adaptor3d_SurfacePtr & S, const Standard_Integer Fix) : myCurve(C), mySurface(S), myt(0), myU(0), myV(0), myFix(Fix)
|
||||
ProjLib_PrjFunc::ProjLib_PrjFunc (const Adaptor3d_Curve* C, const Standard_Real FixVal, const Adaptor3d_Surface* S, const Standard_Integer Fix)
|
||||
: myCurve(C), mySurface(S), myt(0), myU(0), myV(0), myFix(Fix)
|
||||
{
|
||||
myNorm=Min(1.,Min(mySurface->UResolution(1.),mySurface->VResolution(1.)));
|
||||
// myNorm=1.;
|
||||
@@ -136,5 +137,3 @@ gp_Pnt2d ProjLib_PrjFunc::Solution() const
|
||||
// pout NT, meme si on n'y passe pas.
|
||||
return gp_Pnt2d(0.,0.);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -21,19 +21,12 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Adaptor3d_CurvePtr.hxx>
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <math_FunctionSetWithDerivatives.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
class Standard_ConstructionError;
|
||||
|
||||
class math_Matrix;
|
||||
class gp_Pnt2d;
|
||||
|
||||
|
||||
|
||||
class ProjLib_PrjFunc : public math_FunctionSetWithDerivatives
|
||||
{
|
||||
public:
|
||||
@@ -41,7 +34,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT ProjLib_PrjFunc(const Adaptor3d_CurvePtr& C, const Standard_Real FixVal, const Adaptor3d_SurfacePtr& S, const Standard_Integer Fix);
|
||||
Standard_EXPORT ProjLib_PrjFunc(const Adaptor3d_Curve* C, const Standard_Real FixVal, const Adaptor3d_Surface* S, const Standard_Integer Fix);
|
||||
|
||||
//! returns the number of variables of the function.
|
||||
Standard_EXPORT Standard_Integer NbVariables() const;
|
||||
@@ -70,34 +63,16 @@ public:
|
||||
//! returns point on surface
|
||||
Standard_EXPORT gp_Pnt2d Solution() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Adaptor3d_CurvePtr myCurve;
|
||||
Adaptor3d_SurfacePtr mySurface;
|
||||
const Adaptor3d_Curve* myCurve;
|
||||
const Adaptor3d_Surface* mySurface;
|
||||
Standard_Real myt;
|
||||
Standard_Real myU;
|
||||
Standard_Real myV;
|
||||
Standard_Integer myFix;
|
||||
Standard_Real myNorm;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ProjLib_PrjFunc_HeaderFile
|
||||
|
@@ -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)
|
||||
|
@@ -21,19 +21,10 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Adaptor3d_CurvePtr.hxx>
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Standard_DomainError;
|
||||
class Standard_ConstructionError;
|
||||
class StdFail_NotDone;
|
||||
|
||||
class Adaptor3d_Curve;
|
||||
class Adaptor3d_Surface;
|
||||
class gp_Pnt2d;
|
||||
|
||||
|
||||
|
||||
class ProjLib_PrjResolve
|
||||
@@ -59,32 +50,14 @@ public:
|
||||
//! Returns the point of the extremum distance.
|
||||
Standard_EXPORT gp_Pnt2d Solution() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Adaptor3d_CurvePtr myCurve;
|
||||
Adaptor3d_SurfacePtr mySurface;
|
||||
const Adaptor3d_Curve* myCurve;
|
||||
const Adaptor3d_Surface* mySurface;
|
||||
Standard_Boolean myDone;
|
||||
gp_Pnt2d mySolution;
|
||||
Standard_Integer myFix;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ProjLib_PrjResolve_HeaderFile
|
||||
|
Reference in New Issue
Block a user