1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0024612: Wrong pcurve of the section curve

Main changes are in "IntWalk_IWalking::TestDeflection(...)" function (IntWalk_IWalking_5.gxx).

Some test cases were corrected according to their new behavior.
This commit is contained in:
nbv 2014-03-05 16:54:38 +04:00 committed by abv
parent f10da91dab
commit b92f35729a
19 changed files with 889 additions and 766 deletions

View File

@ -261,6 +261,38 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
Standard_Boolean isMicro = aSQDist*100.0 < Tol; Standard_Boolean isMicro = aSQDist*100.0 < Tol;
if(isMicro)
{//3D-dimension is small. Checking 2D-dimension
aSQDist = 0.0;
Standard_Real u1f, v1f, u2f, v2f;
Standard_Real u1l, v1l, u2l, v2l;
Standard_Real u1m, v1m, u2m, v2m;
WLine->Point(RealToInt(firstp)).Parameters(u1f, v1f, u2f, v2f);
WLine->Point(RealToInt(lastp)).Parameters(u1l, v1l, u2l, v2l);
WLine->Point(pmid).Parameters(u1m, v1m, u2m, v2m);
Standard_Real aDelta = u1m - u1f;
aSQDist += aDelta*aDelta;
aDelta = v1m - v1f;
aSQDist += aDelta*aDelta;
aDelta = u2m - u2f;
aSQDist += aDelta*aDelta;
aDelta = v2m - v2f;
aSQDist += aDelta*aDelta;
aDelta = u1m - u1l;
aSQDist += aDelta*aDelta;
aDelta = v1m - v1l;
aSQDist += aDelta*aDelta;
aDelta = u2m - u2l;
aSQDist += aDelta*aDelta;
aDelta = v2m - v2l;
aSQDist += aDelta*aDelta;
isMicro = aSQDist*100.0 < Tol;
}
if((Abs(firstp-lastp)>Precision::PConfusion()) && !isMicro) if((Abs(firstp-lastp)>Precision::PConfusion()) && !isMicro)
{ {
Pmid.Parameters(u1,v1,u2,v2); Pmid.Parameters(u1,v1,u2,v2);

View File

@ -762,68 +762,68 @@ static Standard_Integer bisec (Draw_Interpretor& di,
static Standard_Integer movelaw (Draw_Interpretor& di, Standard_Integer n, const char** a) static Standard_Integer movelaw (Draw_Interpretor& di, Standard_Integer n, const char** a)
{ {
Standard_Integer Standard_Integer
ii, ii,
condition=0, condition=0,
error_status ; error_status ;
Standard_Real u, Standard_Real u,
x, x,
tolerance, tolerance,
tx ; tx ;
u = Draw::Atof(a[2]); u = Draw::Atof(a[2]);
x = Draw::Atof(a[3]); x = Draw::Atof(a[3]);
tolerance = 1.0e-5 ; tolerance = 1.0e-5 ;
if (n < 5) { if (n < 5) {
return 1 ; return 1 ;
} }
Handle(Geom2d_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve2d(a[1]); Handle(Geom2d_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve2d(a[1]);
if (!G2.IsNull()) { if (!G2.IsNull()) {
tx = Draw::Atof(a[4]) ; tx = Draw::Atof(a[4]) ;
if (n == 6) { if (n == 6) {
condition = Max(Draw::Atoi(a[5]), -1) ; condition = Max(Draw::Atoi(a[5]), -1) ;
condition = Min(condition, G2->Degree()-1) ; condition = Min(condition, G2->Degree()-1) ;
}
TColgp_Array1OfPnt2d curve_poles(1,G2->NbPoles()) ;
TColStd_Array1OfReal law_poles(1,G2->NbPoles()) ;
TColStd_Array1OfReal law_knots(1,G2->NbKnots()) ;
TColStd_Array1OfInteger law_mults(1,G2->NbKnots()) ;
G2->Knots(law_knots) ;
G2->Multiplicities(law_mults) ;
G2->Poles(curve_poles) ;
for (ii = 1 ; ii <= G2->NbPoles() ; ii++) {
law_poles(ii) = curve_poles(ii).Coord(2) ;
}
Law_BSpline a_law(law_poles,
law_knots,
law_mults,
G2->Degree(),
Standard_False) ;
a_law.MovePointAndTangent(u,
x,
tx,
tolerance,
condition,
condition,
error_status) ;
for (ii = 1 ; ii <= G2->NbPoles() ; ii++) {
curve_poles(ii).SetCoord(2,a_law.Pole(ii)) ;
G2->SetPole(ii,curve_poles(ii)) ;
}
if (! error_status) {
Draw::Repaint();
}
else {
di << "Not enought degree of freedom increase degree please" << "\n";
}
} }
TColgp_Array1OfPnt2d curve_poles(1,G2->NbPoles()) ;
TColStd_Array1OfReal law_poles(1,G2->NbPoles()) ;
TColStd_Array1OfReal law_knots(1,G2->NbKnots()) ;
TColStd_Array1OfInteger law_mults(1,G2->NbKnots()) ;
G2->Knots(law_knots) ;
G2->Multiplicities(law_mults) ;
G2->Poles(curve_poles) ;
for (ii = 1 ; ii <= G2->NbPoles() ; ii++) {
law_poles(ii) = curve_poles(ii).Coord(2) ;
}
Law_BSpline a_law(law_poles,
law_knots,
law_mults,
G2->Degree(),
Standard_False) ;
a_law.MovePointAndTangent(u,
x,
tx,
tolerance,
condition,
condition,
error_status) ;
for (ii = 1 ; ii <= G2->NbPoles() ; ii++) {
curve_poles(ii).SetCoord(2,a_law.Pole(ii)) ;
G2->SetPole(ii,curve_poles(ii)) ;
}
if (! error_status) {
Draw::Repaint();
}
else {
di << "Not enought degree of freedom increase degree please" << "\n";
}
}
return 0; return 0;
} }
@ -1422,8 +1422,9 @@ static Standard_Integer surfpoints (Draw_Interpretor& /*di*/, Standard_Integer /
//function : intersect //function : intersect
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n, const char** a) static Standard_Integer intersection (Draw_Interpretor& di,
{ Standard_Integer n, const char** a)
{
if (n < 4) if (n < 4)
return 1; return 1;
@ -1431,11 +1432,11 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
Handle(Geom_Curve) GC1; Handle(Geom_Curve) GC1;
Handle(Geom_Surface) GS1 = DrawTrSurf::GetSurface(a[2]); Handle(Geom_Surface) GS1 = DrawTrSurf::GetSurface(a[2]);
if (GS1.IsNull()) if (GS1.IsNull())
{ {
GC1 = DrawTrSurf::GetCurve(a[2]); GC1 = DrawTrSurf::GetCurve(a[2]);
if (GC1.IsNull()) if (GC1.IsNull())
return 1; return 1;
} }
// //
Handle(Geom_Surface) GS2 = DrawTrSurf::GetSurface(a[3]); Handle(Geom_Surface) GS2 = DrawTrSurf::GetSurface(a[3]);
@ -1453,17 +1454,17 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
// //
if (GC1.IsNull()) if (GC1.IsNull())
{ {
GeomInt_IntSS Inters; GeomInt_IntSS Inters;
// //
// Surface Surface // Surface Surface
if (n <= 5) if (n <= 5)
{ {
// General case // General case
Inters.Perform(GS1,GS2,tol,Standard_True); Inters.Perform(GS1,GS2,tol,Standard_True);
} }
else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17) else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17)
{ {
Standard_Boolean useStart = Standard_True, useBnd = Standard_True; Standard_Boolean useStart = Standard_True, useBnd = Standard_True;
Standard_Integer ista1=0,ista2=0,ibnd1=0,ibnd2=0; Standard_Integer ista1=0,ista2=0,ibnd1=0,ibnd2=0;
Standard_Real UVsta[4]; Standard_Real UVsta[4];
@ -1471,67 +1472,67 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
// //
if (n <= 9) // user starting point if (n <= 9) // user starting point
{ {
useBnd = Standard_False; useBnd = Standard_False;
ista1 = 4; ista1 = 4;
ista2 = 7; ista2 = 7;
} }
else if (n <= 13) // user bounding else if (n <= 13) // user bounding
{ {
useStart = Standard_False; useStart = Standard_False;
ibnd1 = 4; ibnd2 = 11; ibnd1 = 4; ibnd2 = 11;
} }
else // both user starting point and bounding else // both user starting point and bounding
{ {
ista1 = 4; ista2 = 7; ista1 = 4; ista2 = 7;
ibnd1 = 8; ibnd2 = 15; ibnd1 = 8; ibnd2 = 15;
} }
if (useStart) if (useStart)
{ {
for (Standard_Integer i=ista1; i <= ista2; i++) for (Standard_Integer i=ista1; i <= ista2; i++)
{ {
UVsta[i-ista1] = Draw::Atof(a[i]); UVsta[i-ista1] = Draw::Atof(a[i]);
}
} }
}
if (useBnd) if (useBnd)
{ {
Standard_Real UVbnd[8]; Standard_Real UVbnd[8];
for (Standard_Integer i=ibnd1; i <= ibnd2; i++) for (Standard_Integer i=ibnd1; i <= ibnd2; i++)
UVbnd[i-ibnd1] = Draw::Atof(a[i]); UVbnd[i-ibnd1] = Draw::Atof(a[i]);
AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]); AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]);
AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]); AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]);
} }
// //
if (useStart && !useBnd) if (useStart && !useBnd)
{
Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
}
else if (!useStart && useBnd)
{
Inters.Perform(AS1,AS2,tol);
}
else
{
Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
}
}//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17)
else
{ {
Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
}
else if (!useStart && useBnd)
{
Inters.Perform(AS1,AS2,tol);
}
else
{
Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
}
}//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17)
else
{
di<<"incorrect number of arguments"<<"\n"; di<<"incorrect number of arguments"<<"\n";
return 1; return 1;
} }
// //
if (!Inters.IsDone()) if (!Inters.IsDone())
{ {
di<<"No intersections found!"<<"\n"; di<<"No intersections found!"<<"\n";
return 1; return 1;
} }
// //
char buf[1024]; char buf[1024];
@ -1540,18 +1541,18 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
// //
aNbLines = Inters.NbLines(); aNbLines = Inters.NbLines();
if (aNbLines >= 2) if (aNbLines >= 2)
{ {
for (i=1; i<=aNbLines; ++i) for (i=1; i<=aNbLines; ++i)
{ {
Sprintf(buf, "%s_%d",a[1],i); Sprintf(buf, "%s_%d",a[1],i);
di << buf << " "; di << buf << " ";
Result = Inters.Line(i); Result = Inters.Line(i);
const char* temp = buf; const char* temp = buf;
DrawTrSurf::Set(temp,Result); DrawTrSurf::Set(temp,Result);
}
} }
}
else if (aNbLines == 1) else if (aNbLines == 1)
{ {
Result = Inters.Line(1); Result = Inters.Line(1);
Sprintf(buf,"%s",a[1]); Sprintf(buf,"%s",a[1]);
di << buf << " "; di << buf << " ";
@ -1561,25 +1562,25 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
// //
aNbPoints=Inters.NbPoints(); aNbPoints=Inters.NbPoints();
for (i=1; i<=aNbPoints; ++i) for (i=1; i<=aNbPoints; ++i)
{ {
Point=Inters.Point(i); Point=Inters.Point(i);
Sprintf(buf,"%s_p_%d",a[1],i); Sprintf(buf,"%s_p_%d",a[1],i);
di << buf << " "; di << buf << " ";
const char* temp = buf; const char* temp = buf;
DrawTrSurf::Set(temp, Point); DrawTrSurf::Set(temp, Point);
} }
}// if (GC1.IsNull()) }// if (GC1.IsNull())
else else
{ {
// Curve Surface // Curve Surface
GeomAPI_IntCS Inters(GC1,GS2); GeomAPI_IntCS Inters(GC1,GS2);
// //
if (!Inters.IsDone()) if (!Inters.IsDone())
{ {
di<<"No intersections found!"<<"\n"; di<<"No intersections found!"<<"\n";
return 1; return 1;
} }
Standard_Integer nblines = Inters.NbSegments(); Standard_Integer nblines = Inters.NbSegments();
Standard_Integer nbpoints = Inters.NbPoints(); Standard_Integer nbpoints = Inters.NbPoints();
@ -1587,7 +1588,7 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
char newname[1024]; char newname[1024];
if ( (nblines+nbpoints) >= 2) if ( (nblines+nbpoints) >= 2)
{ {
Standard_Integer i; Standard_Integer i;
Standard_Integer Compt = 1; Standard_Integer Compt = 1;
@ -1595,13 +1596,13 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
cout << " Lines: " << endl; cout << " Lines: " << endl;
for (i = 1; i <= nblines; i++, Compt++) for (i = 1; i <= nblines; i++, Compt++)
{ {
Sprintf(newname,"%s_%d",a[1],Compt); Sprintf(newname,"%s_%d",a[1],Compt);
di << newname << " "; di << newname << " ";
Result = Inters.Segment(i); Result = Inters.Segment(i);
const char* temp = newname; // pour portage WNT const char* temp = newname; // pour portage WNT
DrawTrSurf::Set(temp,Result); DrawTrSurf::Set(temp,Result);
} }
if(nbpoints >= 1) if(nbpoints >= 1)
cout << " Points: " << endl; cout << " Points: " << endl;
@ -1609,33 +1610,33 @@ static Standard_Integer intersection (Draw_Interpretor& di, Standard_Integer n,
const Standard_Integer imax = nblines+nbpoints; const Standard_Integer imax = nblines+nbpoints;
for (/*i = 1*/; i <= imax; i++, Compt++) for (/*i = 1*/; i <= imax; i++, Compt++)
{ {
Sprintf(newname,"%s_%d",a[1],i); Sprintf(newname,"%s_%d",a[1],i);
di << newname << " "; di << newname << " ";
Point = Inters.Point(i); Point = Inters.Point(i);
const char* temp = newname; // pour portage WNT const char* temp = newname; // pour portage WNT
DrawTrSurf::Set(temp,Point); DrawTrSurf::Set(temp,Point);
}
} }
}
else if (nblines == 1) else if (nblines == 1)
{ {
Result = Inters.Segment(1); Result = Inters.Segment(1);
Sprintf(newname,"%s",a[1]); Sprintf(newname,"%s",a[1]);
di << newname << " "; di << newname << " ";
DrawTrSurf::Set(a[1],Result); DrawTrSurf::Set(a[1],Result);
} }
else if (nbpoints == 1) else if (nbpoints == 1)
{ {
Point = Inters.Point(1); Point = Inters.Point(1);
Sprintf(newname,"%s",a[1]); Sprintf(newname,"%s",a[1]);
di << newname << " "; di << newname << " ";
DrawTrSurf::Set(a[1],Point); DrawTrSurf::Set(a[1],Point);
}
} }
}
dout.Flush(); dout.Flush();
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : CurveCommands //function : CurveCommands

View File

@ -122,7 +122,7 @@ Standard_Boolean IntImp_ZerImpFunc::IsTangent()
d3d.SetLinearForm(tgdu,d1u,tgdv,d1v); d3d.SetLinearForm(tgdu,d1u,tgdv,d1v);
d2d = gp_Dir2d(tgdu, tgdv); d2d = gp_Dir2d(tgdu, tgdv);
if (d3d.Magnitude() <= Tolpetit) { // jag if (d3d.Magnitude() <= Tolpetit) { // jag
tangent = Standard_True; tangent = Standard_True;
} }
} }
} }

