const Handle(Adaptor3d_HSurface)& Surf2,
IntPatch_SequenceOfLine& aSLin);
+static
+ IntSurf_PntOn2S MakeNewPoint(const IntSurf_PntOn2S& replacePnt,
+ const IntSurf_PntOn2S& oldPnt,
+ const Standard_Real* Periods);
+
static Standard_Boolean IsPointOnLine(const IntSurf_PntOn2S &thePOn2S,
const Handle(IntPatch_WLine) &theWLine,
const Standard_Real Deflection);
VminLig2 = Surf2->FirstVParameter();
UmaxLig2 = Surf2->LastUParameter();
VmaxLig2 = Surf2->LastVParameter();
+
+ Standard_Real Periods [4];
+ Periods[0] = (Surf1->IsUPeriodic())? Surf1->UPeriod() : 0.;
+ Periods[1] = (Surf1->IsVPeriodic())? Surf1->VPeriod() : 0.;
+ Periods[2] = (Surf2->IsUPeriodic())? Surf2->UPeriod() : 0.;
+ Periods[3] = (Surf2->IsVPeriodic())? Surf2->VPeriod() : 0.;
IntSurf_ListIteratorOfListOfPntOn2S IterLOP1(LOfPnts);
Standard_Integer iP;
for( iP = 1; iP <= cNbP; iP++) {
if( pI == iP )
- newL2s->Add(replacePnt);
+ {
+ IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods);
+ newL2s->Add(newPnt);
+ }
else if(removeNext && iP == (pI + 1))
continue;
else if(removePrev && iP == (pI - 1))
}//for (j=0; j<1; ++j) {
}//for (i=1; i<=aNbLines; ++i)
}
+
+//==================================================================================
+// function : MakeNewPoint
+// purpose :
+//==================================================================================
+IntSurf_PntOn2S MakeNewPoint(const IntSurf_PntOn2S& replacePnt,
+ const IntSurf_PntOn2S& oldPnt,
+ const Standard_Real* Periods)
+{
+ IntSurf_PntOn2S NewPoint;
+ NewPoint.SetValue(replacePnt.Value());
+
+ Standard_Real OldParams[4], NewParams[4];
+ oldPnt.Parameters(OldParams[0], OldParams[1], OldParams[2], OldParams[3]);
+ replacePnt.Parameters(NewParams[0], NewParams[1], NewParams[2], NewParams[3]);
+
+ Standard_Integer i;
+ for (i = 0; i < 4; i++)
+ if (Periods[i] != 0.)
+ {
+ if (Abs(NewParams[i] - OldParams[i]) >= 0.5*Periods[i])
+ {
+ if (NewParams[i] < OldParams[i])
+ NewParams[i] += Periods[i];
+ else
+ NewParams[i] -= Periods[i];
+ }
+ }
+
+ NewPoint.SetValue(NewParams[0], NewParams[1], NewParams[2], NewParams[3]);
+ return NewPoint;
+}
+
//==================================================================================
// function : Perform
// purpose : base SS Int. function
D1->VParameters(aVpars1);
D2->UParameters(anUpars2);
D2->VParameters(aVpars2);
+
+ Standard_Real Periods [4];
+ Periods[0] = (Surf1->IsUPeriodic())? Surf1->UPeriod() : 0.;
+ Periods[1] = (Surf1->IsVPeriodic())? Surf1->VPeriod() : 0.;
+ Periods[2] = (Surf2->IsUPeriodic())? Surf2->UPeriod() : 0.;
+ Periods[3] = (Surf2->IsVPeriodic())? Surf2->VPeriod() : 0.;
+
//---------------------------------------------
Limit = 2500;
if((NbU1*NbV1<=Limit && NbV2*NbU2<=Limit)) {
Standard_Integer iP;
for( iP = 1; iP <= cNbP; iP++) {
if( pI == iP )
- newL2s->Add(replacePnt);
+ {
+ IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods);
+ newL2s->Add(newPnt);
+ }
else if(removeNext && iP == (pI + 1))
continue;
else if(removePrev && iP == (pI - 1))
package IntWalk
- ---Purpose: This package defines the "walking" (marching?)algorithmes
+ ---Purpose: This package defines the "walking" (marching) algorithmes
-- for the intersection between two surfaces.
-- One of the surfaces is a parametric one.
-- If the other is an implicit one, the "IWalking" class will
enumeration StatusDeflection is
PasTropGrand, PointConfondu, ArretSurPointPrecedent,
ArretSurPoint, OK;
+
+-- StepTooGreat, ConfusedPoint, StopOnPreviousPoint, StopOnPoint, OK
--- classe definition ressource sur surface biparametree
+-- class for definition of ressources on a biparametric surface
deferred generic class PSurfaceTool;
--- classes de definition pour algorithme cheminement sur une
--- surface biparametree
+-- classes for definition of marching algorithm on a
+-- biparametric surface
deferred generic class PathPointTool;
generic class Iterator;
---classes des objets resultat pour cheminement sur surface bi-parametree
+--class of result objects marching on a biparametric surface
generic class IWLine;
---algorithme cheminement/resolution
+--algorithm marching/solution
generic class IWalking, TheIWLine, SequenceOfIWLine;
---Purpose: Defines a dynamic vector of integer.
---algorithme/resolution pour un cheminement sur intersection entre
--- 2 surfaces biparametrees
+--algorithm/solution for a marching on intersection between
+-- 2 biparametric surfaces
generic class PWalking, TheInt2S;
-- consecutive points on a resulting polyline.
-- Step is the maximum increment admitted between two
-- consecutive points (in 2d space).
- -- Epsilon est la tolerance au dela de laquelle 2 points
- -- sont confondus
+ -- Epsilon is the tolerance beyond which 2 points
+ -- are confused.
returns IWalking from IntWalk;
-- consecutive points on a resulting polyline.
-- Step is the maximum increment admitted between two
-- consecutive points (in 2d space).
- -- Epsilon est la tolerance au dela de laquelle 2 points
- -- sont confondus
+ -- Epsilon is the tolerance beyond which 2 points
+ -- are confused
---C++: inline
}
// ***************************************************************************
- // etat1=12 pas tangent,pas passant
- // etat1=11 tangent,pas passant
- // etat1=2 pas tangent,passant
- // etat1=1 tangent,passant
- // lorsque un point a ete traite son etat devient negatif.
+ // etat1=12 not tangent, not passes
+ // etat1=11 tangent, not passes
+ // etat1=2 not tangent, passes
+ // etat1=1 tangent, passes
+ // after a point is processed its state becomes negative.
// ***************************************************************************
- // etat2=13 point de demarage interieur sur ligne ferme
- // etat2=12 point de demarage interieur sur ligne ouverte
- // (ligne initialement fermee -> la ligne s est ouverte)
- // lorsque un point a ete traite (ou si on passe dessus lors du
- // cheminement) son etat devient negatif.
+ // etat2=13 interior start point on closed line
+ // etat2=12 interior start point on open line
+ // (line initially closed -> la line s is open)
+ // after a point is processed (or if it is passed over during
+ // routing) its state becomes negative.
// ****************************************************************************
//
-// Perform avec points interieurs
+// Perform with interior points
//
void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
const ThePOLIterator& Pnts2,
reversed = Reversed;
- // Chargement de etat1 et etat2 et des ustart et vstart.
+ // Loading of etat1 and etat2 as well as ustart and vstart.
TColStd_SequenceOfReal Umult;
TColStd_SequenceOfReal Vmult;
if (!ThePointOfPathTool::IsTangent(PathPnt))
++aWD1.etat;
- if(aWD1.etat==2) { //-- lbr le 15 fev 99
+ if(aWD1.etat==2) {
aWD1.etat=11;
}
Func.Set(Caro);
- // calcul de toutes les lignes ouvertes
+ // calculation of all open lines
if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
- // calcul de toutes les lignes fermees
+ // calculation of all closed lines
if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
for (I = 1; I <= nbPnts1; I++) {
if (wd1[I].etat >0) seqSingle.Append(Pnts1(I));
//
-// Perform sans point interieur
+// Perform without interior point
//
void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
reversed = Reversed;
- // Chargement de etat1 et de ustart1 et vstart1.
+ // Loading of etat1 as well as ustart1 and vstart1.
TColStd_SequenceOfReal Umult;
TColStd_SequenceOfReal Vmult;
// _______________________________________________
//
-// Cadrage d un point (u, v) dans le domaine naturel d une surface ET mise
-// a jour du couple (u, v) pour le calcul du point suivant.
+// Location of point (u, v) in the natural domain of a surface AND update
+// of couple (u, v) for the calculation of the next point.
//
Standard_Boolean IntWalk_IWalking::Cadrage
(math_Vector& BornInf,
// Standard_Real& StepV,
const Standard_Integer StepSign) const
-// on a toujours :
+// there are always :
// BorInf(1) <= UVap(1) <= BornSup(1) et BorInf(2) <= UVap(2) <= BornSup(2)
-// 1) on verifier si le point approche ne depasse pas le domaine naturel de
-// la surface
-// 2) si c est le cas on cadre le point approche sur frontiere en prenant la
-// meilleure direction. On MODIFIE alors le pas d avancement et une des
-// bornes bloquer un des parametres lors du prochain appel a FunctionSetRoot;
-// 3) on recalcule couple (u, v) approche pour le le calcul du point suivant.
-// 4) return Standard_True si cadrage, Standard_False si pas de cadrage.
+// 1) check if the process point is out of the natural domain of the surface.
+// 2) if yes the approximated point is located on border taking the best direction
+// the step and a limit blocating one of the parameters during the recent call of
+// FunctionSetRoot are modified;
+// 3) couple (u, v) is recomputed by approximation for the calculation of the next point.
+// 4) return Standard_True if location, Standard_False if no location.
{
Standard_Real Duvx = previousd2d.X();
Standard_Real Duvy = previousd2d.Y();
Standard_Real aStep = Abs((BornInf(1) - UVap(1)) / Duvx); // iso U =BornInf(1)
if(aStep<Step) Step=aStep;
}
- BornSup(1) = BornInf(1); // on bloque le parametre
+ BornSup(1) = BornInf(1); // limit the parameter
UVap(1) = BornInf(1);
UVap(2) += Step*Duvy*StepSign;;
return Standard_True;
Standard_Real aStep = Abs((BornSup(1) - UVap(1)) / Duvx); // iso U =BornSup(1)
if(aStep<Step) Step=aStep;
}
- BornInf(1) = BornSup(1); // on bloque le parametre
+ BornInf(1) = BornSup(1); // limit the parameter
UVap(1) = BornSup(1);
UVap(2) += Step*Duvy*StepSign;
return Standard_True;
math_Vector& UV,
Standard_Integer& Irang)
-// Umult et Vmult : tableau des points d arret (ou passant) sur frontiere, ici
-// on ne s interesse qu aux points passant.
-// UV : le point courant.
-// Irang : en sortie : donne l index du point d arret dans uvstart1 ou 0.
-// on considere qu on ne risque de passer que sur un seul point
-// passant.
+// Umult et Vmult : table of stop (or crossing) points on border,
+// here only the crossing points are taken into account.
+// UV : the current point.
+// Irang : at exit : give index of the stop point in uvstart1 or 0.
+// consider that there is no risk of crossing only if there is one crossing point.
-// test d arret pour une ligne d intersection OUVERTE
-// 1) test de passage sur l ensemble des points interieur
-// 2) test d arret sur l ensemble des points depart
-// si on detecte un arret on renvoie l index du point d arret (Irang) dans
-// l iterateur des points de depart et les parametres associes dans
-// l espace UV.
+// test of stop for an OPEN intersection line
+// 1) crossing test on all interior points
+// 2) stop test on all start points
+// if a stop is detected, the index of the stop point (Irang) is returned
+// in the iterator of start points and the associated parameters in UV space.
{
Standard_Real Up, Vp, Du, Dv, Dup, Dvp, Utest,Vtest;
Standard_Integer j, N, ind;
Standard_Boolean Arrive = Standard_False;
- // test de passage sur point pouvant demarrer une boucle;les marquer traites
- // si passe sur la ligne ouverte
+ // crossing test on point that can start a loop; mark
+ // as processed if passes through an open line
if (!reversed) {
previousPoint.ParametersOnS2(Up,Vp);
}
}
- // test d arret sur point donne en entree et non encore traite
+ // stop test on point given at input and not yet processed
// Modified by Sergey KHROMOV - Tue Nov 20 10:55:01 2001 Begin
// Check of all path points in the following order:
const Standard_Integer Index,
Standard_Integer& Irang)
{
-// Umult, Vmult : tableau des points d arret (ou passant) sur frontiere, ici
-// on ne s interesse qu aux points passant.
-// UV : le point courant.
-// Index : l index du point de demarrage dans uvstart2 de la ligne en cours
-// (c est un point interieur).
-// Irang : en sortie : donne l index du point passant dans uvstart1 ou 0.
-// on considere qu on ne risque de passer que sur un seul point
-// passant.
-
-// test d arret pour une ligne d intersection FERMEE.
-// 1) test de passage sur l ensemble des points interieur
-// 2) test de passage sur les points passant.
+// Umult, Vmult : table of stop (or crossing) points on border, here
+// only crossing points are taken into account.
+// UV : the current point.
+// Index : index of the start point in uvstart2 of the current line
+// (this is an interior point).
+// Irang : at output : gives the index of the point passing in uvstart1 or 0.
+// consider that there is risk to cross only one crossing point.
+
+// test of stop for a CLOSED intersection line.
+// 1) test of crossing on all interior points.
+// 2) test of crossing on all crossing points.
Standard_Real Up, Vp, Scal;
Standard_Boolean Arrive = Standard_False;
Standard_Real tolv = tolerance(2);
- // tests d arret et de passage sur points interieurs.
+ // tests of stop and of crossing on all interior points.
if (!reversed) {
previousPoint.ParametersOnS2(Up,Vp);
Standard_Real UV2=UV(2);
- //-- On met tout le monde ds une boite 0 1 x 0 1
- //-- en tourte rigueur il faudrait faire les test en 3d
+ //-- Put everything in one box 0 1 x 0 1
+ //-- actually it is necessary to carry out tests in 3D
Standard_Real deltau=UM-Um;
Standard_Real deltav=VM-Vm;
&& (UV2mVtest<tolv2 && UV2mVtest>-tolv2)) {
if(Index!=k) {
//-- cout<<"* etat2 : ("<<k<<")"<<endl;
- wd2[k].etat=-wd2[k].etat; //-- marque le point comme point de passage
+ wd2[k].etat=-wd2[k].etat; //-- mark the point as a crossing point
}
else { //-- Index == k
//-- cout<<"* Arrive"<<endl;
}
else {
//-- cout<<"*** etat2 : ("<<k<<")"<<endl;
- wd2[k].etat = -wd2[k].etat; // marque le point point de passage
+ wd2[k].etat = -wd2[k].etat; // mark the point as a crossing point
}
}
else if(k!=Index) {
if(dPreviousStart < dPreviousCurrent*0.25) {
- wd2[k].etat = -wd2[k].etat; // marque le point point de passage
+ wd2[k].etat = -wd2[k].etat; // mark the point as a crossing point
//-- cout<<"**** etat2 : ("<<k<<")"<<endl;
}
else {
if(dCurrentStart < dPreviousCurrent*0.25) {
//-- cout<<"***** etat2 : ("<<k<<")"<<endl;
- wd2[k].etat = -wd2[k].etat; // marque le point point de passage
+ wd2[k].etat = -wd2[k].etat; // mark the point as a crossing point
}
else {
Standard_Real UMidUtest = 0.5*(UV1+Up)-Utest;
if(dMiddleStart < dPreviousCurrent*0.5) {
//-- cout<<"*********** etat2 : ("<<k<<")"<<endl;
- wd2[k].etat = -wd2[k].etat; // marque le point point de passage
+ wd2[k].etat = -wd2[k].etat; // mark the point as a crossing point
}
}
}
}
}
- // test de passage sur points passant.
+ // crossing test on crossing points.
Irang =0;
for (i = 1; i < (int)wd1.size(); i++) {
- if (wd1[i].etat > 0 && wd1[i].etat < 11) { //test des points passant
+ if (wd1[i].etat > 0 && wd1[i].etat < 11) { //test of crossing points
Utest = wd1[i].ustart;
Vtest = wd1[i].vstart;
Utest/=deltau;
Standard_Integer& Irang,
IntSurf_PntOn2S& Psol)
-// test d arret sur les points rajoutes
-// ces points sont des points sur frontiere naturelle qui n ont pas ete
-// donnes en entree
-// on renvoit : Psol, le point rajoute.
-// Irang, l index dans l iterateur des points rajoutes.
-// UV, parametre du point rajoute.
+// test of stop on added points
+// these are the points on the natural biorder that were not given at input
+// return : Psol, the added point.
+// Irang, index in the iterator of added points.
+// UV, parameter of the added point.
//
{
Standard_Boolean Arrive = Standard_False;
for (Standard_Integer i = 1; i <= nbAjout; i++) {
Irang = seqAjout.Value(i);
-// on rajoute le test Abs(Irang) <= lines.Length() pour le cas ou
-// on ouvre une ligne fermee suite a l ajout 1 point sur cette meme
-// ligne. De toute facon on a un gros pb , car on va avoir 2 points
-// rajoutes sur cette ligne...
+// add test Abs(Irang) <= lines.Length() for the case when
+// a closed line is opened by adding a 1 point on this same
+// line. Anyway there is a huge problem as 2 points will be
+// added on this line...
if (Abs(Irang) <= lines.Length()) {
math_Vector& UV,
Standard_Integer& Irang)
-// test d arret alors qu on est sur frontiere.
-// on a essaye tous les tests d arret et on est arrive.
-// test d arret sur les points donne au depart deja marques et sur
-// l ensemble de la ligne courante. Cette ligne peut etre racourcie si
-// on trouve in point d arret.
-// Abs(Irang) = index dans l iterateur des points de depart ou 0
-// si Irang <0 , il faut ajouter ce point a la ligne ( pas de Line->Cut)
-// UV = parametre du point de depart
+// test of stop when located on border.
+// tried all tests of stop and arrived.
+// test of stop on all given departure points already marked and on the entire current line.
+// This line can be shortened if the stop point is found.
+// Abs(Irang) = index in the iterator of departure points or 0
+// if Irang <0 , it is necessary to add this point on the line (no Line->Cut)
+// UV = parameter of the departure point
{
Standard_Real Scal, Up, Vp, Uc, Vc;
Standard_Integer N;
Irang =0;
for (Standard_Integer i = 1; i < (int)wd1.size(); i++) {
if (wd1[i].etat < 0) {
- N=0; // rang dans UVMult.
+ N=0; // range in UVMult.
if (nbMultiplicities[i] > 0) {
for (Standard_Integer k = 1; k < i; k++)
N+=nbMultiplicities[k];
Scal = (Up-wd1[i].ustart) * (Uc-wd1[i].ustart) +
(Vp-wd1[i].vstart) * (Vc-wd1[i].vstart);
- // si on a trouve un point d arret : on arrete la ligne sur ce point.
+ // if a stop point is found: stop the line on this point.
if (Scal < 0) {
Line->Cut(j); nbp= Line->NbPoints();
Irang = i;
gp_Vec Dir3d = sp.Direction3d();
gp_Vec Dir3d1 = gp_Vec(Line->Value(j-2).Value(),Line->Value(j-1).Value());
Standard_Real dot = Dir3d.Dot(Dir3d1);
- if(dot<0.0) { // Normalement on ne doit pas passer souvent ds cette Fonction !!!
+ if(dot<0.0) { // Normally this Function should not be used often !!!
Dir3d.Reverse();
//-- cout<<" IntWalk_IWalking_2.gxx REVERSE "<<endl;
}
Vp = Vc;
}
- // et maintenant on compare le dernier point de la ligne et le dernier
- // point calcule.
- // il n y aura pas besoin de "Cuter"
+ // now the last point of the line and the last calculated point are compated.
+ // there will be no need to "Cut"
Scal = (Up-wd1[i].ustart) * (UV(1)-wd1[i].ustart) +
// (Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart);
// and conditions governing the rights and limitations under the License.
namespace {
- static const Standard_Real CosRef3D = 0.98;// regle par tests dans U4
- // correspond a 11.478 d
- static const Standard_Real CosRef2D = 0.88; // correspond a 25 d
- static const Standard_Integer MaxDivision = 60; // nombre maxi de division
- // du pas a cause de
- // l angle trop grand en 2d (U4)
+ static const Standard_Real CosRef3D = 0.98;// rule by tests in U4
+ // correspond to 11.478 d
+ static const Standard_Real CosRef2D = 0.88; // correspond to 25 d
+ static const Standard_Integer MaxDivision = 60; // max number of step division
+ // because the angle is too great in 2d (U4)
}
IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Standard_Real& Step,
const Standard_Integer StepSign)
{
- // Verification du pas d avancement, ET recalcul de ce pas :
+ // Check the step of advancement, AND recalculate this step :
//
- // 1)test point confondu
- // si oui les autres tests ne sont pas faits
- // 2)test angle 3d trop grand
- // si oui on divise le pas, on sort
- // angle3d = angle ((point precedent, point calcule),
- // tangente precedente)
- // 3)verification du pas d avancement en 2d
- // 4)test point confondu
- // 5)test angle 2d trop grand
- // 6)test point de tangence
- // si oui on sort
- // 7)calcul de la tangente en u,v de la section
- // 8)test angle 3d trop grand
- // angle3d = angle ((point precedent, point calcule),
- // nouvelle tangente)
- // 9)test angle 2d trop grand
- //10)test de changement de rive(depasser le point de tangence sans le savoir)
- //11)calcul du pas d avancement en fonction de la fleche
- //12)ajustement du pas en fonction des pas precedents
+ // 1) test point confused
+ // if yes other tests are not done
+ // 2) test angle 3d too great
+ // if yes divide the step and leave
+ // angle3d = angle ((previous point, calculated point),
+ // previous tangent)
+ // 3) check step of advancement in 2d
+ // 4) test point confused
+ // 5) test angle 2d too great
+ // 6) test point of tangency
+ // if yes leave
+ // 7) calculate the tangent by u,v of the section
+ // 8) test angle 3d too great
+ // angle3d = angle ((previous point, calculated point),
+ // new tangent)
+ // 9) test angle 2d too great
+ //10) test change of side (pass the tangent point not knowing it)
+ //11) calculate the step of advancement depending on the vector
+ //12) adjust the step depending on the previous steps
IntWalk_StatusDeflection Status = IntWalk_OK;
//---------------------------------------------------------------------------------
- //-- lbr le 4 Avril 95 : On peut se trouver ds le cas ou Status renvoie point
- //-- confondus si epsilon est assez grand (1e-11) . Dans ce cas on boucle
- //-- sans jamais changer les valeurs envoyees a Rsnld.
+ //-- lbr le 4 Avril 95 : it is possible that the status returns points confused
+ //-- if epsilon is great enough (1e-11). In this case one loops
+ //-- without ever changing the values sent to Rsnld.
//---------------------------------------------------------------------------------
Standard_Real Paramu, Paramv, StepU,StepV;
Standard_Real Cosi, Cosi2, Norme;
Norme = Corde.SquareMagnitude();
// if (Norme <= epsilon*epsilon) {
- if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // le carre est deja pris dans le constructeur
+ 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) { //-- Provisoire
- if(epsilon>0.00000000001) epsilon*=0.5; //-- Provisoire
- EpsilonSembleTropGrand = 0; //-- Provisoire
+ if(++EpsilonSembleTropGrand > 5 && NbPointsConfondusConsecutifs == 8) { //-- Temporary
+ if(epsilon>0.00000000001) epsilon*=0.5; //-- Temporary
+ EpsilonSembleTropGrand = 0; //-- Temporary
}
}
else {
- NbPointsConfondusConsecutifs = 0; //-- Provisoire
- EpsilonSembleTropGrand = 0; //-- Provisoire
- if(Norme<1e-16) Norme = 1e-16; //-- Provisoire
+ 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 !!!!
else {
Cosi2 = Cosi * Cosi / previousd3d.SquareMagnitude() / Norme;
}
- if (Cosi2 < CosRef3D) { //angle 3d trop grand
+ if (Cosi2 < CosRef3D) { //angle 3d too great
Step = Step /2.0;
StepU = Abs(Step*previousd2d.X());
StepV = Abs(Step*previousd2d.Y());
Standard_Real Dv = UV(2) - Paramv;
Standard_Real Duv = Du * Du + Dv * Dv;
if (Abs(Du) < tolerance(1) && Abs(Dv) < tolerance(2))
- return IntWalk_ArretSurPointPrecedent; //point confondu 2d
+ return IntWalk_ArretSurPointPrecedent; //confused point 2d
Cosi = StepSign * (Du * previousd2d.X() +
Dv * previousd2d.Y());
if (Cosi < 0 && Status == IntWalk_PointConfondu)
- return IntWalk_ArretSurPointPrecedent; // on sort car retour arriere
- // avec point confondu
+ return IntWalk_ArretSurPointPrecedent; // leave as step back
+ // with confused point
if (sp.IsTangent())
return IntWalk_ArretSurPoint;
-//si au cours du cheminement on a subdivise plus de MaxDivision pour chaque
-//pas precedent,anomalie sur le carreau;on ne fait plus rien (experience U4)
+//if during routing one has subdivided more than MaxDivision for each
+//previous step, bug on the square; do nothing (experience U4)
if (NbDivision < MaxDivision &&
Status != IntWalk_PointConfondu &&
Cosi = Corde * sp.Direction3d();
Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme;
- if (Cosi2 < CosRef3D ){ //angle 3d trop grand
+ if (Cosi2 < CosRef3D ){ //angle 3d too great
Step = Step / 2.;
StepU = Abs(Step*previousd2d.X());
StepV = Abs(Step*previousd2d.Y());
Cosi2 = Cosi * Cosi / Duv;
if (Cosi2 < CosRef2D ||
sp.Direction2d() * previousd2d < 0) {
- //angle 2d trop grand ou changement de rive
+ //angle 2d too great or change the side
Step = Step / 2.;
StepU = Abs(Step*previousd2d.X());
StepV = Abs(Step*previousd2d.Y());
}
else {
-// on estime la fleche courante.
-// si fleche/2<=flechecourante<= fleche on considere que le critere est
-// respecte.
-// sinon ajuster le pas en fonction du pas precedent
+// estimate the current vector.
+// if vector/2<=current vector<= vector it is considered that the criterion
+// is observed.
+// otherwise adjust the step depending on the previous step
/*
Standard_Real Dist = Sqrt(Norme)/3.;
Standard_Real FlecheCourante = Milieu.SquareDistance(POnCurv);
*/
- // Calcul direct :
+ // Direct calculation :
// POnCurv=(((p1+p2)/2.+(p2+p3)/2.)/2. + ((p2+p3)/2.+(p3+P4)/2.)/2.)/2.
- // soit 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
- // Donc POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8.
- // On calcule l'ecart avec (p1+p4)/2. . Il faut donc juste calculer
- // la norme (au carre) de 3.*lambda (d1 - d4)/8.
- // soit la norme de :
+ // 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
+ // the norm (square) of 3.*lambda (d1 - d4)/8.
+ // either the norm of :
// 3.*(Sqrt(Norme)/3.)*StepSign*(d1-d4)/8.
- // ce qui fait, en prenant le carre :
+ // which produces, takin the square :
// Norme * (d1-d4).SquareMagnitude()/64.
Standard_Real FlecheCourante =
}
else {
-// if (FlecheCourante > fleche) { // pas trop grand
- if (FlecheCourante > fleche*fleche) { // pas trop grand
+// if (FlecheCourante > fleche) { // not too great
+ if (FlecheCourante > fleche*fleche) { // not too great
Step = Step /2.;
Status = IntWalk_PasTropGrand;
}
const ThePOPIterator& Pnts1,
TheIWFunction& sp,
const Handle(IntWalk_TheIWLine)& Line )
-// **************** ouverture de la ligne et repartir dans l autre sens********
+// **************** open the line and restart in the other direction********
{
ThePointOfPath PathPnt;
previousd3d = sp.Direction3d();
previousd2d = sp.Direction2d();
- if (N>0) { //point de depart donne en entree
+ if (N>0) { //departure point given at input
PathPnt = Pnts1.Value(N);
- //marque la ligne comme ouverte avec point d arret donne
+ //mark the line as open with a given stop point
Line->AddStatusFirst(Standard_False,Standard_True,N,PathPnt);
else {
if (N <0) Line->AddPoint(Psol);
Line->AddStatusFirst(Standard_False,Standard_False);
- //marque la ligne comme ouverte sans point d arret donne
+ //mark the line as open without given stop point
}
Line->Reverse(); //inverser la ligne
Line->SetTangentVector(previousd3d.Reversed(),Line->NbPoints());
---Purpose: This class implements an algorithm to determine the
- -- intersection between 2 parametrized surface, marching from
+ -- intersection between 2 parametrized surfaces, marching from
-- a starting point. The intersection line
- -- starts and ends on the natural surface 's boundaries .
+ -- starts and ends on the natural surface's boundaries .
uses XY from gp,
-- solution point (each point of the line).
-- It is necessary to call the Perform method to compute
-- the intersection lines.
- -- la ligne trouvee part d'un point sur ou dans les 2 domaines
- -- naturelles des surfaces .Elle peut etre fermee ;dans les
- -- cas standard si elle est ouverte elle s arrete et commence
- -- a une frontiere d 'un des domaines.Si une ligne ouverte
- -- s arrete en plein milieu d'un domaine ,on s'arrete sur
- -- point de tangence.
- -- Epsilon tolerance au carre de confusion de points
+ -- The line found starts at a point on or in 2 natural domains
+ -- of surfaces. It can be closed in the
+ -- standard case if it is open it stops and begins at the
+ -- border of one of the domains. If an open line
+ -- stops at the middle of a domain, one stops at the tangent point.
+ -- Epsilon is SquareTolerance of points confusion.
returns PWalking;
-- TolTangency is the tolerance to find a tangent point.
-- Func is the criterion which has to be evaluated at each
-- solution point (each point of the line).
- -- la ligne trouvee part d'un point sur ou dans les 2 domaines
- -- naturelles des surfaces .Elle peut etre fermee ;dans les
- -- cas standard si elle est ouverte elle s arrete et commence
- -- a une frontiere d 'un des domaines.Si une ligne ouverte
- -- s arrete en plein milieu d'un domaine ,on s'arrete sur
- -- point de tangence.
- -- Epsilon tolerance au carre de confusion de points
+ -- The line found starts at a point on or in 2 natural domains
+ -- of surfaces. It can be closed in the
+ -- standard case if it is open it stops and begins at the
+ -- border of one of the domains. If an open line
+ -- stops at the middle of a domain, one stops at the tangent point.
+ -- Epsilon is SquareTolerance of points confusion.
returns PWalking;
Perform(me :in out;ParDep : Array1OfReal from TColStd)
- ---Purpose: calcule la ligne d 'intersection
+ ---Purpose: calculate the line of intersection
is static;
Perform(me :in out;ParDep : Array1OfReal from TColStd;
u1min,v1min,u2min,v2min,u1max,v1max,u2max,v2max: Real from Standard)
- ---Purpose: calcule la ligne d 'intersection le reglage des
- -- pas est fait a partir des valeurs min max sur u et
- -- v. (si ces donnees ne sont pas presentes comme
- -- dans la methode precedente, les pas initiaux sont
- -- calcules a partir des min max uv des faces).
+ ---Purpose: calculate the line of intersection. The regulation
+ -- of steps is done using min and max values on u and
+ -- v. (if this data is not presented as in the
+ -- previous method, the initial steps are calculated
+ -- starting from min and max uv of faces).
is static;
ParDep : Array1OfReal from TColStd;
FirstPoint: in out PntOn2S from IntSurf)
- ---Purpose: calcule le premier point d'une ligne d'intersection
+ ---Purpose: calculate the first point of a line of intersection
--
returns Boolean from Standard
indextg : Integer from Standard;
tgdir : Dir from gp;
- fleche : Real from Standard; -- fleche maxi autorisee
- pasMax : Real from Standard; -- ratio uv maximum autorise
- tolconf : Real from Standard; -- tol de confusion de 2 points
- pasuv : Real from Standard[4];-- pas uv sur les caros
- pasSav : Real from Standard[4];-- premier pas sauvegarde
- pasInit : Real from Standard[4];-- sauvegarde des pas
+ fleche : Real from Standard; -- max possible vector
+ pasMax : Real from Standard; -- max possible uv ratio
+ tolconf : Real from Standard; -- tol of confusion of 2 points
+ pasuv : Real from Standard[4];-- uv step on squares
+ pasSav : Real from Standard[4];-- first saved step
+ pasInit : Real from Standard[4];-- saving of steps
Um1 : Real from Standard;
UM1 : Real from Standard;
sensCheminement : Integer from Standard;
choixIsoSav : ConstIsoparametric from IntImp;
- -- sauvegarde du choix 1 iere iso
+ -- save 1st iso choice
previousPoint : PntOn2S from IntSurf;
- -- point d 'intersection precedent
+ -- previous intersection point
previoustg : Boolean from Standard;
previousd : Dir from gp;
previousd1 : Dir2d from gp;
//==================================================================================
// 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;
{
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);
{
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);
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);
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];
}
- //-- 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;
}
// ===========================================================================================================
IntImp_ConstIsoparametric& ChoixIso,
Standard_Boolean& Arrive)
-// au voisinage d '1 point ,il y a echec du cheminement
-// il faut diviser le pas pour essayer de continuer
-//si le pas est trop petit ou si on est arrive sur une frontiere
-// repartir dans l autre sens si cela n a pas ete deja fait sinon arret
+// at the neighborhood of a point, there is a fail of marching
+// it is required to divide the steps to try to continue
+// if the step is too small if we are on border
+// restart in another direction if it was not done, otherwise stop
{
// Standard_Integer i;
- if (Arrive) { //repartir dans l autre sens
+ if (Arrive) { //restart in the other direction
if (!DejaReparti ) {
Arrive = Standard_False;
DejaReparti = Standard_True;
&& pasuv[3]*0.5 < ResoV2
) {
if (!previoustg) {
- tglast = Standard_True; // EST-CE SUFFISANT ????
+ tglast = Standard_True; // IS IT ENOUGH ????
}
- if (!DejaReparti) { //repartir dans l autre sens
+ if (!DejaReparti) { //restart in the other direction
DejaReparti = Standard_True;
previousPoint = line->Value(1);
previoustg = Standard_False;
IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
-// tester si fleche respectee en calculant un majorant de fleche
-// soit le point precedent et sa tangente ,le point nouveau calcule et sa
-// tangente ;on peut trouver une cubique passant par ces 2 points et ayant
-// pour derivee les tangentes de l intersection
-// calculer le point au parametre 0.5 sur la cubique=p1
-// calculer le point milieu des 2 points d intersection=p2
-// si fleche/2<=||p1p2||<= fleche on considere que l on respecte la fleche
-// sinon ajuster le pas en fonction du rapport ||p1p2||/fleche et du pas
-// precedent
-// tester si dans les 2 plans tangents des surfaces on a pas un angle2d trop
-// grand : si oui diviser le pas
-// tester s il n y a pas changement de rive
+// test if vector is observed by calculating an increase of vector
+// or the previous point and its tangent, the new calculated point and its
+// tangent; it is possible to find a cube passing by the 2 points and having as a
+// derivative the tangents of the intersection
+// calculate the point with parameter 0.5 on cube=p1
+// calculate the medium point of 2 points of intersection=p2
+// if arrow/2<=||p1p2||<= arrow consider that the vector is observed
+// otherwise adjust the step depending on the ratio ||p1p2||/vector
+// and the previous step
+// test if in 2 tangent planes of surfaces there is no too great angle2d
+// grand : if yes divide the step
+// test if there is no change of side
//
{
if(line->NbPoints() ==1 ) {
const IntSurf_PntOn2S& CurrentPoint = myIntersectionOn2S.Point();
//==================================================================================
- //========= A r r e t s u r p o i n t ============
+ //========= S t o p o n p o i n t ============
//==================================================================================
if (myIntersectionOn2S.IsTangent()) {
return IntWalk_ArretSurPoint;
const gp_Dir& TgCourante = myIntersectionOn2S.Direction();
//==================================================================================
- //========= R i s q u e d e p o i n t d i n f l e x i o n ============
+ //========= R i s k o f i n f l e x i o n p o i n t ============
//==================================================================================
if (TgCourante.Dot(previousd)<0) {
//------------------------------------------------------------
- //-- Risque de point d inflexion : On divise le pas par 2
- //-- On initialise STATIC_PRECEDENT_INFLEXION pour qu a
- //-- l appel suivant, on retourne Pas_OK si il n y a
- //-- plus de risque de point d inflexion
+ //-- Risk of inflexion point : Divide the step by 2
+ //-- Initialize STATIC_PRECEDENT_INFLEXION so that
+ //-- at the next call to return Pas_OK if there is no
+ //-- more risk of the point of inflexion
//------------------------------------------------------------
pasuv[0]*=0.5;
}
//==================================================================================
- //========= D e t e c t i o n d e P o in t s c o n f o n d u s ===========
+ //========= D e t e c t c o n f u s e d P o in t s ===========
//==================================================================================
Standard_Real Dist = previousPoint.Value().
AbsDv1 = Abs(Dv1);
AbsDv2 = Abs(Dv2);
//=================================================================================
- //==== P a s d e p r o g r e s s i o n (entre previous et Current) =======
+ //==== S t e p o f p r o g r e s s i o n (between previous and Current) =======
//=================================================================================
if ( AbsDu1 < ResoU1 && AbsDv1 < ResoV1
&& AbsDu2 < ResoU2 && AbsDv2 < ResoV2) {
CosRef2 = CosRef2D/tolCoeff2;
//
//==================================================================================
- //== Les points ne sont pas confondus : ==
- //== D e t e c t i o n d e A r r e t s u r P o i n t p r e c e d e n t ==
- //== P a s T r o p G r a n d (angle dans Esp UV) ==
- //== C h a n g e m e n t d e r i v e ==
+ //== The points are not confused : ==
+ //== D e t e c t t h e S t o p a t p r e v i o u s p o i n t ==
+ //== N o t T o o G r e a t (angle in space UV) ==
+ //== C h a n g e o f s i d e ==
//==================================================================================
if (Status != IntWalk_PointConfondu) {
if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2) {
AngRef1 = AngRef2D*tolCoeff1;
AngRef2 = AngRef2D*tolCoeff2;
//-------------------------------------------------------
- //-- Test : Angle trop grand dans l espace UV -----
- //-- Changement de rive -----
+ //-- Test : Angle too great in space UV -----
+ //-- Change of side -----
//-------------------------------------------------------
if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2 || Ang1 > AngRef1 || Ang2 > AngRef2) {
pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5;
}
//<-OCC431(apo)
//==================================================================================
- //== D e t e c t i o n d e : Pas Trop Petit
- //== Pas Trop Grand
+ //== D e t e c t i o n o f : Step Too Small
+ //== STEP TOO Great
//==================================================================================
//---------------------------------------
- //-- Estimation de la fleche --
+ //-- Estimate of the vector --
//---------------------------------------
FlecheCourante =
Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*Dist))/8.;
- if ( FlecheCourante<= fleche*0.5) { //-- Pas Courant trop petit
+ if ( FlecheCourante<= fleche*0.5) { //-- Current step too small
if(FlecheCourante>1e-16) {
Ratio = 0.5*(fleche/FlecheCourante);
}
Standard_Real pasSu2 = pasuv[2];
Standard_Real pasSv2 = pasuv[3];
- //-- Dans les cas ou lorsqu on demande
- //-- un point a U+DeltaU , ....
- //-- on recupere un point a U + Epsilon
+ //-- In case if
+ //-- a point at U+DeltaU is required, ....
+ //-- return a point at U + Epsilon
//-- Epsilon << DeltaU.
if(pasuv[0]< AbsDu1) pasuv[0] = AbsDu1;
}
if(Status == IntWalk_OK) {
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0;
- //-- On tente d augmenter le pas
+ //-- Try to increase the step
}
return Status;
}
- else { //-- FlecheCourante > fleche*0.5
- if (FlecheCourante > fleche) { //-- Pas Courant Trop Grand
+ else { //-- CurrentVector > vector*0.5
+ if (FlecheCourante > fleche) { //-- Current step too Great
Ratio = fleche/FlecheCourante;
pasuv[0] = Ratio*pasuv[0];
pasuv[1] = Ratio*pasuv[1];
return IntWalk_PasTropGrand;
//}
}
- else { //-- fleche/2 < FlecheCourante <= fleche
+ else { //-- vector/2 < CurrentVector <= vector
Ratio = 0.75 * (fleche / FlecheCourante);
}
}
// and conditions governing the rights and limitations under the License.
//--
-//-- Modif du 5 Octobre 94 (LBR)
+//-- Modif of 5 October 94 (LBR)
//-- if(Trouve) ...
-//-- On deborde sur une frontiere, Duv[.] = -1 -1 -1 -1
-//-- donc on garde la meme iso bloquee (voir if(k!=1) )
+//-- outpasses a border, Duv[.] = -1 -1 -1 -1
+//-- keep the same iso limited (see if(k!=1) )
//--
-//-- Modif du 8 juillet 96 (LBR)
-//-- simplifaication du traitement des auto-intersections.
-//-- Idee :
-//-- Tester la boucle fermee en 3d et en 2d.
+//-- Modif of 8 July 96 (LBR)
+//-- simplify processing of auto-intersections.
+//-- Idea : Test closed loop in 3d and in 2d.
//--
#include <gp_Pnt2d.hxx>
IntImp_ConstIsoparametric& ChoixIso)
//
-// tester si le point d intersection donne par ces parametres reste dans le
-// domaine naturelle de chaque carreau.
-// si le point deborde cadrer de facon a trouver la meilleure iso (frontiere)
-// qui intersecte le plus franchement l autre carreau
-// sinon tester si presence de ligne fermee
+// test if the point of intersection set by these parameters remains in the
+// natural domain of each square.
+// if the point outpasses reframe to find the best iso (border)
+// that intersects easiest the other square
+// otherwise test if closed line is present
//
{
Standard_Real Uvd[4],Uvf[4],Epsuv[4],Duv[4],Uvp[4],dv,dv2,ParC[4];
Epsuv[2] = ResoU2;
Epsuv[3] = ResoV2;
previousPoint.Parameters(Uvp[0],Uvp[1],Uvp[2],Uvp[3]);
+
+ Standard_Real SolParam[4];
+ myIntersectionOn2S.Point().Parameters(SolParam[0],SolParam[1],SolParam[2],SolParam[3]);
+
Standard_Boolean Trouve = Standard_False;
Uvd[0]=Um1; Uvf[0]=UM1; Uvd[1]=Vm1; Uvf[1]=VM1;
case 3: k=4; break;
case 4: k=3; break;
}
- if (Param(i) < (Uvd[im1]-Epsuv[im1])) { //-- Current ----- Bound Inf ----- Previous
+ if (Param(i) < (Uvd[im1]-Epsuv[im1]) ||
+ SolParam[im1] < (Uvd[im1]-Epsuv[im1])) //-- Current ----- Bound Inf ----- Previous
+ {
Trouve = Standard_True; //--
DPc = Uvp[im1]-Param(i); //-- Previous - Current
DPb = Uvp[im1]-Uvd[im1]; //-- Previous - Bound Inf
ParC[im1] = Uvd[im1]; //-- ParamCorrige
- dv = Param(k)-Uvp[k-1]; //-- Current - Previous (Sur Autre Direction)
+ dv = Param(k)-Uvp[k-1]; //-- Current - Previous (other Direction)
dv2 = dv*dv;
- if(dv2>RealEpsilon()) { //-- Progression sur l autre Direction ?
+ if(dv2>RealEpsilon()) { //-- Progress at the other Direction ?
Duv[im1] = DPc*DPb + dv2;
Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2);
}
else {
- Duv[im1]=-1.0; //-- Si Pas de prgogression, on ne change pas
- } //-- le choix de l iso
+ Duv[im1]=-1.0; //-- If no progress, do not change
+ } //-- the choice of iso
}
- else if (Param(i) > (Uvf[im1] + Epsuv[im1])) { //-- Previous ----- Bound Sup ----- Current
+ else if (Param(i) > (Uvf[im1] + Epsuv[im1]) ||
+ SolParam[im1] > (Uvf[im1] + Epsuv[im1]))//-- Previous ----- Bound Sup ----- Current
+ {
Trouve = Standard_True; //--
DPc = Param(i)-Uvp[im1]; //-- Current - Previous
DPb = Uvf[im1]-Uvp[im1]; //-- Bound Sup - Previous
ParC[im1] = Uvf[im1]; //-- Param Corrige
- dv = Param(k)-Uvp[k-1]; //-- Current - Previous (Sur autre Direction)
+ dv = Param(k)-Uvp[k-1]; //-- Current - Previous (other Direction)
dv2 = dv*dv;
- if(dv2>RealEpsilon()) { //-- Progression sur l autre Direction ?
+ if(dv2>RealEpsilon()) { //-- Progress in other Direction ?
Duv[im1] = DPc*DPb + dv2;
Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2);
}
else {
- Duv[im1]=-1.0; //-- Si Pas de prgogression, on ne change pas
- } //-- le choix de l iso
+ Duv[im1]=-1.0; //-- If no progress, do not change
+ } //-- the choice of iso
}
else {
Duv[im1]= -1.;
if (Trouve) {
//--------------------------------------------------
- //-- Un des Parametres u1,v1,u2,v2 est en dehors --
- //-- des bornes naturelles. --
- //-- On cherche la meilleure direction de --
- //-- progression et on recadre les params. --
+ //-- One of Parameters u1,v1,u2,v2 is outside of --
+ //-- the natural limits. --
+ //-- Find the best direction of --
+ //-- progress and reframe the parameters. --
//--------------------------------------------------
Standard_Real ddv = -1.0;
k=-1;
}
else
{
- if (!DejaReparti) { // recherche si ligne fermee
+ if (!DejaReparti) { // find if line closed
Standard_Real u,v;
const IntSurf_PntOn2S& POn2S1=line->Value(1);
set prop "square"
set mass $square
if { [info exists tol_square] } {
+ # tol_square - The epsilon defines relative precision of computation
regexp {Mass +: +([-0-9.+eE]+)} [sprops result $tol_square] full m
} else {
regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m
# An exception was caught Standard_ConstructionError:
# ** Exception ** Standard_ConstructionError:
-set square 1.63191e+07
+set square 1.65227e+07
set 2dviewer 0
--- /dev/null
+puts "============"
+puts "OCC24140"
+puts "============"
+puts ""
+######################################################
+# Endless loop in BRepAlgoAPI_Section
+######################################################
+
+pload XDE
+
+ReadStep D [locate_data_file bug24140_bug663.stp]
+XGetShape sh1 D 0:1:1:1
+XGetShape sh2 D 0:1:1:2
+
+bsection result sh1 sh2
+
+set length 557.6
+
+set nb_v_good 1
+set nb_e_good 1
+set nb_w_good 0
+set nb_f_good 0
+set nb_sh_good 0
+set nb_sol_good 0
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 3
+
+set 2dviewer 1