mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-08-10 16:32:33 +08:00
Coding - Refactor reusing Extrema_ExtPS (#978)
- Eliminates redundant `Extrema_ExtPS` object creation by initializing once and performing multiple projections - Removes unused `#include <Extrema_ExtPS.hxx>` directives from files that no longer directly instantiate the class - Improves performance by avoiding repeated surface initialization overhead
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <Extrema_ExtCS.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <Extrema_GenExtCS.hxx>
|
||||
#include <Extrema_GenLocateExtPS.hxx>
|
||||
#include <Extrema_POnCurv.hxx>
|
||||
@@ -1337,65 +1336,6 @@ static bool SetEmptyResultRange(const double theParameter, IntTools_MarkedRangeS
|
||||
return add;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// static function: TestCoinside
|
||||
// purpose:
|
||||
// ---------------------------------------------------------------------------------
|
||||
// static bool TestClose(const Extrema_ExtPS & theExt,
|
||||
// const double theDist)
|
||||
// {
|
||||
// bool close = false;
|
||||
// if(!theExt.IsDone() || theExt.NbExt() == 0)
|
||||
// return close;
|
||||
// else {
|
||||
// int ie;
|
||||
// for(ie = 1; ie <= theExt.NbExt(); ie++) {
|
||||
// double dist = theExt.Value(ie);
|
||||
// if(dist <= theDist) {
|
||||
// close = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return close;
|
||||
// }
|
||||
|
||||
// bool TestCoinside(const BRepAdaptor_Curve& theCurve,
|
||||
// const BRepAdaptor_Surface& theSurface)
|
||||
// {
|
||||
// double cfp = theCurve.FirstParameter(), clp = theCurve.LastParameter();
|
||||
// double cdp = fabs(clp - cfp) / 23.;
|
||||
|
||||
// int i = 0;
|
||||
// double tolE = theCurve.Tolerance(), tolF = theSurface.Tolerance();
|
||||
// double tolT = tolE + tolF, tolU = 1.e-9, tolV = 1.e-9;
|
||||
// gp_Pnt aP;
|
||||
|
||||
// theCurve.D0(cfp,aP);
|
||||
// Extrema_ExtPS eps(aP,theSurface,tolU,tolV);
|
||||
|
||||
// if(!TestClose(eps,tolT))
|
||||
// return false;
|
||||
|
||||
// theCurve.D0(clp,aP);
|
||||
// eps.Perform(aP);
|
||||
|
||||
// if(!TestClose(eps,tolT))
|
||||
// return false;
|
||||
|
||||
// bool close = true;
|
||||
|
||||
// for(i = 1; i <= 22; i++) {
|
||||
// theCurve.D0((cfp+((double)i)*cdp),aP);
|
||||
// eps.Perform(aP);
|
||||
// if(!TestClose(eps,tolT)) {
|
||||
// close = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return close;
|
||||
// }
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
bool IntTools_BeanFaceIntersector::LocalizeSolutions(
|
||||
|
||||
@@ -133,14 +133,12 @@ static int GetArc(NCollection_Sequence<occ::handle<IntPatch_Line>>& theSlin,
|
||||
double& theFirst,
|
||||
double& theLast);
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static bool IsPointOK(const gp_Pnt& theTestPnt,
|
||||
const Adaptor3d_Surface& theTestSurface,
|
||||
const double& theTol);
|
||||
static bool IsPointOK(Extrema_ExtPS& theExtPS, const gp_Pnt& theTestPnt, const double& theTol);
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
static bool GetPointOn2S(const gp_Pnt& theTestPnt,
|
||||
const Adaptor3d_Surface& theTestSurface,
|
||||
const double& theTol,
|
||||
Extrema_POnSurf& theResultPoint);
|
||||
static bool GetPointOn2S(Extrema_ExtPS& theExtPS,
|
||||
const gp_Pnt& theTestPnt,
|
||||
const double& theTol,
|
||||
Extrema_POnSurf& theResultPoint);
|
||||
//-------------------------------------------------------------------------------------------------------------------------
|
||||
static occ::handle<IntPatch_WLine> GetMergedWLineOnRestriction(
|
||||
NCollection_Sequence<occ::handle<IntPatch_Line>>& theSlin,
|
||||
@@ -1395,6 +1393,18 @@ static int GetArc(NCollection_Sequence<occ::handle<IntPatch_Line>>& theSlin,
|
||||
double EdgeTol = BRep_Tool::Tolerance(*anE);
|
||||
CheckTol = std::max(MaxVertexTol, EdgeTol);
|
||||
occ::handle<Geom_Curve> aCEdge = BRep_Tool::Curve(*anE, firstES1, lastES1);
|
||||
|
||||
// Initialize extrema projector for theSurfaceTool (used for classification checks)
|
||||
Extrema_ExtPS anExtPSTool;
|
||||
anExtPSTool.Initialize(*theSurfaceTool,
|
||||
theSurfaceTool->FirstUParameter(),
|
||||
theSurfaceTool->LastUParameter(),
|
||||
theSurfaceTool->FirstVParameter(),
|
||||
theSurfaceTool->LastVParameter(),
|
||||
CheckTol,
|
||||
CheckTol);
|
||||
anExtPSTool.SetFlag(Extrema_ExtFlag_MIN);
|
||||
|
||||
// classification gaps
|
||||
// a. min - first
|
||||
if (std::abs(firstES1 - WLVertexParameters.Value(1)) > arc->Resolution(MaxVertexTol))
|
||||
@@ -1402,7 +1412,7 @@ static int GetArc(NCollection_Sequence<occ::handle<IntPatch_Line>>& theSlin,
|
||||
double param = (firstES1 + WLVertexParameters.Value(1)) / 2.;
|
||||
gp_Pnt point;
|
||||
aCEdge->D0(param, point);
|
||||
if (!IsPointOK(point, *theSurfaceTool, CheckTol))
|
||||
if (!IsPointOK(anExtPSTool, point, CheckTol))
|
||||
{
|
||||
classifyOK = false;
|
||||
break;
|
||||
@@ -1415,7 +1425,7 @@ static int GetArc(NCollection_Sequence<occ::handle<IntPatch_Line>>& theSlin,
|
||||
double param = (lastES1 + WLVertexParameters.Value(WLVertexParameters.Length())) / 2.;
|
||||
gp_Pnt point;
|
||||
aCEdge->D0(param, point);
|
||||
if (!IsPointOK(point, *theSurfaceTool, CheckTol))
|
||||
if (!IsPointOK(anExtPSTool, point, CheckTol))
|
||||
{
|
||||
classifyOK = false;
|
||||
break;
|
||||
@@ -1431,7 +1441,7 @@ static int GetArc(NCollection_Sequence<occ::handle<IntPatch_Line>>& theSlin,
|
||||
double param = (WLVertexParameters.Value(i * 2) + WLVertexParameters.Value(i * 2 + 1)) / 2.;
|
||||
gp_Pnt point;
|
||||
aCEdge->D0(param, point);
|
||||
if (!IsPointOK(point, *theSurfaceTool, CheckTol))
|
||||
if (!IsPointOK(anExtPSTool, point, CheckTol))
|
||||
{
|
||||
classifyOK = false;
|
||||
break;
|
||||
@@ -1464,14 +1474,35 @@ static int GetArc(NCollection_Sequence<occ::handle<IntPatch_Line>>& theSlin,
|
||||
if (!classifyOK)
|
||||
return 0;
|
||||
|
||||
// Initialize extrema projectors for both surfaces
|
||||
Extrema_ExtPS anExtPSObj;
|
||||
anExtPSObj.Initialize(*theSurfaceObj,
|
||||
theSurfaceObj->FirstUParameter(),
|
||||
theSurfaceObj->LastUParameter(),
|
||||
theSurfaceObj->FirstVParameter(),
|
||||
theSurfaceObj->LastVParameter(),
|
||||
CheckTol,
|
||||
CheckTol);
|
||||
anExtPSObj.SetFlag(Extrema_ExtFlag_MIN);
|
||||
|
||||
Extrema_ExtPS anExtPSTool2;
|
||||
anExtPSTool2.Initialize(*theSurfaceTool,
|
||||
theSurfaceTool->FirstUParameter(),
|
||||
theSurfaceTool->LastUParameter(),
|
||||
theSurfaceTool->FirstVParameter(),
|
||||
theSurfaceTool->LastVParameter(),
|
||||
CheckTol,
|
||||
CheckTol);
|
||||
anExtPSTool2.SetFlag(Extrema_ExtFlag_MIN);
|
||||
|
||||
// create IntSurf_LineOn2S from points < PointsFromArc >
|
||||
for (i = 1; i <= PointsFromArc.Length(); i++)
|
||||
{
|
||||
Extrema_POnSurf pOnS1;
|
||||
Extrema_POnSurf pOnS2;
|
||||
gp_Pnt arcpoint = PointsFromArc.Value(i);
|
||||
bool isOnS1 = GetPointOn2S(arcpoint, *theSurfaceObj, CheckTol, pOnS1);
|
||||
bool isOnS2 = GetPointOn2S(arcpoint, *theSurfaceTool, CheckTol, pOnS2);
|
||||
bool isOnS1 = GetPointOn2S(anExtPSObj, arcpoint, CheckTol, pOnS1);
|
||||
bool isOnS2 = GetPointOn2S(anExtPSTool2, arcpoint, CheckTol, pOnS2);
|
||||
if (isOnS1 && isOnS2)
|
||||
{
|
||||
double u1 = 0., v1 = 0., u2 = 0., v2 = 0.;
|
||||
@@ -1491,22 +1522,18 @@ static int GetArc(NCollection_Sequence<occ::handle<IntPatch_Line>>& theSlin,
|
||||
//
|
||||
// purpose: returns the state of testPoint on OTHER face.
|
||||
//========================================================================================
|
||||
static bool IsPointOK(const gp_Pnt& theTestPnt,
|
||||
const Adaptor3d_Surface& theTestSurface,
|
||||
const double& theTol)
|
||||
static bool IsPointOK(Extrema_ExtPS& theExtPS, const gp_Pnt& theTestPnt, const double& theTol)
|
||||
{
|
||||
bool result = false;
|
||||
double ExtTol = theTol; // 1.e-7;
|
||||
Extrema_ExtPS extPS(theTestPnt, theTestSurface, ExtTol, ExtTol);
|
||||
if (extPS.IsDone() && extPS.NbExt() > 0)
|
||||
bool result = false;
|
||||
theExtPS.Perform(theTestPnt);
|
||||
if (theExtPS.IsDone() && theExtPS.NbExt() > 0)
|
||||
{
|
||||
int i = 0;
|
||||
double MinDist2 = 1.e+200;
|
||||
for (i = 1; i <= extPS.NbExt(); i++)
|
||||
for (int i = 1; i <= theExtPS.NbExt(); i++)
|
||||
{
|
||||
if (extPS.SquareDistance(i) < MinDist2)
|
||||
if (theExtPS.SquareDistance(i) < MinDist2)
|
||||
{
|
||||
MinDist2 = extPS.SquareDistance(i);
|
||||
MinDist2 = theExtPS.SquareDistance(i);
|
||||
}
|
||||
}
|
||||
if (MinDist2 <= theTol * theTol)
|
||||
@@ -1520,30 +1547,29 @@ static bool IsPointOK(const gp_Pnt& theTestPnt,
|
||||
//
|
||||
// purpose: check state of testPoint and returns result point if state is OK.
|
||||
//========================================================================================
|
||||
static bool GetPointOn2S(const gp_Pnt& theTestPnt,
|
||||
const Adaptor3d_Surface& theTestSurface,
|
||||
const double& theTol,
|
||||
Extrema_POnSurf& theResultPoint)
|
||||
static bool GetPointOn2S(Extrema_ExtPS& theExtPS,
|
||||
const gp_Pnt& theTestPnt,
|
||||
const double& theTol,
|
||||
Extrema_POnSurf& theResultPoint)
|
||||
{
|
||||
bool result = false;
|
||||
double ExtTol = theTol; // 1.e-7;
|
||||
Extrema_ExtPS extPS(theTestPnt, theTestSurface, ExtTol, ExtTol);
|
||||
if (extPS.IsDone() && extPS.NbExt() > 0)
|
||||
bool result = false;
|
||||
theExtPS.Perform(theTestPnt);
|
||||
if (theExtPS.IsDone() && theExtPS.NbExt() > 0)
|
||||
{
|
||||
int i = 0, minext = 1;
|
||||
int minext = 1;
|
||||
double MinDist2 = 1.e+200;
|
||||
for (i = 1; i <= extPS.NbExt(); i++)
|
||||
for (int i = 1; i <= theExtPS.NbExt(); i++)
|
||||
{
|
||||
if (extPS.SquareDistance(i) < MinDist2)
|
||||
if (theExtPS.SquareDistance(i) < MinDist2)
|
||||
{
|
||||
minext = i;
|
||||
MinDist2 = extPS.SquareDistance(i);
|
||||
MinDist2 = theExtPS.SquareDistance(i);
|
||||
}
|
||||
}
|
||||
if (MinDist2 <= theTol * theTol)
|
||||
{
|
||||
result = true;
|
||||
theResultPoint = extPS.Point(minext);
|
||||
theResultPoint = theExtPS.Point(minext);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -50,7 +50,7 @@ Standard_EXPORT bool FUN_Parameters(const gp_Pnt& Pnt, const TopoDS_Shape& F, do
|
||||
double uvtol = Surf.Tolerance();
|
||||
double fu = Surf.FirstUParameter(), lu = Surf.LastUParameter();
|
||||
double fv = Surf.FirstVParameter(), lv = Surf.LastVParameter();
|
||||
Extrema_ExtPS extps(Pnt, Surf, fu, lu, fv, lv, uvtol, uvtol);
|
||||
Extrema_ExtPS extps(Pnt, Surf, fu, lu, fv, lv, uvtol, uvtol, Extrema_ExtFlag_MIN);
|
||||
if (!extps.IsDone())
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -363,6 +363,20 @@ static TopAbs_Orientation GetOrientation(const TopoDS_Face& Fn, const TopoDS_Fac
|
||||
gp_Pnt pvt;
|
||||
gp_Vec d1u, d1v, n1, n2;
|
||||
|
||||
// Initialize extrema projector once for the target surface
|
||||
GeomAdaptor_Surface GAS(Sb);
|
||||
const double TolU = GAS.UResolution(Precision::Confusion());
|
||||
const double TolV = GAS.VResolution(Precision::Confusion());
|
||||
Extrema_ExtPS anExtPS;
|
||||
anExtPS.Initialize(GAS,
|
||||
GAS.FirstUParameter(),
|
||||
GAS.LastUParameter(),
|
||||
GAS.FirstVParameter(),
|
||||
GAS.LastVParameter(),
|
||||
TolU,
|
||||
TolV);
|
||||
anExtPS.SetFlag(Extrema_ExtFlag_MIN);
|
||||
|
||||
for (exp.Init(Fn, TopAbs_EDGE); exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Edge& edg = TopoDS::Edge(exp.Current());
|
||||
@@ -395,26 +409,23 @@ static TopAbs_Orientation GetOrientation(const TopoDS_Face& Fn, const TopoDS_Fac
|
||||
}
|
||||
|
||||
// Projection sur Sb
|
||||
GeomAdaptor_Surface GAS(Sb);
|
||||
double TolU = GAS.UResolution(Precision::Confusion());
|
||||
double TolV = GAS.VResolution(Precision::Confusion());
|
||||
Extrema_ExtPS dist(pvt, GAS, TolU, TolV);
|
||||
if (dist.IsDone())
|
||||
anExtPS.Perform(pvt);
|
||||
if (anExtPS.IsDone())
|
||||
{
|
||||
double dist2min = RealLast();
|
||||
int jmin = 0;
|
||||
for (int j = 1; j <= dist.NbExt(); j++)
|
||||
for (int j = 1; j <= anExtPS.NbExt(); j++)
|
||||
{
|
||||
if (dist.SquareDistance(j) < dist2min)
|
||||
if (anExtPS.SquareDistance(j) < dist2min)
|
||||
{
|
||||
jmin = j;
|
||||
dist2min = dist.SquareDistance(j);
|
||||
dist2min = anExtPS.SquareDistance(j);
|
||||
}
|
||||
}
|
||||
if (jmin != 0)
|
||||
{
|
||||
double uu, vv;
|
||||
dist.Point(jmin).Parameter(uu, vv);
|
||||
anExtPS.Point(jmin).Parameter(uu, vv);
|
||||
Sb->D1(uu, vv, pvt, d1u, d1v);
|
||||
n2 = d1u.Crossed(d1v);
|
||||
if (n2.Magnitude() > Precision::Confusion())
|
||||
|
||||
@@ -1476,6 +1476,17 @@ bool LocOpe_WiresOnShape::Add(const NCollection_Sequence<TopoDS_Shape>& theEdges
|
||||
BRepAdaptor_Surface anAdF(aCurF, false);
|
||||
NCollection_Handle<BRepTopAdaptor_FClass2d> aCheckStateTool;
|
||||
|
||||
// Initialize extrema projector once per face
|
||||
Extrema_ExtPS anExtr;
|
||||
anExtr.Initialize(anAdF,
|
||||
anAdF.FirstUParameter(),
|
||||
anAdF.LastUParameter(),
|
||||
anAdF.FirstVParameter(),
|
||||
anAdF.LastVParameter(),
|
||||
Precision::Confusion(),
|
||||
Precision::Confusion());
|
||||
anExtr.SetFlag(Extrema_ExtFlag_MIN);
|
||||
|
||||
i = 1;
|
||||
nb = anEdgeBoxes.Length();
|
||||
for (; i <= nb; i++)
|
||||
@@ -1495,8 +1506,8 @@ bool LocOpe_WiresOnShape::Add(const NCollection_Sequence<TopoDS_Shape>& theEdges
|
||||
anUsedEdges.Add(i);
|
||||
continue;
|
||||
}
|
||||
gp_Pnt aP = aC->Value((aF + aL) * 0.5);
|
||||
Extrema_ExtPS anExtr(aP, anAdF, Precision::Confusion(), Precision::Confusion());
|
||||
gp_Pnt aP = aC->Value((aF + aL) * 0.5);
|
||||
anExtr.Perform(aP);
|
||||
|
||||
if (!anExtr.IsDone() || !anExtr.NbExt())
|
||||
continue;
|
||||
|
||||
@@ -136,15 +136,23 @@ static void ChFi3d_CoupeParPlan(const ChFiDS_CommonPoint& compoint1,
|
||||
occ::handle<Geom2d_Curve> C2dint2;
|
||||
NCollection_Array1<double> Pdeb(1, 4), Pfin(1, 4);
|
||||
GeomAdaptor_Surface AS(Plan);
|
||||
Extrema_ExtPS ext(P1, AS, 1.e-3, 1.e-3);
|
||||
Extrema_ExtPS ext1(P2, AS, 1.e-3, 1.e-3);
|
||||
Extrema_ExtPS anExtPS(P1,
|
||||
AS,
|
||||
AS.FirstUParameter(),
|
||||
AS.LastUParameter(),
|
||||
AS.FirstVParameter(),
|
||||
AS.LastVParameter(),
|
||||
1.e-3,
|
||||
1.e-3,
|
||||
Extrema_ExtFlag_MIN);
|
||||
double u1, v1;
|
||||
ext.Point(1).Parameter(u1, v1);
|
||||
anExtPS.Point(1).Parameter(u1, v1);
|
||||
Pdeb(1) = UV1.X();
|
||||
Pdeb(2) = UV1.Y();
|
||||
Pdeb(3) = u1;
|
||||
Pdeb(4) = v1;
|
||||
ext1.Point(1).Parameter(u1, v1);
|
||||
anExtPS.Perform(P2);
|
||||
anExtPS.Point(1).Parameter(u1, v1);
|
||||
Pfin(1) = UV2.X();
|
||||
Pfin(2) = UV2.Y();
|
||||
Pfin(3) = u1;
|
||||
|
||||
@@ -2437,7 +2437,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const int Index)
|
||||
{
|
||||
GeomAdaptor_Surface Asurf;
|
||||
Asurf.Load(Sfacemoins1);
|
||||
Extrema_ExtPS ext(CV1.Point(), Asurf, tol, tol);
|
||||
Extrema_ExtPS ext(CV1.Point(), Asurf, tol, tol, Extrema_ExtFlag_MIN);
|
||||
double uc1, vc1;
|
||||
if (ext.IsDone())
|
||||
{
|
||||
@@ -2661,7 +2661,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const int Index)
|
||||
BRE.MakeFace(faceprol[nb - 1], Sfacemoins1, F.Location(), tol);
|
||||
GeomAdaptor_Surface Asurf;
|
||||
Asurf.Load(Sfacemoins1);
|
||||
Extrema_ExtPS ext(CV2.Point(), Asurf, tol, tol);
|
||||
Extrema_ExtPS ext(CV2.Point(), Asurf, tol, tol, Extrema_ExtFlag_MIN);
|
||||
double uc2, vc2;
|
||||
if (ext.IsDone())
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Precision.hxx>
|
||||
@@ -119,23 +118,16 @@ void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
|
||||
{
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:37:55 2002 f
|
||||
// GeomAdaptor_Surface TheSurface (Surface);
|
||||
// myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance);
|
||||
|
||||
// modified by NIZNHY-PKV Mon Apr 8 11:13:37 2002 f XXX
|
||||
double Umin, Usup, Vmin, Vsup;
|
||||
Surface->Bounds(Umin, Usup, Vmin, Vsup);
|
||||
myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup);
|
||||
//
|
||||
// myExtPS = Extrema_ExtPS();
|
||||
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
// XXXmyExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance);
|
||||
// modified by NIZNHY-PKV Mon Apr 8 11:13:44 2002 t XXX
|
||||
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:37:58 2002 t
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -150,16 +142,13 @@ void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
constexpr double Tolerance = Precision::PConfusion();
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:38:23 2002 f
|
||||
// GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
// myExtPS = Extrema_ExtPS (P, TheSurface, Tol, Tol);
|
||||
|
||||
myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup);
|
||||
// myExtPS = Extrema_ExtPS();
|
||||
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
// XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tol, Tol);
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:38:30 2002 t
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -174,16 +163,12 @@ void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P,
|
||||
const double Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:39:10 2002 f
|
||||
// GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
// myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance);
|
||||
myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup);
|
||||
// myExtPS = Extrema_ExtPS();
|
||||
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
// XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance);
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:39:14 2002 t
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -197,16 +182,12 @@ void GeomAPI_ProjectPointOnSurf::Init(const occ::handle<Geom_Surface>& Surface,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
constexpr double Tolerance = Precision::PConfusion();
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:41:50 2002 f
|
||||
// GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
|
||||
myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup);
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:42:29 2002 t
|
||||
// myExtPS = Extrema_ExtPS();
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:42:32 2002 f
|
||||
// myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tol, Tol);
|
||||
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:42:39 2002 t
|
||||
|
||||
myIsDone = false;
|
||||
}
|
||||
|
||||
@@ -220,16 +201,11 @@ void GeomAPI_ProjectPointOnSurf::Init(const occ::handle<Geom_Surface>& Surface,
|
||||
const double Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:43:00 2002 f
|
||||
// GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
|
||||
myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup);
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:43:16 2002 t
|
||||
// myExtPS = Extrema_ExtPS();
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:43:18 2002 f
|
||||
// myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
// modified by NIZNHY-PKV Thu Apr 4 10:43:26 2002 t
|
||||
myIsDone = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <Adaptor3d_TopolTool.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <Approx_CurveOnSurface.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <Extrema_POnSurf.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
|
||||
@@ -286,43 +286,58 @@ static void FUN_TrimInfSurf(const gp_Pnt& Pmin,
|
||||
occ::handle<Adaptor3d_Surface>& TrimS)
|
||||
{
|
||||
double TP = AlternativeTrimPrm;
|
||||
Extrema_ExtPS ext1(Pmin, *InfSurf, 1.e-7, 1.e-7);
|
||||
Extrema_ExtPS ext2(Pmax, *InfSurf, 1.e-7, 1.e-7);
|
||||
if (ext1.IsDone() || ext2.IsDone())
|
||||
Extrema_ExtPS anExtPS;
|
||||
anExtPS.Initialize(*InfSurf,
|
||||
InfSurf->FirstUParameter(),
|
||||
InfSurf->LastUParameter(),
|
||||
InfSurf->FirstVParameter(),
|
||||
InfSurf->LastVParameter(),
|
||||
1.e-7,
|
||||
1.e-7);
|
||||
|
||||
// Process Pmin
|
||||
anExtPS.Perform(Pmin);
|
||||
const bool isDone1 = anExtPS.IsDone();
|
||||
double Umax = -1.e+100, Umin = 1.e+100, Vmax = -1.e+100, Vmin = 1.e+100, cU, cV;
|
||||
if (isDone1)
|
||||
{
|
||||
double Umax = -1.e+100, Umin = 1.e+100, Vmax = -1.e+100, Vmin = 1.e+100, cU, cV;
|
||||
if (ext1.IsDone())
|
||||
for (int i = 1; i <= anExtPS.NbExt(); i++)
|
||||
{
|
||||
for (int i = 1; i <= ext1.NbExt(); i++)
|
||||
{
|
||||
const Extrema_POnSurf& pons = ext1.Point(i);
|
||||
pons.Parameter(cU, cV);
|
||||
if (cU > Umax)
|
||||
Umax = cU;
|
||||
if (cU < Umin)
|
||||
Umin = cU;
|
||||
if (cV > Vmax)
|
||||
Vmax = cV;
|
||||
if (cV < Vmin)
|
||||
Vmin = cV;
|
||||
}
|
||||
const Extrema_POnSurf& pons = anExtPS.Point(i);
|
||||
pons.Parameter(cU, cV);
|
||||
if (cU > Umax)
|
||||
Umax = cU;
|
||||
if (cU < Umin)
|
||||
Umin = cU;
|
||||
if (cV > Vmax)
|
||||
Vmax = cV;
|
||||
if (cV < Vmin)
|
||||
Vmin = cV;
|
||||
}
|
||||
if (ext2.IsDone())
|
||||
}
|
||||
|
||||
// Process Pmax
|
||||
anExtPS.Perform(Pmax);
|
||||
const bool isDone2 = anExtPS.IsDone();
|
||||
if (isDone2)
|
||||
{
|
||||
for (int i = 1; i <= anExtPS.NbExt(); i++)
|
||||
{
|
||||
for (int i = 1; i <= ext2.NbExt(); i++)
|
||||
{
|
||||
const Extrema_POnSurf& pons = ext2.Point(i);
|
||||
pons.Parameter(cU, cV);
|
||||
if (cU > Umax)
|
||||
Umax = cU;
|
||||
if (cU < Umin)
|
||||
Umin = cU;
|
||||
if (cV > Vmax)
|
||||
Vmax = cV;
|
||||
if (cV < Vmin)
|
||||
Vmin = cV;
|
||||
}
|
||||
const Extrema_POnSurf& pons = anExtPS.Point(i);
|
||||
pons.Parameter(cU, cV);
|
||||
if (cU > Umax)
|
||||
Umax = cU;
|
||||
if (cU < Umin)
|
||||
Umin = cU;
|
||||
if (cV > Vmax)
|
||||
Vmax = cV;
|
||||
if (cV < Vmin)
|
||||
Vmin = cV;
|
||||
}
|
||||
}
|
||||
|
||||
if (isDone1 || isDone2)
|
||||
{
|
||||
TP =
|
||||
std::max(std::abs(Umin), std::max(std::abs(Umax), std::max(std::abs(Vmin), std::abs(Vmax))));
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ static void BuildDomains(TopoDS_Face& myFace,
|
||||
TopoDS_Vertex V = TopoDS::Vertex(exp.Current());
|
||||
gp_Pnt2d PV;
|
||||
gp_Pnt P3d = BRep_Tool::Pnt(V);
|
||||
Extrema_ExtPS ExtPS(P3d, S, Tol, Tol);
|
||||
Extrema_ExtPS ExtPS(P3d, S, Tol, Tol, Extrema_ExtFlag_MIN);
|
||||
double Dist2Min = Precision::Infinite();
|
||||
double Found = false;
|
||||
for (int ie = 1; ie <= ExtPS.NbExt(); ie++)
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
@@ -382,7 +382,11 @@ void BRepClass3d_SClassifier::Perform(BRepClass3d_SolidExplorer& SolidExplorer,
|
||||
{
|
||||
// Check distance between surface and point
|
||||
BRepAdaptor_Surface aBAS(f, false);
|
||||
Extrema_ExtPS aProj(P, aBAS, Precision::PConfusion(), Precision::PConfusion());
|
||||
Extrema_ExtPS aProj(P,
|
||||
aBAS,
|
||||
Precision::PConfusion(),
|
||||
Precision::PConfusion(),
|
||||
Extrema_ExtFlag_MIN);
|
||||
if (aProj.IsDone() && aProj.NbExt() > 0)
|
||||
{
|
||||
int i, indmin = 0;
|
||||
|
||||
@@ -538,7 +538,7 @@ int BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, gp_Lin& L, double&
|
||||
_v = (V1 + V2) * 0.5;
|
||||
|
||||
GeomAdaptor_Surface GA(BRep_Tool::Surface(face));
|
||||
Extrema_ExtPS Ext(P, GA, TolU, TolV);
|
||||
Extrema_ExtPS Ext(P, GA, TolU, TolV, Extrema_ExtFlag_MIN);
|
||||
//
|
||||
if (Ext.IsDone() && Ext.NbExt() > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user