View File

@ -1420,13 +1420,14 @@ void IntPatch_Intersection::GeomParamPerfom(const Handle(Adaptor3d_HSurface)& t
if (!empt) if (!empt)
{ {
for(Standard_Integer i = 1; i <= interip.NbLines(); i++) const Standard_Integer aNbLines = interip.NbLines();
for(Standard_Integer i = 1; i <= aNbLines; i++)
{ {
if(interip.Line(i)->ArcType() != IntPatch_Walking) if(interip.Line(i)->ArcType() != IntPatch_Walking)
slin.Append(interip.Line(i)); slin.Append(interip.Line(i));
} }
for(Standard_Integer i = 1; i <= interip.NbLines(); i++) for(Standard_Integer i = 1; i <= aNbLines; i++)
{ {
if(interip.Line(i)->ArcType() == IntPatch_Walking) if(interip.Line(i)->ArcType() == IntPatch_Walking)
slin.Append(interip.Line(i)); slin.Append(interip.Line(i));

View File

@ -294,7 +294,5 @@ fields
previousd2d : Dir2d from gp; previousd2d : Dir2d from gp;
seqAjout : SequenceOfInteger from TColStd; seqAjout : SequenceOfInteger from TColStd;
lines : SequenceOfIWLine; lines : SequenceOfIWLine;
NbPointsConfondusConsecutifs: Integer from Standard;
EpsilonSembleTropGrand : Integer from Standard;
end IWalking; end IWalking;

View File

@ -31,9 +31,7 @@ IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
epsilon(Epsilon*Epsilon), epsilon(Epsilon*Epsilon),
wd1 (IntWalk_VectorOfWalkingData::allocator_type (new NCollection_IncAllocator)), wd1 (IntWalk_VectorOfWalkingData::allocator_type (new NCollection_IncAllocator)),
wd2 (wd1.get_allocator()), wd2 (wd1.get_allocator()),
nbMultiplicities (wd1.get_allocator()), nbMultiplicities (wd1.get_allocator())
NbPointsConfondusConsecutifs(0),
EpsilonSembleTropGrand(0)
{ {
} }
@ -161,9 +159,13 @@ void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
Func.Set(Caro); Func.Set(Caro);
// calculation of all open lines // calculation of all open lines
if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout); if (nbPnts1 != 0)
ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
// calculation of all closed lines // calculation of all closed lines
if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout); if (nbPnts2 != 0)
ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
for (I = 1; I <= nbPnts1; I++) { for (I = 1; I <= nbPnts1; I++) {
if (wd1[I].etat >0) seqSingle.Append(Pnts1(I)); if (wd1[I].etat >0) seqSingle.Append(Pnts1(I));
} }

View File

@ -118,27 +118,27 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
CurrentLine->AddPoint(previousPoint); CurrentLine->AddPoint(previousPoint);
// modified by NIZHNY-MKK Fri Oct 27 12:34:32 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 12:34:32 2000.BEGIN
if(movementdirectioninfo[I] !=0) { if(movementdirectioninfo[I] !=0) {
if(movementdirectioninfo[I] < 0) { if(movementdirectioninfo[I] < 0) {
StepSign = -1; StepSign = -1;
CurrentLine->SetTangentVector(previousd3d.Reversed(),1); CurrentLine->SetTangentVector(previousd3d.Reversed(),1);
} else { } else {
StepSign = 1; StepSign = 1;
CurrentLine->SetTangentVector(previousd3d,1); CurrentLine->SetTangentVector(previousd3d,1);
} }
} else { } else {
Standard_Real tyutuyt=ThePointOfPathTool::Direction3d(PathPnt) * previousd3d; Standard_Real tyutuyt=ThePointOfPathTool::Direction3d(PathPnt) * previousd3d;
if( tyutuyt < 0) { if( tyutuyt < 0) {
StepSign = -1; StepSign = -1;
CurrentLine->SetTangentVector(previousd3d.Reversed(),1); CurrentLine->SetTangentVector(previousd3d.Reversed(),1);
} }
else { else {
StepSign = 1; StepSign = 1;
CurrentLine->SetTangentVector(previousd3d,1); CurrentLine->SetTangentVector(previousd3d,1);
} }
} }
// modified by NIZHNY-MKK Fri Oct 27 12:34:37 2000.END // modified by NIZHNY-MKK Fri Oct 27 12:34:37 2000.END
// Modified by Sergey KHROMOV - Tue Nov 20 10:41:45 2001 Begin // Modified by Sergey KHROMOV - Tue Nov 20 10:41:45 2001 Begin
wd1[I].etat = - abs(wd1[I].etat); wd1[I].etat = - abs(wd1[I].etat);
movementdirectioninfo[I] = (movementdirectioninfo[I]==0) ? StepSign : 0; movementdirectioninfo[I] = (movementdirectioninfo[I]==0) ? StepSign : 0;
// Modified by Sergey KHROMOV - Tue Nov 20 10:41:56 2001 End // Modified by Sergey KHROMOV - Tue Nov 20 10:41:56 2001 End
@ -146,13 +146,13 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
Standard_Real d2dx = Abs(previousd2d.X()); Standard_Real d2dx = Abs(previousd2d.X());
Standard_Real d2dy = Abs(previousd2d.Y()); Standard_Real d2dy = Abs(previousd2d.Y());
if (d2dx < tolerance(1)) { if (d2dx < tolerance(1)) {
PasC = pas * (VM-Vm)/d2dy; PasC = pas * (VM-Vm)/d2dy;
} }
else if (d2dy < tolerance(2)) { else if (d2dy < tolerance(2)) {
PasC = pas * (UM-Um)/d2dx; PasC = pas * (UM-Um)/d2dx;
} }
else { else {
PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy); PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy);
} }
Arrive = Standard_False; Arrive = Standard_False;
@ -161,274 +161,280 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
StatusPrecedent = IntWalk_OK; StatusPrecedent = IntWalk_OK;
// modified by NIZHNY-MKK Fri Oct 27 12:39:37 2000 // modified by NIZHNY-MKK Fri Oct 27 12:39:37 2000
Standard_Integer IndexOfPathPointDoNotCheck=0; Standard_Integer IndexOfPathPointDoNotCheck=0;
Standard_Integer aNbIter = 10;
while (!Arrive) { // as one of stop tests is not checked while (!Arrive) { // as one of stop tests is not checked
Cadre = Cadrage(BornInf,BornSup,UVap,PasC,StepSign);
Cadre = Cadrage(BornInf,BornSup,UVap,PasC,StepSign); // Border?
// Border?
#ifdef CHRONO #ifdef CHRONO
Chronrsnld.Start(); Chronrsnld.Start();
#endif #endif
Rsnld.Perform(Func,UVap,BornInf,BornSup); Rsnld.Perform(Func,UVap,BornInf,BornSup);
#ifdef CHRONO #ifdef CHRONO
Chronrsnld.Stop(); Chronrsnld.Stop();
#endif #endif
if (Cadre) { if (Cadre) {
BornInf(1) = Um; BornSup(1) = UM; BornInf(2) = Vm; BornSup(2) = VM; BornInf(1) = Um; BornSup(1) = UM; BornInf(2) = Vm; BornSup(2) = VM;
} }
if (Rsnld.IsDone()) { if (Rsnld.IsDone()) {
if (Abs(Func.Root()) > Func.Tolerance()) { if (Abs(Func.Root()) > Func.Tolerance()) {
PasC = PasC / 2.0; PasC = PasC / 2.0;
PasCu = Abs(PasC*previousd2d.X()); PasCu = Abs(PasC*previousd2d.X());
PasCv = Abs(PasC*previousd2d.Y()); PasCv = Abs(PasC*previousd2d.Y());
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
if (CurrentLine->NbPoints() == 1) break; if (CurrentLine->NbPoints() == 1) break;
Arrive = Standard_True; Arrive = Standard_True;
CurrentLine->AddStatusLast(Standard_False); CurrentLine->AddStatusLast(Standard_False);
Tgtend = Standard_True; // check Tgtend = Standard_True; // check
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(lines.Length() + 1); seqAjout.Append(lines.Length() + 1);
} }
} }
else { // test stop else { // test stop
Rsnld.Root(UVap); Rsnld.Root(UVap);
Arrive = TestArretPassage(Umult, Vmult, Func, UVap, N); Arrive = TestArretPassage(Umult, Vmult, Func, UVap, N);
if (Arrive) { if (Arrive) {
Cadre = Standard_False; Cadre = Standard_False;
//in case if there is a frame and arrive at the same time //in case if there is a frame and arrive at the same time
} }
else { else {
if (Rajout) { if (Rajout) {
ArretAjout =TestArretAjout(Func, UVap, N, Psol); ArretAjout =TestArretAjout(Func, UVap, N, Psol);
if (ArretAjout) { if (ArretAjout) {
// jag 940615 // jag 940615
Tgtend = lines.Value(N)->IsTangentAtEnd(); Tgtend = lines.Value(N)->IsTangentAtEnd();
N = -N;
}
}
// modified by NIZHNY-MKK Thu Nov 2 15:09:08 2000.BEGIN
if(!(Rajout && ArretAjout)) {
Standard_Real prevUp, prevVp;
if (!reversed) {
previousPoint.ParametersOnS2(prevUp, prevVp);
}
else {
previousPoint.ParametersOnS1(prevUp, prevVp);
}
Arrive = TestPassedSolutionWithNegativeState(wd1, Umult, Vmult, prevUp, prevVp,
nbMultiplicities, tolerance, Func, UVap, N);
if(Arrive) {
Cadre = Standard_False;
}
}
// modified by NIZHNY-MKK Thu Nov 2 15:09:13 2000.END
if (!ArretAjout && Cadre) {
if (CurrentLine->NbPoints() == 1) break; // cancel the line
TestArretCadre(Umult, Vmult, CurrentLine, Func, UVap, N);
// if (N == 0) {
if (N <= 0) { // jag 941017
MakeWalkingPoint(2, UVap(1), UVap(2), Func, Psol);
Tgtend = Func.IsTangent();
N = -N; N = -N;
} }
} }
} // modified by NIZHNY-MKK Thu Nov 2 15:09:08 2000.BEGIN
Status = TestDeflection(Func, Arrive, UVap, StatusPrecedent, if(!(Rajout && ArretAjout)) {
NbDivision,PasC,StepSign); Standard_Real prevUp, prevVp;
StatusPrecedent = Status; if (!reversed) {
if (Status == IntWalk_PasTropGrand) { previousPoint.ParametersOnS2(prevUp, prevVp);
Arrive = Standard_False; }
ArretAjout = Standard_False; else {
Tgtend = Standard_False; // jag 940615 previousPoint.ParametersOnS1(prevUp, prevVp);
if (!reversed) { }
previousPoint.ParametersOnS2(UVap(1), UVap(2)); Arrive = TestPassedSolutionWithNegativeState(wd1, Umult, Vmult, prevUp, prevVp,
} nbMultiplicities, tolerance, Func, UVap, N);
else { if(Arrive) {
previousPoint.ParametersOnS1(UVap(1), UVap(2)); Cadre = Standard_False;
} }
} }
else if (ArretAjout || Cadre) { // modified by NIZHNY-MKK Thu Nov 2 15:09:13 2000.END
Arrive = Standard_True; if (!ArretAjout && Cadre) {
CurrentLine->AddStatusLast(Standard_False); if (CurrentLine->NbPoints() == 1) break; // cancel the line
if (Status != IntWalk_ArretSurPointPrecedent) { TestArretCadre(Umult, Vmult, CurrentLine, Func, UVap, N);
CurrentLine->AddPoint(Psol); // if (N == 0) {
} if (N <= 0) { // jag 941017
if (Cadre && N==0) { MakeWalkingPoint(2, UVap(1), UVap(2), Func, Psol);
Rajout = Standard_True; Tgtend = Func.IsTangent();
seqAjout.Append(lines.Length()+1); N = -N;
} }
} }
else if (Status == IntWalk_ArretSurPointPrecedent) { }
if (CurrentLine->NbPoints() == 1) { //cancel the line Status = TestDeflection(Func, Arrive, UVap, StatusPrecedent,
Arrive = Standard_False; NbDivision,PasC,StepSign);
break; StatusPrecedent = Status;
} if (Status == IntWalk_PasTropGrand) {
Arrive = Standard_True; Arrive = Standard_False;
Rajout = Standard_True; ArretAjout = Standard_False;
Tgtend = Standard_False; // jag 940615
if (!reversed) {
previousPoint.ParametersOnS2(UVap(1), UVap(2));
}
else {
previousPoint.ParametersOnS1(UVap(1), UVap(2));
}
}
else if (ArretAjout || Cadre) {
Arrive = Standard_True;
CurrentLine->AddStatusLast(Standard_False);
if (Status != IntWalk_ArretSurPointPrecedent) {
CurrentLine->AddPoint(Psol);
}
if (Cadre && N==0) {
Rajout = Standard_True;
seqAjout.Append(lines.Length()+1);
}
}
else if (Status == IntWalk_ArretSurPointPrecedent) {
if (CurrentLine->NbPoints() == 1) { //cancel the line
Arrive = Standard_False;
break;
}
Arrive = Standard_True;
Rajout = Standard_True;
seqAjout.Append(lines.Length() + 1); seqAjout.Append(lines.Length() + 1);
CurrentLine->AddStatusLast(Standard_False); CurrentLine->AddStatusLast(Standard_False);
Tgtend = Standard_True; // check Tgtend = Standard_True; // check
} }
else if (Arrive) { else if (Arrive) {
if (CurrentLine->NbPoints() == 1 && // cancel the line if (CurrentLine->NbPoints() == 1 && // cancel the line
(N == I || Status == IntWalk_PointConfondu) ) { (N == I || Status == IntWalk_PointConfondu) ) {
// if N == I the main uv is probably lost // if N == I the main uv is probably lost
// or the point is a point of accumulation // or the point is a point of accumulation
// if point is confused the start data is bad // if point is confused the start data is bad
Arrive = Standard_False; Arrive = Standard_False;
break; break;
} }
// necessairily N > 0 jag 940617 // necessairily N > 0 jag 940617
// point of stop given at input // point of stop given at input
PathPnt = Pnts1.Value(N); PathPnt = Pnts1.Value(N);
Standard_Integer etat1N=wd1[N].etat; Standard_Integer etat1N=wd1[N].etat;
// modified by NIZHNY-MKK Thu Nov 2 15:09:51 2000.BEGIN // modified by NIZHNY-MKK Thu Nov 2 15:09:51 2000.BEGIN
// if (etat1N < 11) { // passing point that is a stop // if (etat1N < 11) { // passing point that is a stop
if (Abs(etat1N) < 11) { // passing point that is a stop if (Abs(etat1N) < 11) { // passing point that is a stop
// modified by NIZHNY-MKK Thu Nov 2 15:12:11 2000.END // modified by NIZHNY-MKK Thu Nov 2 15:12:11 2000.END
if (Status == IntWalk_ArretSurPoint) { if (Status == IntWalk_ArretSurPoint) {
CurrentLine->AddStatusLast(Standard_False); CurrentLine->AddStatusLast(Standard_False);
Tgtend = Standard_True; // need check Tgtend = Standard_True; // need check
} }
else { else {
Arrive = Standard_False; Arrive = Standard_False;
} }
CurrentLine->AddIndexPassing(N); CurrentLine->AddIndexPassing(N);
} }
else { // point of stop given at input else { // point of stop given at input
if (etat1N == 11) { if (etat1N == 11) {
Tgtend = Standard_True; Tgtend = Standard_True;
} }
CurrentLine->AddStatusLast(Standard_True, N, PathPnt); CurrentLine->AddStatusLast(Standard_True, N, PathPnt);
} }
AddPointInCurrentLine(N,PathPnt,CurrentLine); AddPointInCurrentLine(N,PathPnt,CurrentLine);
if ((etat1N != 1 && etat1N != 11)) { if ((etat1N != 1 && etat1N != 11)) {
// modified by NIZHNY-MKK Fri Oct 27 12:43:05 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 12:43:05 2000.BEGIN
// wd1[N].etat= - wd1[N].etat; // wd1[N].etat= - wd1[N].etat;
wd1[N].etat = - Abs(etat1N); wd1[N].etat = - Abs(etat1N);
movementdirectioninfo[N] = (movementdirectioninfo[N]==0) ? StepSign : 0; movementdirectioninfo[N] = (movementdirectioninfo[N]==0) ? StepSign : 0;
if(Arrive && movementdirectioninfo[N]!=0) { if(Arrive && movementdirectioninfo[N]!=0) {
IndexOfPathPointDoNotCheck = N; IndexOfPathPointDoNotCheck = N;
} }
if(Arrive) { if(Arrive) {
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(lines.Length() + 1); seqAjout.Append(lines.Length() + 1);
} }
// modified by NIZHNY-MKK Fri Oct 27 12:45:33 2000.END // modified by NIZHNY-MKK Fri Oct 27 12:45:33 2000.END
} }
} }
else if (Status == IntWalk_ArretSurPoint) { else if (Status == IntWalk_ArretSurPoint) {
Arrive = Standard_True; Arrive = Standard_True;
CurrentLine->AddStatusLast(Standard_False); CurrentLine->AddStatusLast(Standard_False);
Tgtend = Standard_True; Tgtend = Standard_True;
MakeWalkingPoint(1, UVap(1), UVap(2), Func, Psol); MakeWalkingPoint(1, UVap(1), UVap(2), Func, Psol);
CurrentLine->AddPoint(Psol); CurrentLine->AddPoint(Psol);
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(lines.Length() + 1); seqAjout.Append(lines.Length() + 1);
} }
else if (Status == IntWalk_OK) { else if (Status == IntWalk_OK) {
MakeWalkingPoint(2, UVap(1), UVap(2), Func, previousPoint); MakeWalkingPoint(2, UVap(1), UVap(2), Func, previousPoint);
previousd3d = Func.Direction3d(); previousd3d = Func.Direction3d();
previousd2d = Func.Direction2d(); previousd2d = Func.Direction2d();
CurrentLine->AddPoint(previousPoint); CurrentLine->AddPoint(previousPoint);
} }
} else if (Status == IntWalk_PointConfondu)
} {
else { // no numerical solution aNbIter --;
PasC = PasC / 2.; }
PasCu = Abs(PasC*previousd2d.X()); }
PasCv = Abs(PasC*previousd2d.Y()); }
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { else { // no numerical solution
if (CurrentLine->NbPoints()==1) break; PasC = PasC / 2.;
Arrive = Standard_True; PasCu = Abs(PasC*previousd2d.X());
CurrentLine->AddStatusLast(Standard_False); PasCv = Abs(PasC*previousd2d.Y());
Tgtend = Standard_True; // need check if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
Rajout = Standard_True; if (CurrentLine->NbPoints()==1) break;
Arrive = Standard_True;
CurrentLine->AddStatusLast(Standard_False);
Tgtend = Standard_True; // need check
Rajout = Standard_True;
seqAjout.Append(lines.Length() + 1); seqAjout.Append(lines.Length() + 1);
} }
} }
if(aNbIter < 0)
break;
} // end of started line } // end of started line
if (Arrive) { if (Arrive) {
CurrentLine->SetTangencyAtEnd(Tgtend); CurrentLine->SetTangencyAtEnd(Tgtend);
lines.Append(CurrentLine); lines.Append(CurrentLine);
// modified by NIZHNY-MKK Fri Oct 27 12:59:29 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 12:59:29 2000.BEGIN
movementdirectioninfo[I]=0; movementdirectioninfo[I]=0;
if(wd1[I].etat > 0) if(wd1[I].etat > 0)
// modified by NIZHNY-MKK Fri Oct 27 12:59:42 2000.END // modified by NIZHNY-MKK Fri Oct 27 12:59:42 2000.END
wd1[I].etat=-wd1[I].etat; wd1[I].etat=-wd1[I].etat;
//-- lbr le 5 juin 97 (Pb ds Contap) //-- lbr le 5 juin 97 (Pb ds Contap)
for(Standard_Integer av=1; av<=nbPath; av++) { for(Standard_Integer av=1; av<=nbPath; av++) {
// modified by NIZHNY-MKK Fri Oct 27 13:00:22 2000.BEGIN // modified by NIZHNY-MKK Fri Oct 27 13:00:22 2000.BEGIN
// if (wd1[av].etat > 11) { // if (wd1[av].etat > 11) {
if ((wd1[av].etat > 11) || if ((wd1[av].etat > 11) ||
((av!=I) && ((av!=I) &&
(av!=IndexOfPathPointDoNotCheck) && (av!=IndexOfPathPointDoNotCheck) &&
(wd1[av].etat < -11) && (wd1[av].etat < -11) &&
(movementdirectioninfo[av]!=0))) { (movementdirectioninfo[av]!=0)))
// modified by NIZHNY-MKK Fri Oct 27 13:00:26 2000.END {
Standard_Real Uav=wd1[av].ustart; // modified by NIZHNY-MKK Fri Oct 27 13:00:26 2000.END
Standard_Real Vav=wd1[av].vstart; Standard_Real Uav=wd1[av].ustart;
Standard_Real Uavp,Vavp; Standard_Real Vav=wd1[av].vstart;
const IntSurf_PntOn2S &avP=CurrentLine->Value(CurrentLine->NbPoints()); Standard_Real Uavp,Vavp;
if (!reversed) { const IntSurf_PntOn2S &avP=CurrentLine->Value(CurrentLine->NbPoints());
avP.ParametersOnS2(Uavp,Vavp); if (!reversed) {
} avP.ParametersOnS2(Uavp,Vavp);
else { }
avP.ParametersOnS1(Uavp,Vavp); else {
} avP.ParametersOnS1(Uavp,Vavp);
Uav-=Uavp; }
Vav-=Vavp; Uav-=Uavp;
Uav*=0.001; Vav*=0.001; Vav-=Vavp;
if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) { Uav*=0.001; Vav*=0.001;
// modified by NIZHNY-MKK Fri Oct 27 13:01:38 2000.BEGIN if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) {
// wd1[av].etat=-wd1[av].etat; // modified by NIZHNY-MKK Fri Oct 27 13:01:38 2000.BEGIN
if(wd1[av].etat < 0) { // wd1[av].etat=-wd1[av].etat;
movementdirectioninfo[av] = 0; if(wd1[av].etat < 0) {
} else { movementdirectioninfo[av] = 0;
wd1[av].etat=-wd1[av].etat; } else {
movementdirectioninfo[av] = StepSign; wd1[av].etat=-wd1[av].etat;
} movementdirectioninfo[av] = StepSign;
// modified by NIZHNY-MKK Fri Oct 27 13:01:42 2000.END }
CurrentLine->AddStatusLast(Standard_True, av, Pnts1.Value(av)); // modified by NIZHNY-MKK Fri Oct 27 13:01:42 2000.END
//-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<<endl; CurrentLine->AddStatusLast(Standard_True, av, Pnts1.Value(av));
} //-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<<endl;
}
const IntSurf_PntOn2S &avPP=CurrentLine->Value(1);
if (!reversed) {
avPP.ParametersOnS2(Uavp,Vavp);
}
else {
avPP.ParametersOnS1(Uavp,Vavp);
}
Uav=wd1[av].ustart;
Vav=wd1[av].vstart;
Uav-=Uavp;
Vav-=Vavp;
Uav*=0.001; Vav*=0.001;
if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) {
// modified by NIZHNY-MKK Fri Oct 27 13:02:49 2000.BEGIN
// wd1[av].etat=-wd1[av].etat;
if(wd1[av].etat < 0) {
movementdirectioninfo[av] = 0;
} else {
wd1[av].etat=-wd1[av].etat;
movementdirectioninfo[av] = -StepSign;
}
// modified by NIZHNY-MKK Fri Oct 27 13:02:52 2000.END
//-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<<endl;
CurrentLine->AddStatusFirst(Standard_False, Standard_True, av, Pnts1.Value(av));
}
}
}
const IntSurf_PntOn2S &avPP=CurrentLine->Value(1);
if (!reversed) {
avPP.ParametersOnS2(Uavp,Vavp);
}
else {
avPP.ParametersOnS1(Uavp,Vavp);
}
Uav=wd1[av].ustart;
Vav=wd1[av].vstart;
Uav-=Uavp;
Vav-=Vavp;
Uav*=0.001; Vav*=0.001;
if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) {
// modified by NIZHNY-MKK Fri Oct 27 13:02:49 2000.BEGIN
// wd1[av].etat=-wd1[av].etat;
if(wd1[av].etat < 0) {
movementdirectioninfo[av] = 0;
} else {
wd1[av].etat=-wd1[av].etat;
movementdirectioninfo[av] = -StepSign;
}
// modified by NIZHNY-MKK Fri Oct 27 13:02:52 2000.END
//-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<<endl;
CurrentLine->AddStatusFirst(Standard_False, Standard_True, av, Pnts1.Value(av));
}
}
}
} }
} //end of point processing } //end of point processing
} //end of all points } //end of all points

