+// Copyright (c) 1995-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and / or modify it
+// under the terms of the GNU Lesser General Public version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
//-----------------------------
//-- IntWalk_PWalking_1.gxx
//--
//==================================================================================
// function : IntWalk_PWalking::IntWalk_PWalking
// purpose :
-// estimation des max pas : Pour eviter des changenets
-// trop brusques lors des changements d isos
+// estimate of max step : To avoid abrupt changes
+// during change of isos
//==================================================================================
void ComputePasInit(Standard_Real *pasuv,
Standard_Real Um1,Standard_Real UM1,
Standard_Real _du2=Abs(_UM2-_Um2);
Standard_Real _dv2=Abs(_VM2-_Vm2);
- //-- On limite la reduction de l estimation de la boite uv a 0.01 la boite naturelle
- //-- du1 : Sur boite des Inter
- //-- _du1 : Sur espace parametrique
+ //-- limit the reduction of uv box estimate to 0.01 natural box
+ //-- du1 : On box of Inter
+ //-- _du1 : On parametric space
if(_du1<1e50 && du1<0.01*_du1) du1=0.01*_du1;
if(_dv1<1e50 && dv1<0.01*_dv1) dv1=0.01*_dv1;
if(_du2<1e50 && du2<0.01*_du2) du2=0.01*_du2;
fleche(Deflection),
tolconf(Epsilon),
sensCheminement(1),
- myIntersectionOn2S(Caro1,Caro2,TolTangency)
+ myIntersectionOn2S(Caro1,Caro2,TolTangency),
+ STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
+ STATIC_PRECEDENT_INFLEXION(0)
{
Standard_Real KELARG=20.;
//
- pasMax=Increment*0.2; //-- le 25 juin 99 suite a des pbs de precision
+ pasMax=Increment*0.2; //-- June 25 99 after problems with precision
Um1 = ThePSurfaceTool::FirstUParameter(Caro1);
Vm1 = ThePSurfaceTool::FirstVParameter(Caro1);
UM1 = ThePSurfaceTool::LastUParameter(Caro1);
if(ThePSurfaceTool::IsUPeriodic(Caro1)==Standard_False) {
- UM1+=KELARG*pasuv[0]; Um1-=KELARG*pasuv[0];
+ //UM1+=KELARG*pasuv[0]; Um1-=KELARG*pasuv[0];
}
else {
Standard_Real t = UM1-Um1;
}
if(ThePSurfaceTool::IsVPeriodic(Caro1)==Standard_False) {
- VM1+=KELARG*pasuv[1]; Vm1-=KELARG*pasuv[1];
+ //VM1+=KELARG*pasuv[1]; Vm1-=KELARG*pasuv[1];
}
else {
Standard_Real t = VM1-Vm1;
}
if(ThePSurfaceTool::IsUPeriodic(Caro2)==Standard_False) {
- UM2+=KELARG*pasuv[2]; Um2-=KELARG*pasuv[2];
+ //UM2+=KELARG*pasuv[2]; Um2-=KELARG*pasuv[2];
}
else {
Standard_Real t = UM2-Um2;
}
if(ThePSurfaceTool::IsVPeriodic(Caro2)==Standard_False) {
- VM2+=KELARG*pasuv[3]; Vm2-=KELARG*pasuv[3];
+ //VM2+=KELARG*pasuv[3]; Vm2-=KELARG*pasuv[3];
}
else {
Standard_Real t = VM2-Vm2;
fleche(Deflection),
tolconf(Epsilon),
sensCheminement(1),
- myIntersectionOn2S(Caro1,Caro2,TolTangency)
+ myIntersectionOn2S(Caro1,Caro2,TolTangency),
+ STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
+ STATIC_PRECEDENT_INFLEXION(0)
{
Standard_Real KELARG=20.;
//
- pasMax=Increment*0.2; //-- le 25 juin 99 suite a des pbs de precision
+ pasMax=Increment*0.2; //-- June 25 99 after problems with precision
//
Um1 = ThePSurfaceTool::FirstUParameter(Caro1);
Vm1 = ThePSurfaceTool::FirstVParameter(Caro1);
close = Standard_False;
//
Standard_Integer i;
- Standard_Real aTmp;
TColStd_Array1OfReal Param(1,4);
//
for (i=1; i<=4; ++i) {
- aTmp = ParDep(i);
Param(i) = ParDep(i);
}
- //-- calcul du premier point solution
+ //-- calculate the first solution point
math_FunctionSetRoot Rsnld(myIntersectionOn2S.Function());
//
myIntersectionOn2S.Perform(Param,Rsnld);
if (!myIntersectionOn2S.IsDone()) {
return Standard_False;
}
+
if (myIntersectionOn2S.IsEmpty()) {
return Standard_False;
}
+
FirstPoint = myIntersectionOn2S.Point();
return Standard_True;
}
const Standard_Real v2max)
{
//xf
- Standard_Integer iCnt=0;
Standard_Integer i, NbPasOKConseq;
Standard_Real UFirst1, VFirst1, ULast1, VLast1, UFirst2, VFirst2, ULast2, VLast2;
- Standard_Real pasMaxSV[4], aTmp;
TColStd_Array1OfReal Param(1,4);
IntImp_ConstIsoparametric ChoixIso;
//xt
line = new IntSurf_LineOn2S ();
//
for (i=1; i<=4; ++i) {
- aTmp=ParDep(i);
Param(i)=ParDep(i);
}
- //-- reprise des pas uv lies aux surfaces Caro1 et Caro2
- //-- pasuv[] et pasSav[] sont modifies lors du cheminement
+ //-- reproduce steps uv connected to surfaces Caro1 and Caro2
+ //-- pasuv[] and pasSav[] are modified during the marching
for(i = 0; i < 4; ++i) {
- pasMaxSV[i] = pasSav[i] = pasuv[i] = pasInit[i];
+ pasSav[i] = pasuv[i] = pasInit[i];
}
- //-- calcul du premier point solution
+ //-- calculate the first solution point
math_FunctionSetRoot Rsnld(myIntersectionOn2S.Function());
//
ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld);
tgfirst = tglast = Standard_False;
choixIsoSav = ChoixIso;
//------------------------------------------------------------
- //-- On Teste si le premier point de cheminement correspond
- //-- a un point sur frontiere.
- //-- Dans ce cas, DejaReparti est initialise a True
+ //-- Test if the first point of marching corresponds
+ //-- to a point on borders.
+ //-- In this case, DejaReparti is initialized as True
//--
pf = previousPoint.Value();
Standard_Boolean bTestFirstPoint = Standard_True;
ChoixIso= myIntersectionOn2S.Perform(Param, Rsnld, ChoixIso);
//
if (!myIntersectionOn2S.IsDone()) {
- //arret de la ligne,division
+ //end of line, division
Arrive = Standard_False;
Param(1)=SvParam[0];
Param(2)=SvParam[1];
RepartirOuDiviser(DejaReparti, ChoixIso, Arrive);
}
else {//009
- //== Le calcul du point exact a partir de Param(.) est possible
+ //== Calculation of exact point from Param(.) is possible
if (myIntersectionOn2S.IsEmpty()) {
Standard_Real u1,v1,u2,v2;
previousPoint.Parameters(u1,v1,u2,v2);
}
else {//008
//============================================================
- //== Un point a ete trouve : T E S T D E F L E C T I O N
+ //== A point has been found : T E S T D E F L E C T I O N
//============================================================
if(NoTestDeflection) {
NoTestDeflection = Standard_False;
case IntWalk_OK:
case IntWalk_ArretSurPoint: {//006
//=======================================================
- //== T e s t A r r e t : Cadrage sur Param(.) ==
+ //== Stop Test t : Frame on Param(.) ==
//=======================================================
//xft arrive here
Arrive = TestArret(DejaReparti,Param,ChoixIso);
if(Arrive==Standard_False && Status==IntWalk_ArretSurPoint) {
Arrive=Standard_True;
#ifdef DEB
- cout << "Compile avec option DEB :Si Pb d intersection : ";
+ cout << "Compile with option DEB : if problems with intersection : ";
cout << "IntWalk_PWalking_1.gxx (lbr le 1erdec98)"<<endl;
#endif
}
}
if(!Arrive) {//005
//=====================================================
- //== Param(.) est dans les bornes ==
- //== et ne finit pas une ligne fermee ==
+ //== Param(.) is in the limits ==
+ //== and does not end a closed line ==
//=====================================================
- //== Verification sur Le Point Courant de myInters
+ //== Check on the current point of myInters
Standard_Boolean pointisvalid = Standard_False;
{
Standard_Real u1,v1,u2,v2;
previousd2 = myIntersectionOn2S.DirectionOnS2();
}
//=====================================================
- //== Verification sur Previous Point
+ //== Check on the previous Point
{
Standard_Real u1,v1,u2,v2;
previousPoint.Parameters(u1,v1,u2,v2);
}
else {//$$$
//====================================================
- //== Param n etait pas dans les bornes (a ete recadre)
+ //== Param was not in the limits (was reframed)
//====================================================
Standard_Boolean bPrevNotTangent = !previoustg || !myIntersectionOn2S.IsTangent();
ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld,ChoixIso);
//
if(!myIntersectionOn2S.IsEmpty()) { //002
- // debordement sur le carreau reciproque ou intersection en coin
+ // mutially outpasses in the square or intersection in corner
if(TestArret(Standard_True,Param,ChoixIso)) {
NbPasOKConseq = -10;
ChoixIso = myIntersectionOn2S.Perform(Param,Rsnld,ChoixIso);
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
}
else {
- //echec cadrage diviser le pas
+ //fail framing divides the step
Arrive = Standard_False;
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
NoTestDeflection = Standard_True;
previousd2 = myIntersectionOn2S.DirectionOnS2();
}
//========================================
- //== Verification sur PreviousPoint @@
+ //== Check on PreviousPoint @@
{
Standard_Real u1,v1,u2,v2;
- previousPoint.Parameters(u1,v1,u2,v2);
+ previousPoint.Parameters(u1,v1,u2,v2);
+ //To save initial 2d points
+ gp_Pnt2d ParamPntOnS1(Param(1), Param(2));
+ gp_Pnt2d ParamPntOnS2(Param(3), Param(4));
+ ///////////////////////////
Param(1) = u1;
Param(2) = v1;
Param(3) = u2;
bTestFirstPoint = Standard_False;
}
}
+ //To avoid walking around the same point
+ //in the tangent zone near a border
+ if (previoustg)
+ {
+ Standard_Real prevU1, prevV1, prevU2, prevV2;
+ previousPointSave.Parameters(prevU1, prevV1, prevU2, prevV2);
+ gp_Pnt2d prevPntOnS1(prevU1, prevV1), prevPntOnS2(prevU2, prevV2);
+ gp_Pnt2d curPntOnS1(u1, v1), curPntOnS2(u2, v2);
+ gp_Vec2d PrevToParamOnS1(prevPntOnS1, ParamPntOnS1);
+ gp_Vec2d PrevToCurOnS1(prevPntOnS1, curPntOnS1);
+ gp_Vec2d PrevToParamOnS2(prevPntOnS2, ParamPntOnS2);
+ gp_Vec2d PrevToCurOnS2(prevPntOnS2, curPntOnS2);
+ Standard_Real MaxAngle = 3*M_PI/4;
+ if (Abs(PrevToParamOnS1.Angle(PrevToCurOnS1)) > MaxAngle &&
+ Abs(PrevToParamOnS2.Angle(PrevToCurOnS2)) > MaxAngle)
+ {
+ Arrive = Standard_True;
+ break;
+ }
+ }
+ ////////////////////////////////////////
AddAPoint(line,previousPoint);
RejectIndex++;
if(RejectIndex >= 250000) {
}
}
}//else !TestArret() $
- } //$$ fin succes cadrage sur frontiere (!myIntersectionOn2S.IsEmpty())
+ } //$$ end successful framing on border (!myIntersectionOn2S.IsEmpty())
else {
- //echec cadrage sur frontiere;division du pas
+ //echec framing on border; division of step
Arrive = Standard_False;
NoTestDeflection = Standard_True;
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
}
- }//$$$ fin cadrage sur frontiere (!close)
- } //004 fin TestArret retourne Arrive = True
- } // 006case IntWalk_ArretSurPoint: fin Traitement Status = OK ou ArretSurPoint
+ }//$$$ end framing on border (!close)
+ } //004 fin TestArret return Arrive = True
+ } // 006case IntWalk_ArretSurPoint: end Processing Status = OK or ArretSurPoint
} //007 switch(Status)
- } //008 fin traitement point en court (TEST DEFLECTION)
- } //009 fin traitement ligne (else if myIntersectionOn2S.IsDone())
- } //010 fin si premier point de depart a permis un cheminement while(!Arrive)
+ } //008 end processing point (TEST DEFLECTION)
+ } //009 end processing line (else if myIntersectionOn2S.IsDone())
+ } //010 end if first departure point allows marching while (!Arrive)
done = Standard_True;
}
// ===========================================================================================================