1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0024896: BRepExtrema is giving wrong intersection point between curve and planar face

Added test case bugs/moddata_3/bug24896. Modified unstable test cases and increased cpu limit in bugs/modalg_5/bug24190.
This commit is contained in:
ifv 2014-05-15 17:53:58 +04:00 committed by apn
parent 004e846676
commit 29d778bf16
7 changed files with 318 additions and 205 deletions

@ -45,27 +45,27 @@ Extrema_ExtCS::Extrema_ExtCS()
} }
Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve& C, Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve& C,
const Adaptor3d_Surface& S, const Adaptor3d_Surface& S,
const Standard_Real TolC, const Standard_Real TolC,
const Standard_Real TolS) const Standard_Real TolS)
{ {
Initialize(S, S.FirstUParameter(), S.LastUParameter(), Initialize(S, S.FirstUParameter(), S.LastUParameter(),
S.FirstVParameter(), S.LastVParameter(), S.FirstVParameter(), S.LastVParameter(),
TolC, TolS); TolC, TolS);
Perform(C, C.FirstParameter(), C.LastParameter()); Perform(C, C.FirstParameter(), C.LastParameter());
} }
Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve& C, Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve& C,
const Adaptor3d_Surface& S, const Adaptor3d_Surface& S,
const Standard_Real UCinf, const Standard_Real UCinf,
const Standard_Real UCsup, const Standard_Real UCsup,
const Standard_Real Uinf, const Standard_Real Uinf,
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vinf, const Standard_Real Vinf,
const Standard_Real Vsup, const Standard_Real Vsup,
const Standard_Real TolC, const Standard_Real TolC,
const Standard_Real TolS) const Standard_Real TolS)
{ {
Initialize(S, Uinf, Usup, Vinf, Vsup, TolC, TolS); Initialize(S, Uinf, Usup, Vinf, Vsup, TolC, TolS);
@ -74,12 +74,12 @@ Extrema_ExtCS::Extrema_ExtCS(const Adaptor3d_Curve& C,
void Extrema_ExtCS::Initialize(const Adaptor3d_Surface& S, void Extrema_ExtCS::Initialize(const Adaptor3d_Surface& S,
const Standard_Real Uinf, const Standard_Real Uinf,
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vinf, const Standard_Real Vinf,
const Standard_Real Vsup, const Standard_Real Vsup,
const Standard_Real TolC, const Standard_Real TolC,
const Standard_Real TolS) const Standard_Real TolS)
{ {
myS = (Adaptor3d_SurfacePtr)&S; myS = (Adaptor3d_SurfacePtr)&S;
myIsPar = Standard_False; myIsPar = Standard_False;
@ -94,8 +94,8 @@ void Extrema_ExtCS::Initialize(const Adaptor3d_Surface& S,
void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C, void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
const Standard_Real Uinf, const Standard_Real Uinf,
const Standard_Real Usup) const Standard_Real Usup)
{ {
myucinf = Uinf; myucinf = Uinf;
myucsup = Usup; myucsup = Usup;
@ -115,14 +115,14 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
switch(myStype) { switch(myStype) {
case GeomAbs_Sphere: case GeomAbs_Sphere:
myExtElCS.Perform(C.Line(), myS->Sphere()); myExtElCS.Perform(C.Line(), myS->Sphere());
break; break;
case GeomAbs_Cylinder: case GeomAbs_Cylinder:
myExtElCS.Perform(C.Line(), myS->Cylinder()); myExtElCS.Perform(C.Line(), myS->Cylinder());
break; break;
case GeomAbs_Plane: case GeomAbs_Plane:
myExtElCS.Perform(C.Line(), myS->Plane()); myExtElCS.Perform(C.Line(), myS->Plane());
if (myExtElCS.IsParallel()) break; if (myExtElCS.IsParallel()) break;
case GeomAbs_Torus: case GeomAbs_Torus:
case GeomAbs_Cone: case GeomAbs_Cone:
@ -132,99 +132,99 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
case GeomAbs_SurfaceOfExtrusion: case GeomAbs_SurfaceOfExtrusion:
case GeomAbs_OffsetSurface: case GeomAbs_OffsetSurface:
case GeomAbs_OtherSurface: case GeomAbs_OtherSurface:
{ {
Standard_Real cfirst = myucinf, clast = myucsup; Standard_Real cfirst = myucinf, clast = myucsup;
Standard_Real ufirst = myS->FirstUParameter(), ulast = myS->LastUParameter(), Standard_Real ufirst = myS->FirstUParameter(), ulast = myS->LastUParameter(),
vfirst = myS->FirstVParameter(), vlast = myS->LastVParameter(); vfirst = myS->FirstVParameter(), vlast = myS->LastVParameter();
if(Precision::IsInfinite(Abs(cfirst)) || Precision::IsInfinite(Abs(clast))) { if(Precision::IsInfinite(Abs(cfirst)) || Precision::IsInfinite(Abs(clast))) {
Bnd_Box aSurfBox; Bnd_Box aSurfBox;
BndLib_AddSurface::Add(*myS, ufirst, ulast, vfirst, vlast, Precision::Confusion(), aSurfBox); BndLib_AddSurface::Add(*myS, ufirst, ulast, vfirst, vlast, Precision::Confusion(), aSurfBox);
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax; Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
aSurfBox.Get(xmin, ymin, zmin, xmax, ymax, zmax); aSurfBox.Get(xmin, ymin, zmin, xmax, ymax, zmax);
Standard_Real tmin = Precision::Infinite(), tmax = -tmin; Standard_Real tmin = Precision::Infinite(), tmax = -tmin;
gp_Lin aLin = C.Line(); gp_Lin aLin = C.Line();
if(!( Precision::IsInfinite(Abs(xmin)) || Precision::IsInfinite(Abs(xmax)) || if(!( Precision::IsInfinite(Abs(xmin)) || Precision::IsInfinite(Abs(xmax)) ||
Precision::IsInfinite(Abs(ymin)) || Precision::IsInfinite(Abs(ymax)) || Precision::IsInfinite(Abs(ymin)) || Precision::IsInfinite(Abs(ymax)) ||
Precision::IsInfinite(Abs(zmin)) || Precision::IsInfinite(Abs(zmax))) ) { Precision::IsInfinite(Abs(zmin)) || Precision::IsInfinite(Abs(zmax))) ) {
Extrema_ExtPElC anExt; Extrema_ExtPElC anExt;
Extrema_POnCurv aPntOnLin; Extrema_POnCurv aPntOnLin;
Standard_Real aParOnLin; Standard_Real aParOnLin;
Standard_Real lim = Precision::Infinite(); Standard_Real lim = Precision::Infinite();
gp_Pnt aLimPntArray[8]; gp_Pnt aLimPntArray[8];
aLimPntArray[0].SetCoord(xmin, ymin, zmin); aLimPntArray[0].SetCoord(xmin, ymin, zmin);
aLimPntArray[1].SetCoord(xmax, ymin, zmin); aLimPntArray[1].SetCoord(xmax, ymin, zmin);
aLimPntArray[2].SetCoord(xmin, ymax, zmin); aLimPntArray[2].SetCoord(xmin, ymax, zmin);
aLimPntArray[3].SetCoord(xmax, ymax, zmin); aLimPntArray[3].SetCoord(xmax, ymax, zmin);
aLimPntArray[4].SetCoord(xmin, ymin, zmax); aLimPntArray[4].SetCoord(xmin, ymin, zmax);
aLimPntArray[5].SetCoord(xmax, ymin, zmax); aLimPntArray[5].SetCoord(xmax, ymin, zmax);
aLimPntArray[6].SetCoord(xmin, ymax, zmax); aLimPntArray[6].SetCoord(xmin, ymax, zmax);
aLimPntArray[7].SetCoord(xmax, ymax, zmax); aLimPntArray[7].SetCoord(xmax, ymax, zmax);
for(i = 0; i <= 7; i++) { for(i = 0; i <= 7; i++) {
anExt.Perform(aLimPntArray[i], aLin, Precision::Confusion(), -lim, lim); anExt.Perform(aLimPntArray[i], aLin, Precision::Confusion(), -lim, lim);
aPntOnLin = anExt.Point(1); aPntOnLin = anExt.Point(1);
aParOnLin = aPntOnLin.Parameter(); aParOnLin = aPntOnLin.Parameter();
tmin = Min(aParOnLin, tmin); tmin = Min(aParOnLin, tmin);
tmax = Max(aParOnLin, tmax); tmax = Max(aParOnLin, tmax);
} }
} }
else { else {
tmin = -1.e+50; tmin = -1.e+50;
tmax = 1.e+50; tmax = 1.e+50;
} }
cfirst = Max(cfirst, tmin); cfirst = Max(cfirst, tmin);
clast = Min(clast, tmax); clast = Min(clast, tmax);
} }
Extrema_GenExtCS Ext(C, *myS, NbT, NbU, NbV, cfirst, clast, ufirst, ulast, Extrema_GenExtCS Ext(C, *myS, NbT, NbU, NbV, cfirst, clast, ufirst, ulast,
vfirst, vlast, mytolC, mytolS); vfirst, vlast, mytolC, mytolS);
myDone = Ext.IsDone(); myDone = Ext.IsDone();
if (myDone) { if (myDone) {
Standard_Integer NbExt = Ext.NbExt(); Standard_Integer NbExt = Ext.NbExt();
Standard_Real T,U,V; Standard_Real T,U,V;
Extrema_POnCurv PC; Extrema_POnCurv PC;
Extrema_POnSurf PS; Extrema_POnSurf PS;
for (i = 1; i <= NbExt; i++) { for (i = 1; i <= NbExt; i++) {
PC = Ext.PointOnCurve(i); PC = Ext.PointOnCurve(i);
PS = Ext.PointOnSurface(i); PS = Ext.PointOnSurface(i);
T = PC.Parameter(); T = PC.Parameter();
PS.Parameter(U, V); PS.Parameter(U, V);
AddSolution(C, T, U, V, PC.Value(), PS.Value(), Ext.SquareDistance(i)); AddSolution(C, T, U, V, PC.Value(), PS.Value(), Ext.SquareDistance(i));
} }
} }
return; return;
} }
} }
break; break;
} }
// Modified by skv - Thu Jul 7 12:29:34 2005 OCC9134 Begin // Modified by skv - Thu Jul 7 12:29:34 2005 OCC9134 Begin
case GeomAbs_Circle: case GeomAbs_Circle:
{ {
if(myStype == GeomAbs_Cylinder) { if(myStype == GeomAbs_Cylinder) {
myExtElCS.Perform(C.Circle(), myS->Cylinder()); myExtElCS.Perform(C.Circle(), myS->Cylinder());
break; break;
} }
} }
case GeomAbs_Hyperbola: case GeomAbs_Hyperbola:
{ {
if(myCtype == GeomAbs_Hyperbola && myStype == GeomAbs_Plane) { if(myCtype == GeomAbs_Hyperbola && myStype == GeomAbs_Plane) {
// Modified by skv - Thu Jul 7 12:29:34 2005 OCC9134 End // Modified by skv - Thu Jul 7 12:29:34 2005 OCC9134 End
myExtElCS.Perform(C.Hyperbola(), myS->Plane()); myExtElCS.Perform(C.Hyperbola(), myS->Plane());
break; break;
} }
} }
default: default:
@ -232,30 +232,30 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
Extrema_GenExtCS Ext; Extrema_GenExtCS Ext;
Ext.Initialize(*myS, NbU, NbV, mytolS); Ext.Initialize(*myS, NbU, NbV, mytolS);
if(myCtype == GeomAbs_Hyperbola) { if(myCtype == GeomAbs_Hyperbola) {
Standard_Real tmin = Max(-20., C.FirstParameter()); Standard_Real tmin = Max(-20., C.FirstParameter());
Standard_Real tmax = Min(20., C.LastParameter()); Standard_Real tmax = Min(20., C.LastParameter());
Ext.Perform(C, NbT, tmin, tmax, mytolC); // to avoid overflow Ext.Perform(C, NbT, tmin, tmax, mytolC); // to avoid overflow
} }
else { else {
if(myCtype == GeomAbs_Circle && NbT < 13) { if(myCtype == GeomAbs_Circle && NbT < 13) {
NbT = 13; NbT = 13;
} }
Ext.Perform(C, NbT, mytolC); Ext.Perform(C, NbT, mytolC);
} }
myDone = Ext.IsDone(); myDone = Ext.IsDone();
if (myDone) { if (myDone) {
Standard_Integer NbExt = Ext.NbExt(); Standard_Integer NbExt = Ext.NbExt();
Standard_Real T,U,V; Standard_Real T,U,V;
Extrema_POnCurv PC; Extrema_POnCurv PC;
Extrema_POnSurf PS; Extrema_POnSurf PS;
for (i = 1; i <= NbExt; i++) { for (i = 1; i <= NbExt; i++) {
PC = Ext.PointOnCurve(i); PC = Ext.PointOnCurve(i);
PS = Ext.PointOnSurface(i); PS = Ext.PointOnSurface(i);
T = PC.Parameter(); T = PC.Parameter();
PS.Parameter(U, V); PS.Parameter(U, V);
AddSolution(C, T, U, V, PC.Value(), PS.Value(), Ext.SquareDistance(i)); AddSolution(C, T, U, V, PC.Value(), PS.Value(), Ext.SquareDistance(i));
} }
//Add sharp points //Add sharp points
Standard_Integer SolNumber = mySqDist.Length(); Standard_Integer SolNumber = mySqDist.Length();
@ -286,7 +286,7 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
{ {
ProjPS.Point(jmin).Parameter(U,V); ProjPS.Point(jmin).Parameter(U,V);
AddSolution(C, T, U, V, AddSolution(C, T, U, V,
aPnt, ProjPS.Point(jmin).Value(), MinSqDist); aPnt, ProjPS.Point(jmin).Value(), MinSqDist);
} }
} }
//Cut sharp solutions to keep only minimum and maximum //Cut sharp solutions to keep only minimum and maximum
@ -334,11 +334,11 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
Standard_Integer NbExt = myExtElCS.NbExt(); Standard_Integer NbExt = myExtElCS.NbExt();
Standard_Real U, V; Standard_Real U, V;
for (i = 1; i <= NbExt; i++) { for (i = 1; i <= NbExt; i++) {
Extrema_POnCurv PC; Extrema_POnCurv PC;
Extrema_POnSurf PS; Extrema_POnSurf PS;
myExtElCS.Points(i, PC, PS); myExtElCS.Points(i, PC, PS);
Standard_Real Ucurve = PC.Parameter(); Standard_Real Ucurve = PC.Parameter();
PS.Parameter(U, V); PS.Parameter(U, V);
AddSolution(C, Ucurve, U, V, PC.Value(), PS.Value(), myExtElCS.SquareDistance(i)); AddSolution(C, Ucurve, U, V, PC.Value(), PS.Value(), myExtElCS.SquareDistance(i));
} }
} }
@ -376,8 +376,8 @@ Standard_Integer Extrema_ExtCS::NbExt() const
void Extrema_ExtCS::Points(const Standard_Integer N, void Extrema_ExtCS::Points(const Standard_Integer N,
Extrema_POnCurv& P1, Extrema_POnCurv& P1,
Extrema_POnSurf& P2) const Extrema_POnSurf& P2) const
{ {
if(!myDone) StdFail_NotDone::Raise(); if(!myDone) StdFail_NotDone::Raise();
P1 = myPOnC.Value(N); P1 = myPOnC.Value(N);
@ -385,12 +385,12 @@ void Extrema_ExtCS::Points(const Standard_Integer N,
} }
Standard_Boolean Extrema_ExtCS::AddSolution(const Adaptor3d_Curve& theCurve, Standard_Boolean Extrema_ExtCS::AddSolution(const Adaptor3d_Curve& theCurve,
const Standard_Real aT, const Standard_Real aT,
const Standard_Real aU, const Standard_Real aU,
const Standard_Real aV, const Standard_Real aV,
const gp_Pnt& PointOnCurve, const gp_Pnt& PointOnCurve,
const gp_Pnt& PointOnSurf, const gp_Pnt& PointOnSurf,
const Standard_Real SquareDist) const Standard_Real SquareDist)
{ {
Standard_Boolean Added = Standard_False; Standard_Boolean Added = Standard_False;
@ -406,8 +406,8 @@ Standard_Boolean Extrema_ExtCS::AddSolution(const Adaptor3d_Curve& theCurve,
Extrema_POnCurv aPC; Extrema_POnCurv aPC;
Extrema_POnSurf aPS; Extrema_POnSurf aPS;
if ((myucinf-T) <= mytolC && (T-myucsup) <= mytolC && if ((myucinf-T) <= mytolC && (T-myucsup) <= mytolC &&
(myuinf-U) <= mytolS && (U-myusup) <= mytolS && (myuinf-U) <= mytolS && (U-myusup) <= mytolS &&
(myvinf-V) <= mytolS && (V-myvsup) <= mytolS) (myvinf-V) <= mytolS && (V-myvsup) <= mytolS)
{ {
Standard_Boolean IsNewSolution = Standard_True; Standard_Boolean IsNewSolution = Standard_True;
for (Standard_Integer j = 1; j <= mySqDist.Length(); j++) for (Standard_Integer j = 1; j <= mySqDist.Length(); j++)
@ -418,8 +418,8 @@ Standard_Boolean Extrema_ExtCS::AddSolution(const Adaptor3d_Curve& theCurve,
Standard_Real Uj, Vj; Standard_Real Uj, Vj;
aPS.Parameter(Uj, Vj); aPS.Parameter(Uj, Vj);
if (Abs(T - Tj) <= mytolC && if (Abs(T - Tj) <= mytolC &&
Abs(U - Uj) <= mytolS && Abs(U - Uj) <= mytolS &&
Abs(V - Vj) <= mytolS) Abs(V - Vj) <= mytolS)
{ {
IsNewSolution = Standard_False; IsNewSolution = Standard_False;
break; break;

@ -44,13 +44,13 @@ Extrema_GenExtCS::Extrema_GenExtCS()
//purpose : //purpose :
//======================================================================= //=======================================================================
Extrema_GenExtCS::Extrema_GenExtCS(const Adaptor3d_Curve& C, Extrema_GenExtCS::Extrema_GenExtCS(const Adaptor3d_Curve& C,
const Adaptor3d_Surface& S, const Adaptor3d_Surface& S,
const Standard_Integer NbT, const Standard_Integer NbT,
const Standard_Integer NbU, const Standard_Integer NbU,
const Standard_Integer NbV, const Standard_Integer NbV,
const Standard_Real Tol1, const Standard_Real Tol1,
const Standard_Real Tol2) const Standard_Real Tol2)
{ {
Initialize(S, NbU, NbV, Tol2); Initialize(S, NbU, NbV, Tol2);
Perform(C, NbT, Tol1); Perform(C, NbT, Tol1);
@ -61,19 +61,19 @@ Extrema_GenExtCS::Extrema_GenExtCS()
//purpose : //purpose :
//======================================================================= //=======================================================================
Extrema_GenExtCS::Extrema_GenExtCS(const Adaptor3d_Curve& C, Extrema_GenExtCS::Extrema_GenExtCS(const Adaptor3d_Curve& C,
const Adaptor3d_Surface& S, const Adaptor3d_Surface& S,
const Standard_Integer NbT, const Standard_Integer NbT,
const Standard_Integer NbU, const Standard_Integer NbU,
const Standard_Integer NbV, const Standard_Integer NbV,
const Standard_Real tmin, const Standard_Real tmin,
const Standard_Real tsup, const Standard_Real tsup,
const Standard_Real Umin, const Standard_Real Umin,
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vmin, const Standard_Real Vmin,
const Standard_Real Vsup, const Standard_Real Vsup,
const Standard_Real Tol1, const Standard_Real Tol1,
const Standard_Real Tol2) const Standard_Real Tol2)
{ {
Initialize(S, NbU, NbV, Umin,Usup,Vmin,Vsup,Tol2); Initialize(S, NbU, NbV, Umin,Usup,Vmin,Vsup,Tol2);
Perform(C, NbT, tmin, tsup, Tol1); Perform(C, NbT, tmin, tsup, Tol1);
@ -85,9 +85,9 @@ Extrema_GenExtCS::Extrema_GenExtCS()
//======================================================================= //=======================================================================
void Extrema_GenExtCS::Initialize(const Adaptor3d_Surface& S, void Extrema_GenExtCS::Initialize(const Adaptor3d_Surface& S,
const Standard_Integer NbU, const Standard_Integer NbU,
const Standard_Integer NbV, const Standard_Integer NbV,
const Standard_Real Tol2) const Standard_Real Tol2)
{ {
myumin = S.FirstUParameter(); myumin = S.FirstUParameter();
myusup = S.LastUParameter(); myusup = S.LastUParameter();
@ -102,13 +102,13 @@ void Extrema_GenExtCS::Initialize(const Adaptor3d_Surface& S,
//======================================================================= //=======================================================================
void Extrema_GenExtCS::Initialize(const Adaptor3d_Surface& S, void Extrema_GenExtCS::Initialize(const Adaptor3d_Surface& S,
const Standard_Integer NbU, const Standard_Integer NbU,
const Standard_Integer NbV, const Standard_Integer NbV,
const Standard_Real Umin, const Standard_Real Umin,
const Standard_Real Usup, const Standard_Real Usup,
const Standard_Real Vmin, const Standard_Real Vmin,
const Standard_Real Vsup, const Standard_Real Vsup,
const Standard_Real Tol2) const Standard_Real Tol2)
{ {
myS = (Adaptor3d_SurfacePtr)&S; myS = (Adaptor3d_SurfacePtr)&S;
myusample = NbU; myusample = NbU;
@ -126,8 +126,8 @@ void Extrema_GenExtCS::Initialize(const Adaptor3d_Surface& S,
//======================================================================= //=======================================================================
void Extrema_GenExtCS::Perform(const Adaptor3d_Curve& C, void Extrema_GenExtCS::Perform(const Adaptor3d_Curve& C,
const Standard_Integer NbT, const Standard_Integer NbT,
const Standard_Real Tol1) const Standard_Real Tol1)
{ {
mytmin = C.FirstParameter(); mytmin = C.FirstParameter();
mytsup = C.LastParameter(); mytsup = C.LastParameter();
@ -140,10 +140,10 @@ void Extrema_GenExtCS::Perform(const Adaptor3d_Curve& C,
//======================================================================= //=======================================================================
void Extrema_GenExtCS::Perform(const Adaptor3d_Curve& C, void Extrema_GenExtCS::Perform(const Adaptor3d_Curve& C,
const Standard_Integer NbT, const Standard_Integer NbT,
const Standard_Real tmin, const Standard_Real tmin,
const Standard_Real tsup, const Standard_Real tsup,
const Standard_Real Tol1) const Standard_Real Tol1)
{ {
myDone = Standard_False; myDone = Standard_False;
myF.Initialize(C,*myS); myF.Initialize(C,*myS);
@ -189,7 +189,7 @@ void Extrema_GenExtCS::Perform(const Adaptor3d_Curve& C,
Standard_Real dfUFirst = aCurve->FirstParameter(); Standard_Real dfUFirst = aCurve->FirstParameter();
// Create iso line of U=U0 // Create iso line of U=U0
GeomAdaptor_Curve anAx(new Geom_Line(aCurve->Value(dfUFirst), aDir), GeomAdaptor_Curve anAx(new Geom_Line(aCurve->Value(dfUFirst), aDir),
trimvmin, trimvsup); trimvmin, trimvsup);
Extrema_ExtCC aLocator(C, anAx); Extrema_ExtCC aLocator(C, anAx);
if (aLocator.IsDone() && aLocator.NbExt()>0) if (aLocator.IsDone() && aLocator.NbExt()>0)
{ {
@ -198,28 +198,28 @@ void Extrema_GenExtCS::Perform(const Adaptor3d_Curve& C,
Extrema_POnCurv aP1, aP2; Extrema_POnCurv aP1, aP2;
for (iExt=1; iExt<=aLocator.NbExt(); iExt++) for (iExt=1; iExt<=aLocator.NbExt(); iExt++)
{ {
aLocator.Points (iExt, aP1, aP2); aLocator.Points (iExt, aP1, aP2);
// Parameter on curve // Parameter on curve
UV(1) = aP1.Parameter(); UV(1) = aP1.Parameter();
// To find parameters on surf, try ExtPS // To find parameters on surf, try ExtPS
Extrema_ExtPS aPreciser (aP1.Value(), *myS, mytol2, mytol2); Extrema_ExtPS aPreciser (aP1.Value(), *myS, mytol2, mytol2);
if (aPreciser.IsDone()) if (aPreciser.IsDone())
{ {
// Managed to find extremas between point and surface // Managed to find extremas between point and surface
Standard_Integer iPExt; Standard_Integer iPExt;
for (iPExt=1; iPExt<=aPreciser.NbExt(); iPExt++) for (iPExt=1; iPExt<=aPreciser.NbExt(); iPExt++)
{ {
aPreciser.Point(iPExt).Parameter(UV(2),UV(3)); aPreciser.Point(iPExt).Parameter(UV(2),UV(3));
math_FunctionSetRoot S1 (myF,UV,Tol,UVinf,UVsup); math_FunctionSetRoot S1 (myF,UV,Tol,UVinf,UVsup);
} }
} }
else else
{ {
// Failed... try the point on iso line // Failed... try the point on iso line
UV(2) = dfUFirst; UV(2) = dfUFirst;
UV(3) = aP2.Parameter(); UV(3) = aP2.Parameter();
math_FunctionSetRoot S1 (myF,UV,Tol,UVinf,UVsup); math_FunctionSetRoot S1 (myF,UV,Tol,UVinf,UVsup);
} }
} // for (iExt=1; iExt<=aLocator.NbExt(); iExt++) } // for (iExt=1; iExt<=aLocator.NbExt(); iExt++)
} // if (aLocator.IsDone() && aLocator.NbExt()>0) } // if (aLocator.IsDone() && aLocator.NbExt()>0)
} // if (myS.Type() == GeomAbs_ExtrusionSurface) } // if (myS.Type() == GeomAbs_ExtrusionSurface)
@ -228,10 +228,63 @@ void Extrema_GenExtCS::Perform(const Adaptor3d_Curve& C,
Standard_Real aCUAdd = (mytsup - mytmin) / mytsample; Standard_Real aCUAdd = (mytsup - mytmin) / mytsample;
Standard_Real aSUAdd = (myusup - myumin) / myusample; Standard_Real aSUAdd = (myusup - myumin) / myusample;
Standard_Real aSVAdd = (myvsup - myvmin) / myvsample; Standard_Real aSVAdd = (myvsup - myvmin) / myvsample;
Standard_Real tres = C.Resolution(1.);
Standard_Real ures = myS->UResolution(1.);
Standard_Real vres = myS->VResolution(1.);
tres = aCUAdd / tres;
ures = aSUAdd / ures;
vres = aSVAdd / vres;
Standard_Real minres = Min(tres, Min(ures, vres));
Standard_Real factor = 5.;
Standard_Integer maxnbs = 50;
minres *= factor;
if(minres > Epsilon(1.))
{
if(tres > minres)
{
Standard_Real rsample = mytsample * tres / minres;
if(rsample > maxnbs)
{
mytsample = maxnbs;
}
else
{
mytsample = RealToInt(rsample);
}
aCUAdd = (mytsup - mytmin) / mytsample;
}
if(ures > minres)
{
Standard_Real rsample = myusample * ures / minres;
if(rsample > maxnbs)
{
myusample = maxnbs;
}
else
{
myusample = RealToInt(rsample);
}
aSUAdd = (myusup - myumin) / myusample;
}
if(vres > minres)
{
Standard_Real rsample = myvsample * vres / minres;
if(rsample > maxnbs)
{
myvsample = maxnbs;
}
else
{
myvsample = RealToInt(rsample);
}
aSVAdd = (myvsup - myvmin) / myvsample;
}
}
TColgp_HArray1OfPnt aCPs(1, mytsample); TColgp_HArray1OfPnt aCPs(1, mytsample);
TColgp_HArray2OfPnt aSPs(1, myusample, 1, myvsample); TColgp_HArray2OfPnt aSPs(1, myusample, 1, myvsample);
Standard_Integer aRestIterCount = 3; Standard_Integer aRestIterCount = 3;
// The value is calculated by the bug CR23830. // The value is calculated by the bug CR23830.
Standard_Integer aCUDen = 2, aSUDen = 2, aSVDen = 2; Standard_Integer aCUDen = 2, aSUDen = 2, aSVDen = 2;
Standard_Boolean anAreAvSqsInited = Standard_False; Standard_Boolean anAreAvSqsInited = Standard_False;
Standard_Real aCUSq = 0, aSUSq = 0, aSVSq = 0; Standard_Real aCUSq = 0, aSUSq = 0, aSVSq = 0;

@ -6,6 +6,8 @@ puts ""
# Exception raised during topological operation. # Exception raised during topological operation.
####################################################################### #######################################################################
cpulimit 1500
restore [locate_data_file bug24190_itz.brep] b restore [locate_data_file bug24190_itz.brep] b
bopcheck b bopcheck b

@ -16,7 +16,7 @@ if { [regexp {Debug mode} [dversion]] } {
} }
} else { } else {
if { [regexp {Windows} [dversion]] } { if { [regexp {Windows} [dversion]] } {
set max_time 50 set max_time 65
} else { } else {
set max_time 80 set max_time 80
} }

@ -18,7 +18,7 @@ if { [regexp {Debug mode} [dversion]] } {
if { [regexp {Windows} [dversion]] } { if { [regexp {Windows} [dversion]] } {
set max_time 100 set max_time 100
} else { } else {
set max_time 140 set max_time 160
} }
} }

@ -16,7 +16,7 @@ if { [regexp {Debug mode} [dversion]] } {
} }
} else { } else {
if { [regexp {Windows} [dversion]] } { if { [regexp {Windows} [dversion]] } {
set max_time 100 set max_time 110
} else { } else {
set max_time 150 set max_time 150
} }

@ -0,0 +1,58 @@
puts "================"
puts "OCC24896"
puts "================"
puts ""
#######################################################################
# BRepExtrema is giving wrong intersection point between curve and planar face
#######################################################################
restore [locate_data_file bug24896_face_8.brep] f8
restore [locate_data_file bug24896_compound_line_8.brep] c8
distmini d f8 c8
# 1
regexp {([-0-9.+eE]+)$} [dump d_val] full dist
regexp { +Vertex +: +Min +[-0-9.+eE]+ +Max +([-0-9.+eE]+)} [ maxtolerance d ] full toler
set good_dist 0
if { [expr abs( ${dist} - ${good_dist} )] > ${toler} } {
puts "Faulty : the distanse is ${dist}. It is bad value"
}
# 2
# Point 3D : 66.6, -11.8556887483839, 0.3
regexp { +Point 3D : +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} [ dump d ] full x1 y1 z1
set good_x1 66.6
set good_y1 -11.8556887483839
set good_z1 0.3
if { [expr abs( ${x1} - ${good_x1} )] > ${toler} } {
puts "Faulty : the x coordinate of the point is ${x1}. It is bad value"
}
if { [expr abs( ${y1} - ${good_y1} )] > ${toler} } {
puts "Faulty : the y coordinate of the point is ${y1}. It is bad value"
}
if { [expr abs( ${z1} - ${good_z1} )] > ${toler} } {
puts "Faulty : the z coordinate of the point is ${z1}. It is bad value"
}
# 3
# Point 3D : 66.6, 11.8556887323157, 0.3
regexp { +Point 3D : +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} [ dump d2 ] full x2 y2 z2
set good_x2 66.6
set good_y2 11.8556887323157
set good_z2 0.3
if { [expr abs( ${x2} - ${good_x2} )] > ${toler} } {
puts "Faulty : the x coordinate of the point is ${x2}. It is bad value"
}
if { [expr abs( ${y2} - ${good_y2} )] > ${toler} } {
puts "Faulty : the y coordinate of the point is ${y2}. It is bad value"
}
if { [expr abs( ${z2} - ${good_z2} )] > ${toler} } {
puts "Faulty : the z coordinate of the point is ${z2}. It is bad value"
}
smallview
fit
set only_screen_axo 1