View File

@ -79,11 +79,11 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
Standard_Integer nbLoop = Pnts2.Length(); Standard_Integer nbLoop = Pnts2.Length();
for (I = 1;I<=nbLoop;I++) { for (I = 1;I<=nbLoop;I++) {
if (wd2[I].etat > 12) { // start point of closed line if (wd2[I].etat > 12)
{ // start point of closed line
LoopPnt = Pnts2.Value(I); LoopPnt = Pnts2.Value(I);
previousPoint.SetValue(ThePointOfLoopTool::Value3d(LoopPnt),reversed, previousPoint.SetValue(ThePointOfLoopTool::Value3d(LoopPnt),reversed,
wd2[I].ustart,wd2[I].vstart); wd2[I].ustart,wd2[I].vstart);
previousd3d = ThePointOfLoopTool::Direction3d(LoopPnt); previousd3d = ThePointOfLoopTool::Direction3d(LoopPnt);
previousd2d = ThePointOfLoopTool::Direction2d(LoopPnt); previousd2d = ThePointOfLoopTool::Direction2d(LoopPnt);
@ -102,13 +102,13 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
Standard_Real d2dx = Abs(previousd2d.X()); Standard_Real d2dx = Abs(previousd2d.X());
Standard_Real d2dy = Abs(previousd2d.Y()); Standard_Real d2dy = Abs(previousd2d.Y());
if (d2dx < tolerance(1)) { if (d2dx < tolerance(1)) {
PasC = pas * (VM-Vm)/d2dy; PasC = pas * (VM-Vm)/d2dy;
} }
else if (d2dy < tolerance(2)) { else if (d2dy < tolerance(2)) {
PasC = pas * (UM-Um)/d2dx; PasC = pas * (UM-Um)/d2dx;
} }
else { else {
PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy); PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy);
} }
PasSav = PasC; PasSav = PasC;
@ -117,225 +117,232 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
ArretAjout = Standard_False; ArretAjout = Standard_False;
NbDivision = 0; NbDivision = 0;
StatusPrecedent = IntWalk_OK; StatusPrecedent = IntWalk_OK;
Standard_Integer aNbIter = 10;
while (!Arrive) { // as no test of stop is passed while (!Arrive) { // as no test of stop is passed
Cadre=Cadrage(BornInf,BornSup,Uvap,PasC, StepSign); // border? Cadre=Cadrage(BornInf,BornSup,Uvap,PasC, StepSign); // border?
#ifdef CHRONO #ifdef CHRONO
Chronrsnld.Start(); Chronrsnld.Start();
#endif #endif
Rsnld.Perform(Func,Uvap,BornInf,BornSup); Rsnld.Perform(Func,Uvap,BornInf,BornSup);
#ifdef CHRONO #ifdef CHRONO
Chronrsnld.Stop(); Chronrsnld.Stop();
#endif #endif
if (Cadre) { // update of limits. if (Cadre) { // update of limits.
BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM; BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM;
} }
if (Rsnld.IsDone()) { if (Rsnld.IsDone()) {
if (Abs(Func.Root()) > Func.Tolerance()) { // no solution for the tolerance if (Abs(Func.Root()) > Func.Tolerance()) { // no solution for the tolerance
PasC = PasC/2.; PasC = PasC/2.;
PasCu = Abs(PasC*previousd2d.X()); PasCu = Abs(PasC*previousd2d.X());
PasCv = Abs(PasC*previousd2d.Y()); PasCv = Abs(PasC*previousd2d.Y());
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
if (CurrentLine->NbPoints()==1) break; if (CurrentLine->NbPoints()==1) break;
Arrive = Standard_True; Arrive = Standard_True;
CurrentLine->AddStatusFirstLast(Standard_False, CurrentLine->AddStatusFirstLast(Standard_False,
Standard_False,Standard_False); Standard_False,Standard_False);
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(lines.Length()+1); seqAjout.Append(lines.Length()+1);
Tgtend = Standard_True; Tgtend = Standard_True;
} }
} }
else { // there is a solution else { // there is a solution
Rsnld.Root(Uvap); Rsnld.Root(Uvap);
Arrive = TestArretPassage(Umult,Vmult,Uvap,I,Ipass); Arrive = TestArretPassage(Umult,Vmult,Uvap,I,Ipass);
if (Arrive) {//reset proper parameter to test the arrow. if (Arrive) {//reset proper parameter to test the arrow.
Psol = CurrentLine->Value(1); Psol = CurrentLine->Value(1);
if (!reversed) { if (!reversed) {
Psol.ParametersOnS2(Uvap(1),Uvap(2)); Psol.ParametersOnS2(Uvap(1),Uvap(2));
} }
else { else {
Psol.ParametersOnS1(Uvap(1),Uvap(2)); Psol.ParametersOnS1(Uvap(1),Uvap(2));
} }
Cadre=Standard_False; Cadre=Standard_False;
//in case if there is a frame and arrival at the same time //in case if there is a frame and arrival at the same time
} }
else { // modif jag 940615 else { // modif jag 940615
if (Rajout) { // test on added points
ArretAjout =TestArretAjout(Func,Uvap,N,Psol);
if (ArretAjout) {
if (N >0) {
Tgtend = lines.Value(N)->IsTangentAtEnd();
N = -N;
}
else {
Tgtend = lines.Value(-N)->IsTangentAtBegining();
}
Arrive = (wd2[I].etat == 12);
}
}
if (Rajout) { // test on added points if (!ArretAjout&& Cadre) { // test on already marked points
ArretAjout =TestArretAjout(Func,Uvap,N,Psol); if (CurrentLine->NbPoints() == 1) break; // cancel the line
if (ArretAjout) { TestArretCadre(Umult,Vmult,CurrentLine,Func,Uvap,N);
if (N >0) { // if (N==0) {
Tgtend = lines.Value(N)->IsTangentAtEnd(); if (N <= 0) { // jag 941017
N = -N; MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol);
} Tgtend = Func.IsTangent(); // jag 940616
else { N = -N;
Tgtend = lines.Value(-N)->IsTangentAtBegining(); }
} Arrive = (wd2[I].etat == 12); // the line is open
Arrive = (wd2[I].etat == 12); }
} }
} Status = TestDeflection(Func, Arrive,Uvap,StatusPrecedent,
NbDivision,PasC,StepSign);
if (!ArretAjout&& Cadre) { // test on already marked points StatusPrecedent = Status;
if (CurrentLine->NbPoints() == 1) break; // cancel the line if (Status == IntWalk_PasTropGrand) {// division of the step
TestArretCadre(Umult,Vmult,CurrentLine,Func,Uvap,N); Arrive = Standard_False;
// if (N==0) { ArretAjout = Standard_False;
if (N <= 0) { // jag 941017 Tgtend = Standard_False; // jag 940616
MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol); if (!reversed) {
Tgtend = Func.IsTangent(); // jag 940616 previousPoint.ParametersOnS2(Uvap(1),Uvap(2));
N = -N; }
} else {
Arrive = (wd2[I].etat == 12); // the line is open previousPoint.ParametersOnS1(Uvap(1),Uvap(2));
} }
} }
Status = TestDeflection(Func, Arrive,Uvap,StatusPrecedent, else if (ArretAjout || Cadre) {
NbDivision,PasC,StepSign);
StatusPrecedent = Status;
if (Status == IntWalk_PasTropGrand) {// division of the step
Arrive = Standard_False;
ArretAjout = Standard_False;
Tgtend = Standard_False; // jag 940616
if (!reversed) {
previousPoint.ParametersOnS2(Uvap(1),Uvap(2));
}
else {
previousPoint.ParametersOnS1(Uvap(1),Uvap(2));
}
}
else if (ArretAjout || Cadre) {
if (Arrive) { // line s is open if (Arrive) { // line s is open
CurrentLine->AddStatusLast(Standard_False); CurrentLine->AddStatusLast(Standard_False);
if (Status != IntWalk_ArretSurPointPrecedent) { if (Status != IntWalk_ArretSurPointPrecedent) {
CurrentLine->AddPoint(Psol); CurrentLine->AddPoint(Psol);
} }
if (Cadre && N==0) { if (Cadre && N==0) {
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(lines.Length()+1); seqAjout.Append(lines.Length()+1);
} }
} }
else { // open else { // open
wd2[I].etat = 12; // declare it open wd2[I].etat = 12; // declare it open
Tgtbeg = Tgtend; Tgtbeg = Tgtend;
Tgtend = Standard_False; Tgtend = Standard_False;
ArretAjout = Standard_False; ArretAjout = Standard_False;
StepSign = -1; StepSign = -1;
StatusPrecedent = IntWalk_OK; StatusPrecedent = IntWalk_OK;
PasC = PasSav; PasC = PasSav;
if (Status == IntWalk_ArretSurPointPrecedent) { if (Status == IntWalk_ArretSurPointPrecedent) {
OpenLine(0,Psol,Pnts1,Func,CurrentLine); OpenLine(0,Psol,Pnts1,Func,CurrentLine);
} }
else { else {
OpenLine(-lines.Length()-1,Psol,Pnts1,Func,CurrentLine); OpenLine(-lines.Length()-1,Psol,Pnts1,Func,CurrentLine);
} }
if (Cadre && N==0) { if (Cadre && N==0) {
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(-lines.Length()-1); seqAjout.Append(-lines.Length()-1);
} }
} }
} }
else if ( Status == IntWalk_ArretSurPointPrecedent) {
else if ( Status == IntWalk_ArretSurPointPrecedent) { if (CurrentLine->NbPoints() == 1) { //cancel the line
if (CurrentLine->NbPoints() == 1) { //cancel the line Arrive = Standard_False;
Arrive = Standard_False; break;
break; }
} if (wd2[I].etat >12) { //the line should become open
if (wd2[I].etat >12) { //the line should become open wd2[I].etat = 12; //declare it open
wd2[I].etat = 12; //declare it open ArretAjout = Standard_False;
ArretAjout = Standard_False; OpenLine(0,Psol,Pnts1,Func,CurrentLine);
OpenLine(0,Psol,Pnts1,Func,CurrentLine); StepSign = -1;
StepSign = -1;
StatusPrecedent = IntWalk_OK; StatusPrecedent = IntWalk_OK;
Arrive = Standard_False; Arrive = Standard_False;
PasC = PasSav; PasC = PasSav;
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(-lines.Length()-1); seqAjout.Append(-lines.Length()-1);
} }
else { // line s is open else { // line s is open
Arrive =Standard_True; Arrive =Standard_True;
CurrentLine->AddStatusLast(Standard_False); CurrentLine->AddStatusLast(Standard_False);
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(lines.Length()+1); seqAjout.Append(lines.Length()+1);
} }
} }
else if (Arrive) { else if (Arrive) {
if (wd2[I].etat > 12) { //line closed good case if (wd2[I].etat > 12) { //line closed good case
CurrentLine->AddStatusFirstLast(Standard_True, CurrentLine->AddStatusFirstLast(Standard_True,
Standard_False,Standard_False); Standard_False,Standard_False);
CurrentLine->AddPoint(CurrentLine->Value(1)); CurrentLine->AddPoint(CurrentLine->Value(1));
} }
else if (N >0) { //point of stop given at input else if (N >0) { //point of stop given at input
PathPnt = Pnts1.Value(N); PathPnt = Pnts1.Value(N);
CurrentLine->AddStatusLast(Standard_True,N,PathPnt); CurrentLine->AddStatusLast(Standard_True,N,PathPnt);
AddPointInCurrentLine(N,PathPnt,CurrentLine); AddPointInCurrentLine(N,PathPnt,CurrentLine);
} }
} }
else if (Status == IntWalk_ArretSurPoint) { else if (Status == IntWalk_ArretSurPoint) {
if (wd2[I].etat >12) { //line should become open if (wd2[I].etat >12) { //line should become open
wd2[I].etat = 12; //declare it open wd2[I].etat = 12; //declare it open
Tgtbeg = Standard_True; Tgtbeg = Standard_True;
Tgtend = Standard_False; Tgtend = Standard_False;
N= -lines.Length()-1; N= -lines.Length()-1;
Psol.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2)); Psol.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2));
OpenLine(N,Psol,Pnts1,Func,CurrentLine); OpenLine(N,Psol,Pnts1,Func,CurrentLine);
StepSign = -1; StepSign = -1;
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(N); seqAjout.Append(N);
StatusPrecedent = IntWalk_OK; StatusPrecedent = IntWalk_OK;
Arrive = Standard_False; Arrive = Standard_False;
PasC = PasSav; PasC = PasSav;
} }
else { else {
Arrive = Standard_True; Arrive = Standard_True;
if (Ipass!=0) { //point of passage, point of stop if (Ipass!=0) { //point of passage, point of stop
PathPnt = Pnts1.Value(Ipass); PathPnt = Pnts1.Value(Ipass);
CurrentLine->AddStatusLast(Standard_True,Ipass,PathPnt); CurrentLine->AddStatusLast(Standard_True,Ipass,PathPnt);
AddPointInCurrentLine(Ipass,PathPnt,CurrentLine); AddPointInCurrentLine(Ipass,PathPnt,CurrentLine);
}
else {
CurrentLine->AddStatusLast(Standard_False);
IntSurf_PntOn2S newP;
newP.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2));
CurrentLine->AddPoint(newP);
Rajout = Standard_True;
seqAjout.Append(lines.Length()+1);
} }
} else {
} CurrentLine->AddStatusLast(Standard_False);
else if (Status == IntWalk_OK) { IntSurf_PntOn2S newP;
if (Ipass!=0) CurrentLine->AddIndexPassing(Ipass); newP.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2));
previousPoint.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2)); CurrentLine->AddPoint(newP);
previousd3d = Func.Direction3d(); Rajout = Standard_True;
previousd2d = Func.Direction2d(); seqAjout.Append(lines.Length()+1);
CurrentLine->AddPoint(previousPoint); }
} }
} }
} else if (Status == IntWalk_OK) {
else { //no numerical solution NotDone if (Ipass!=0) CurrentLine->AddIndexPassing(Ipass);
PasC = PasC/2.; previousPoint.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2));
PasCu = Abs(PasC*previousd2d.X()); previousd3d = Func.Direction3d();
PasCv = Abs(PasC*previousd2d.Y()); previousd2d = Func.Direction2d();
CurrentLine->AddPoint(previousPoint);
}
else if (Status == IntWalk_PointConfondu)
{
aNbIter --;
}
}
}
else { //no numerical solution NotDone
PasC = PasC/2.;
PasCu = Abs(PasC*previousd2d.X());
PasCv = Abs(PasC*previousd2d.Y());
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) { if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
if (CurrentLine->NbPoints() == 1) break; // cancel the line if (CurrentLine->NbPoints() == 1) break; // cancel the line
Arrive = Standard_True; Arrive = Standard_True;
CurrentLine->AddStatusFirstLast(Standard_False,Standard_False, CurrentLine->AddStatusFirstLast(Standard_False,Standard_False,
Standard_False); Standard_False);
Tgtend = Standard_True; Tgtend = Standard_True;
Rajout = Standard_True; Rajout = Standard_True;
seqAjout.Append(lines.Length()+1); seqAjout.Append(lines.Length()+1);
} }
} }
if(aNbIter < 0)
break;
}// end of started line }// end of started line
if (Arrive) { if (Arrive) {
CurrentLine->SetTangencyAtBegining(Tgtbeg); CurrentLine->SetTangencyAtBegining(Tgtbeg);
CurrentLine->SetTangencyAtEnd(Tgtend); CurrentLine->SetTangencyAtEnd(Tgtend);
lines.Append(CurrentLine); lines.Append(CurrentLine);
wd2[I].etat=-wd2[I].etat; //mark point as processed wd2[I].etat=-wd2[I].etat; //mark point as processed
} }
} //end of processing of start point } //end of processing of start point
} //end of all start points } //end of all start points

View File

@ -58,85 +58,83 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
//-- if epsilon is great enough (1e-11). In this case one loops //-- if epsilon is great enough (1e-11). In this case one loops
//-- without ever changing the values sent to Rsnld. //-- without ever changing the values sent to Rsnld.
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
Standard_Real Paramu, Paramv, StepU,StepV; Standard_Real Paramu = 0.0, Paramv = 0.0;
Standard_Real Cosi, Cosi2, Norme;
gp_Vec Corde(previousPoint.Value(), sp.Point());
Norme = Corde.SquareMagnitude();
// if (Norme <= epsilon*epsilon) {
if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // the square is already taken in the constructor
Status = IntWalk_PointConfondu;
if (StatusPrecedent == IntWalk_PasTropGrand) {
return IntWalk_ArretSurPointPrecedent;
}
if(++EpsilonSembleTropGrand > 5 && NbPointsConfondusConsecutifs == 8) { //-- Temporary
if(epsilon>0.00000000001) epsilon*=0.5; //-- Temporary
EpsilonSembleTropGrand = 0; //-- Temporary
}
}
else {
NbPointsConfondusConsecutifs = 0; //-- Temporary
EpsilonSembleTropGrand = 0; //-- Temporary
if(Norme<1e-16) Norme = 1e-16; //-- Temporary
Cosi = Corde * previousd3d;
if (Cosi*StepSign < 0.) { // angle 3d > pi/2 !!!!
Cosi2 = 0.;
}
else {
Cosi2 = Cosi * Cosi / previousd3d.SquareMagnitude() / Norme;
}
if (Cosi2 < CosRef3D) { //angle 3d too great
Step = Step /2.0;
StepU = Abs(Step*previousd2d.X());
StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPointPrecedent;
else
Status = IntWalk_PasTropGrand;
return Status;
}
}
if (!reversed) { if (!reversed) {
previousPoint.ParametersOnS2(Paramu, Paramv); previousPoint.ParametersOnS2(Paramu, Paramv);
} }
else { else
{
previousPoint.ParametersOnS1(Paramu, Paramv); previousPoint.ParametersOnS1(Paramu, Paramv);
} }
Standard_Real Du = UV(1) - Paramu;
Standard_Real Dv = UV(2) - Paramv; const Standard_Real Du = UV(1) - Paramu;
Standard_Real Duv = Du * Du + Dv * Dv; const Standard_Real Dv = UV(2) - Paramv;
const Standard_Real Duv = Du * Du + Dv * Dv;
gp_Vec Corde(previousPoint.Value(), sp.Point());
const Standard_Real Norme = Corde.SquareMagnitude(),
aTol = epsilon*Precision::PConfusion();
//if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // the square is already taken in the constructor
if ((Norme <= epsilon) && ((Duv <= aTol) || (StatusPrecedent != IntWalk_OK)))
{ // the square is already taken in the constructor
Status = IntWalk_PointConfondu;
if (StatusPrecedent == IntWalk_PasTropGrand) {
return IntWalk_ArretSurPointPrecedent;
}
}
else {
Standard_Real Cosi = Corde * previousd3d;
Standard_Real Cosi2 = 0.0;
if (Cosi*StepSign >= 0.) {// angle 3d <= pi/2 !!!!
const Standard_Real aDiv = previousd3d.SquareMagnitude()*Norme;
if(aDiv == 0)
return Status;
Cosi2 = Cosi * Cosi / aDiv;
}
if (Cosi2 < CosRef3D) { //angle 3d too great
Step = Step /2.0;
Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPointPrecedent;
else
Status = IntWalk_PasTropGrand;
return Status;
}
}
if (Abs(Du) < tolerance(1) && Abs(Dv) < tolerance(2)) if (Abs(Du) < tolerance(1) && Abs(Dv) < tolerance(2))
return IntWalk_ArretSurPointPrecedent; //confused point 2d return IntWalk_ArretSurPointPrecedent; //confused point 2d
Cosi = StepSign * (Du * previousd2d.X() +
Dv * previousd2d.Y()); Standard_Real Cosi = StepSign * (Du * previousd2d.X() + Dv * previousd2d.Y());
if (Cosi < 0 && Status == IntWalk_PointConfondu) if (Cosi < 0 && Status == IntWalk_PointConfondu)
return IntWalk_ArretSurPointPrecedent; // leave as step back return IntWalk_ArretSurPointPrecedent; // leave as step back
// with confused point // with confused point
if (sp.IsTangent()) if (sp.IsTangent())
return IntWalk_ArretSurPoint; return IntWalk_ArretSurPoint;
//if during routing one has subdivided more than MaxDivision for each //if during routing one has subdivided more than MaxDivision for each
//previous step, bug on the square; do nothing (experience U4) //previous step, bug on the square; do nothing (experience U4)
if (NbDivision < MaxDivision && if ((NbDivision < MaxDivision) && (Status != IntWalk_PointConfondu) &&
Status != IntWalk_PointConfondu && (StatusPrecedent!= IntWalk_PointConfondu))
StatusPrecedent!= IntWalk_PointConfondu ) { {
Cosi2 = Cosi * Cosi / Duv; Standard_Real Cosi2 = Cosi * Cosi / Duv;
if (Cosi2 < CosRef2D || Cosi < 0 ) { if (Cosi2 < CosRef2D || Cosi < 0 ) {
Step = Step / 2.0; Step = Step / 2.0;
StepU = Abs(Step*previousd2d.X()); Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y()); StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2)) if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPointPrecedent; Status = IntWalk_ArretSurPointPrecedent;
else else
Status = IntWalk_PasTropGrand; Status = IntWalk_PasTropGrand;
NbDivision = NbDivision + 1; NbDivision = NbDivision + 1;
return Status; return Status;
} }
@ -145,139 +143,149 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme; Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme;
if (Cosi2 < CosRef3D ){ //angle 3d too great if (Cosi2 < CosRef3D ){ //angle 3d too great
Step = Step / 2.; Step = Step / 2.;
StepU = Abs(Step*previousd2d.X()); Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y()); StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2)) if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPoint; Status = IntWalk_ArretSurPoint;
else else
Status = IntWalk_PasTropGrand; Status = IntWalk_PasTropGrand;
return Status; return Status;
} }
Cosi = Du * sp.Direction2d().X() + Cosi = Du * sp.Direction2d().X() +
Dv * sp.Direction2d().Y(); Dv * sp.Direction2d().Y();
Cosi2 = Cosi * Cosi / Duv; Cosi2 = Cosi * Cosi / Duv;
if (Cosi2 < CosRef2D || if (Cosi2 < CosRef2D ||
sp.Direction2d() * previousd2d < 0) { sp.Direction2d() * previousd2d < 0) {
//angle 2d too great or change the side //angle 2d too great or change the side
Step = Step / 2.; Step = Step / 2.;
StepU = Abs(Step*previousd2d.X()); Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y()); StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2)) if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPointPrecedent; Status = IntWalk_ArretSurPointPrecedent;
else else
Status = IntWalk_PasTropGrand; Status = IntWalk_PasTropGrand;
return Status; return Status;
} }
} }
if (!Finished) { if (!Finished) {
if (Status == IntWalk_PointConfondu)
if (Status == IntWalk_PointConfondu) { {
StepU = Min(Abs(1.5 * Du),pas*(UM-Um)); Standard_Real StepU = Min(Abs(1.5 * Du),pas*(UM-Um)),
StepV = Min(Abs(1.5 * Dv),pas*(VM-Vm)); StepV = Min(Abs(1.5 * Dv),pas*(VM-Vm));
Standard_Real d2dx = Abs(previousd2d.X()); Standard_Real d2dx = Abs(previousd2d.X());
Standard_Real d2dy = Abs(previousd2d.Y()); Standard_Real d2dy = Abs(previousd2d.Y());
if (d2dx < tolerance(1)) { if (d2dx < tolerance(1))
Step = StepV/d2dy; {
Step = StepV/d2dy;
} }
else if (d2dy < tolerance(2)) { else if (d2dy < tolerance(2))
Step = StepU/d2dx; {
Step = StepU/d2dx;
} }
else { else
Step = Min(StepU/d2dx,StepV/d2dy); {
Step = Min(StepU/d2dx,StepV/d2dy);
} }
} }
else { else
// estimate the current vector. {
// if vector/2<=current vector<= vector it is considered that the criterion // estimate the current vector.
// is observed. // if vector/2<=current vector<= vector it is considered that the criterion
// otherwise adjust the step depending on the previous step // is observed.
// otherwise adjust the step depending on the previous step
/* /*
Standard_Real Dist = Sqrt(Norme)/3.; Standard_Real Dist = Sqrt(Norme)/3.;
TColgp_Array1OfPnt Poles(1,4); TColgp_Array1OfPnt Poles(1,4);
gp_Pnt POnCurv,Milieu; gp_Pnt POnCurv,Milieu;
Poles(1) = previousPoint.Value(); Poles(1) = previousPoint.Value();
Poles(4) = sp.Point(); Poles(4) = sp.Point();
Poles(2) = Poles(1).XYZ() + Poles(2) = Poles(1).XYZ() +
StepSign * Dist* previousd3d.Normalized().XYZ(); StepSign * Dist* previousd3d.Normalized().XYZ();
Poles(3) = Poles(4).XYZ() - Poles(3) = Poles(4).XYZ() -
StepSign * Dist*sp.Direction3d().Normalized().XYZ(); StepSign * Dist*sp.Direction3d().Normalized().XYZ();
BzCLib::PntPole(0.5,Poles,POnCurv); BzCLib::PntPole(0.5,Poles,POnCurv);
Milieu = (Poles(1).XYZ() + Poles(4).XYZ())*0.5; Milieu = (Poles(1).XYZ() + Poles(4).XYZ())*0.5;
// FlecheCourante = Milieu.Distance(POnCurv); // FlecheCourante = Milieu.Distance(POnCurv);
Standard_Real FlecheCourante = Milieu.SquareDistance(POnCurv); Standard_Real FlecheCourante = Milieu.SquareDistance(POnCurv);
*/ */
// Direct calculation : // Direct calculation :
// POnCurv=(((p1+p2)/2.+(p2+p3)/2.)/2. + ((p2+p3)/2.+(p3+P4)/2.)/2.)/2. // POnCurv=(((p1+p2)/2.+(p2+p3)/2.)/2. + ((p2+p3)/2.+(p3+P4)/2.)/2.)/2.
// either POnCurv = p1/8. + 3.p2/8. + 3.p3/8. + p4/8. // either POnCurv = p1/8. + 3.p2/8. + 3.p3/8. + p4/8.
// Or p2 = p1 + lambda*d1 et p3 = p4 - lambda*d4 // Or p2 = p1 + lambda*d1 et p3 = p4 - lambda*d4
// So POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8. // So POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8.
// Calculate the deviation with (p1+p4)/2. . So it is just necessary to calculate // Calculate the deviation with (p1+p4)/2. . So it is just necessary to calculate
// the norm (square) of 3.*lambda (d1 - d4)/8. // the norm (square) of 3.*lambda (d1 - d4)/8.
// either the norm of : // either the norm of :
// 3.*(Sqrt(Norme)/3.)*StepSign*(d1-d4)/8. // 3.*(Sqrt(Norme)/3.)*StepSign*(d1-d4)/8.
// which produces, takin the square : // which produces, takin the square :
// Norme * (d1-d4).SquareMagnitude()/64. // Norme * (d1-d4).SquareMagnitude()/64.
Standard_Real FlecheCourante = Standard_Real FlecheCourante =
(previousd3d.Normalized().XYZ()-sp.Direction3d().Normalized().XYZ()).SquareModulus()*Norme/64.; (previousd3d.Normalized().XYZ()-sp.Direction3d().Normalized().XYZ()).SquareModulus()*Norme/64.;
// if (FlecheCourante <= 0.5*fleche) { // if (FlecheCourante <= 0.5*fleche) {
if (FlecheCourante <= 0.25*fleche*fleche) { if (FlecheCourante <= 0.25*fleche*fleche)
{
Standard_Real d2dx = Abs(sp.Direction2d().X());
Standard_Real d2dy = Abs(sp.Direction2d().Y());
Standard_Real d2dx = Abs(sp.Direction2d().X()); Standard_Real StepU = Min(Abs(1.5*Du),pas*(UM-Um)),
Standard_Real d2dy = Abs(sp.Direction2d().Y()); StepV = Min(Abs(1.5*Dv),pas*(VM-Vm));
StepU = Min(Abs(1.5*Du),pas*(UM-Um));
StepV = Min(Abs(1.5*Dv),pas*(VM-Vm));
if (d2dx < tolerance(1)) {
Step = StepV/d2dy;
}
else if (d2dy < tolerance(2)) {
Step = StepU/d2dx;
}
else {
Step = Min(StepU/d2dx,StepV/d2dy);
}
if (d2dx < tolerance(1))
{
Step = StepV/d2dy;
}
else if (d2dy < tolerance(2))
{
Step = StepU/d2dx;
}
else
{
Step = Min(StepU/d2dx,StepV/d2dy);
}
} }
else { else
// if (FlecheCourante > fleche) { // step too great {
if (FlecheCourante > fleche*fleche) { // step too great //if (FlecheCourante > fleche) { // step too great
Step = Step /2.; if (FlecheCourante > fleche*fleche)
StepU = Abs(Step*previousd2d.X()); { // step too great
StepV = Abs(Step*previousd2d.Y()); Step = Step /2.;
Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2)) if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPointPrecedent; Status = IntWalk_ArretSurPointPrecedent;
else else
Status = IntWalk_PasTropGrand; Status = IntWalk_PasTropGrand;
} }
else { else
Standard_Real d2dx = Abs(sp.Direction2d().X()); {
Standard_Real d2dy = Abs(sp.Direction2d().Y()); Standard_Real d2dx = Abs(sp.Direction2d().X());
Standard_Real d2dy = Abs(sp.Direction2d().Y());
StepU = Min(Abs(1.5*Du),pas*(UM-Um)); Standard_Real StepU = Min(Abs(1.5*Du),pas*(UM-Um)),
StepV = Min(Abs(1.5*Dv),pas*(VM-Vm)); StepV = Min(Abs(1.5*Dv),pas*(VM-Vm));
if (d2dx < tolerance(1)) { if (d2dx < tolerance(1))
Step = Min(Step,StepV/d2dy); {
} Step = Min(Step,StepV/d2dy);
else if (d2dy < tolerance(2)) { }
Step = Min(Step,StepU/d2dx); else if (d2dy < tolerance(2))
} {
else { Step = Min(Step,StepU/d2dx);
Step = Min(Step,Min(StepU/d2dx,StepV/d2dy)); }
} else
} {
Step = Min(Step,Min(StepU/d2dx,StepV/d2dy));
}
}
} }
} }
} }

View File

@ -501,7 +501,7 @@ STATIC_PRECEDENT_INFLEXION(0)
} }
else { else {
Standard_Real t = VM2-Vm2; Standard_Real t = VM2-Vm2;
if(t<ThePSurfaceTool::UPeriod(Caro2)) { if(t<ThePSurfaceTool::VPeriod(Caro2)) {
t=0.5*(ThePSurfaceTool::VPeriod(Caro2)-t); t=0.5*(ThePSurfaceTool::VPeriod(Caro2)-t);
t=(t>KELARG*pasuv[3])? KELARG*pasuv[3] : t; t=(t>KELARG*pasuv[3])? KELARG*pasuv[3] : t;
VM2+=t; VM2+=t;

View File

@ -1,8 +1,6 @@
puts "TODO #22911 ALL: Error : The area of the resulting shape is"
restore [locate_data_file CTO908_topo104-o1.brep] wheel restore [locate_data_file CTO908_topo104-o1.brep] wheel
restore [locate_data_file CTO908_topo104-o2.brep] jante restore [locate_data_file CTO908_topo104-o2.brep] jante
bfuse result wheel jante bfuse result wheel jante
set square 0 set square 40059.9

View File

@ -1,8 +1,6 @@
puts "TODO #22911 ALL: Error : The area of the resulting shape is"
restore [locate_data_file CTO908_topo106-p.brep] poche restore [locate_data_file CTO908_topo106-p.brep] poche
restore [locate_data_file CTO908_topo106-n.brep] nervure restore [locate_data_file CTO908_topo106-n.brep] nervure
bfuse result poche nervure bfuse result poche nervure
set square 0 set square 108943

View File

@ -1,6 +1,4 @@
# cts17861 # cts17861
#puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO #22911 ALL: Error : The area of the resulting shape is"
restore [locate_data_file CTO900_cts17861a.rle] a restore [locate_data_file CTO900_cts17861a.rle] a
restore [locate_data_file cts17861b.rle] b restore [locate_data_file cts17861b.rle] b
@ -10,4 +8,4 @@ fsameparameter b
bfuse result a b bfuse result a b
set square 0 set square 406803

View File

@ -1,9 +1,7 @@
puts "TODO #22911 ALL: Error : The area of the resulting shape is"
restore [locate_data_file a102] a restore [locate_data_file a102] a
restore [locate_data_file b136] b restore [locate_data_file b136] b
bop a b bop a b
boptuc result boptuc result
set square 0 set square 9741.13

View File

@ -16,5 +16,5 @@ repeat 100 {
compound s_$i result result compound s_$i result result
incr i incr i
} }
set length 3961.04 set length 3854.34
set 2dviewer 0 set 2dviewer 0

View File

@ -10,7 +10,7 @@ pload QAcommands
restore [locate_data_file bug23952_s1.draw] a restore [locate_data_file bug23952_s1.draw] a
restore [locate_data_file bug23952_s2.draw] b restore [locate_data_file bug23952_s2.draw] b
set NbLines 5 set NbLines 6
set info [OCC23952intersect $NbLines a b] set info [OCC23952intersect $NbLines a b]
if { [regexp "theNbSol: OK" $info] != 1 } { if { [regexp "theNbSol: OK" $info] != 1 } {

View File

@ -0,0 +1,82 @@
puts "========="
puts "OCC24612"
puts "========="
puts ""
###########################################################
# Wrong pcurve of the section curve
###########################################################
set MaxTol 5.0e-7
set NbCurv_OK 1
restore [locate_data_file bug24612_b1.brep] b1
restore [locate_data_file bug24612_b2.brep] b2
mksurface s1 b1
bounds s1 U1f_exp U1l_exp V1f_exp V1l_exp
dval U1f_exp
dval U1l_exp
dval V1f_exp
dval V1l_exp
set log [bopcurves b1 b2 -2d]
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
if {${NbCurv} != ${NbCurv_OK}} {
puts "Error: ${NbCurv_OK} curve(s) expected, but ${NbCurv} found."
}
if {${Toler} > ${MaxTol}} {
puts "Error: Tolerance is too big!"
}
#Theoretically, c2d1_1 must cover V-diapason of surface s1 fully.
set log [dump c2d1_1]
regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
puts "Degree=${Degree}"
puts "Poles=${Poles}"
puts "KnotsPoles=${KnotsPoles}"
puts ""
set Pole 1
set exp_string " +${Pole} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)"
regexp ${exp_string} ${log} full U_begin V_begin
puts "Pole=${Pole}"
puts "U_begin=${U_begin}"
puts "V_begin=${V_begin}"
dset V_begin ${V_begin}
puts ""
set Pole ${Poles}
set exp_string " +${Pole} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)"
regexp ${exp_string} ${log} full U_end V_end
puts "Pole=${Pole}"
puts "U_end=${U_end}"
puts "V_end=${V_end}"
dset V_end ${V_end}
puts ""
set delta_f [dval V1l_exp-V_begin]
#ATTENTION!!! V_begin must be strictly equal V1l_exp (without any tolerance)
if {${delta_f} != 0} {
puts "Error: Bad value. V_begin = [dval V_begin], Vlast = [dval V1l_exp]."
} else {
puts "OK: Good value. V_begin matches with Vlast of surface."
}
puts ""
set delta_l [dval V1f_exp-V_end]
#ATTENTION!!! V_end must be strictly equal V1f_exp (without any tolerance)
if {${delta_l} != 0} {
puts "Error: Bad value. V_end = [dval V_end], Vfirst = [dval V1f_exp]."
} else {
puts "OK: Good value. V_end matches with Vfirst of surface."
}

View File

@ -7,8 +7,6 @@ puts ""
## It is impossible to intersect two surfaces ## It is impossible to intersect two surfaces
################################################## ##################################################
puts "TODO OCC24472 ALL: Error : Intersection was made WRONGLY"
restore [locate_data_file OCC13-1.draw] su1 restore [locate_data_file OCC13-1.draw] su1
############### checkshape su1 # is not a topological shape ############### checkshape su1 # is not a topological shape
restore [locate_data_file OCC13-2.draw] su2 restore [locate_data_file OCC13-2.draw] su2
@ -27,9 +25,9 @@ set nom 0
set err1 [lindex $che1 [expr [llength $che1] - 2]] set err1 [lindex $che1 [expr [llength $che1] - 2]]
if { $err != "curve" && $err1 != "3d"} { if { $err != "curve" && $err1 != "3d"} {
break break
} else { } else {
set nom [expr $nom + 1] set nom [expr $nom + 1]
} }
incr j} incr j}
if { $nom == 0} { if { $nom == 0} {

View File

@ -2,10 +2,6 @@ restore [locate_data_file cylindre.rle] cyl
restore [locate_data_file contour.rle] cont restore [locate_data_file contour.rle] cont
mkplane cont cont mkplane cont cont
nexplode cyl F nexplode cyl F
puts "*"
#puts "TODO OCC22810 All:Faulty .*"
puts "TODO OCC22810 ALL:Error : The area of the resulting shape is"
ttranslate cont 0 0 -100 ttranslate cont 0 0 -100
# #
@ -18,4 +14,4 @@ if { [catch { featperform prism result face face } ] != 0 } {
puts "Error in featperform" puts "Error in featperform"
} }
set square 0 set square 82351.1