}
if (Abs(I2-I1)==1) {
- // numeros consecutifs
+ // consecutive numbers
if (I2==I1+1) {
E1 = e1;
E2 = e2;
}
}
else {
- // numeros non consecutifs sur un wire ferme
+ // non consecutive numbers on a closed wire
if (I1==1&&I2==NE) {
E1 = e2;
E2 = e1;
BRepGProp::LinearProperties(W,GP);
gp_Pnt Bary = GP.CentreOfMass();
-// blindage pour les cas particuliers : 1 seule edge cercle ou ellipse
-// sur un wire ferme !
+// shielding for particular cases : only one edge circle or ellipse
+// on a closed wire !
Standard_Integer nbEdges = 0;
BRepTools_WireExplorer anExp;
anExp.Init(W);
Standard_Boolean wClosed = W.Closed();
if (!wClosed) {
- // on regarde quand meme si les vertex sont les memes.
+ // it is checked if the vertices are the same.
TopoDS_Vertex V1, V2;
TopExp::Vertices(W,V1,V2);
if ( V1.IsSame(V2)) wClosed = Standard_True;
P.SetLocation(Bary);
}
else {
- // wire non plan !
+ // wire not plane !
GProp_PrincipalProps Pp = GP.PrincipalProperties();
gp_Vec Vec;
Standard_Real R1, R2, R3,Tol = Precision::Confusion();
Vbid.Nullify();
if (SeqOrder) {
- // de first vers last
+ // from first to last
m0 = first;
V0 = Vf;
for (j=1; j<=ndec; j++) {
- // morceau d'edge
+ // piece of edge
m1 = (CutValues.Value(j)-t0)*(last-first)/(t1-t0)+first;
TopoDS_Edge CutE = BRepLib_MakeEdge(C,V0,Vbid,m0,m1);
CutE.Orientation(CurrentOrient);
m0 = m1;
V0 = TopExp::LastVertex(CutE);
if (j==ndec) {
- // dernier morceau
+ // last piece
TopoDS_Edge LastE = BRepLib_MakeEdge(C,V0,Vl,m0,last);
LastE.Orientation(CurrentOrient);
S.Append(LastE);
}
}
else {
- // de last vers first
+ // from last to first
m1 = last;
V1 = Vl;
for (j=ndec; j>=1; j--) {
- // morceau d'edge
+ // piece of edge
m0 = (CutValues.Value(j)-t0)*(last-first)/(t1-t0)+first;
TopoDS_Edge CutE = BRepLib_MakeEdge(C,Vbid,V1,m0,m1);
CutE.Orientation(CurrentOrient);
m1 = m0;
V1 = TopExp::FirstVertex(CutE);
if (j==1) {
- // dernier morceau
+ // last piece
TopoDS_Edge LastE = BRepLib_MakeEdge(C,Vf,V1,first,m1);
LastE.Orientation(CurrentOrient);
S.Append(LastE);
BRepTools_WireExplorer anExp;
- // construction de l'edge d'intersection
+ // construction of the edge of intersection
Standard_Boolean NewVertex = Standard_False;
gp_Lin droite(P1,gp_Dir(gp_Vec(P1,P2)));
- // ATTENTION : en toute rigueur, il faudrait construire une demi-droite
- // mais il y a un bug dans BRepExtrema_DistShapeShape
- // on se contente de 100 * la distance entre P1 et P2
- // en esperant que ce soit suffisant jusqu'a ce que le bug
- // soit corrige
+ // ATTENTION : it is required to construct a half-straight
+ // but there is a bug in BRepExtrema_DistShapeShape
+ // it is enough to take 100 * distance between P1 and P2
+ // hoping that it is enough until the bug is corrected
// Standard_Real dernierparam = Precision::Infinite();
- // ATTENTION : le retour !!
- // 100 c'est mieux que 10 mais quelquefois c'est trop !
- // finalement, rien ne vaut une bonne boite d'encombrement
+ // ATTENTION : return !!
+ // 100 is better than 10 but it is too much !
+ // finally, nothing is better than a blocking box
// Standard_Real dernierparam = 100 * P1.Distance(P2);
Bnd_Box B;
BRepBndLib::Add(W,B);
BRepLib_MakeEdge ME(droite,0.,dernierparam);
TopoDS_Edge ECur = BRepLib_MakeEdge(droite,0.,P1.Distance(P2));
- // calcul de l'intersection par BRepExtrema (point de distance mini)
+ // calculate the intersection by BRepExtrema (point of min distance)
BRepExtrema_DistShapeShape DSS(ME.Edge(),W);
if (DSS.IsDone()) {
- // on choisit la solution la plus proche de P2
+ // choose the solution closest to P2
Standard_Integer isol = 1;
Standard_Real dss = P2.Distance(DSS.PointOnShape2(isol));
for (Standard_Integer iss=2; iss<=DSS.NbSolution(); iss++) {
gp_Pnt Psol =
#endif
DSS.PointOnShape2(isol);
- // la solution est-elle un nouveau vertex ?
+ // is the solution a new vertex ?
NewVertex = (DSS.SupportTypeShape2(isol) != BRepExtrema_IsVertex);
if (NewVertex) {
TopoDS_Shape aLocalShape = DSS.SupportOnShape2(isol);
NewVertex = Standard_False;
Vsol = TopExp::LastVertex(E);
}
- // verif
+ // check
if (!NewVertex) {
TopoDS_Vertex VRoot;
if (SearchRoot(Vsol,Map,VRoot)) NewVertex = Standard_True;
// Vsol = TopoDS::Vertex(DSS.SupportOnShape2(isol));
}
- // il faut decouper l'edge
+ // it is required to cut the edge
if (NewVertex) {
TopoDS_Shape aLocalShape = DSS.SupportOnShape2(isol);
TopoDS_Edge E = TopoDS::Edge(aLocalShape);
// compute origin and orientation on wires to avoid twisted results
// and update wires to have same number of edges
- // determination de report:
- // si le nombre d'elements est identique et si les wires ont des discontinuites
- // en tangence, on n'effectue pas le report par abscisse curviligne, ni
+ // determination of report:
+ // if the number of elements is the same and if the wires have discontinuities
+ // by tangency, the report is not carried out by curvilinear abscissa
Standard_Integer nbSects = myWork.Length(), i;
BRepTools_WireExplorer anExp;
Standard_Integer nbmax=0, nbmin=0;
if (nbmax<nbEdges(i)) nbmax = nbEdges(i);
if (nbmin>nbEdges(i)) nbmin = nbEdges(i);
}
- // si on n'a pas le meme nombre d'elements ou si tous les wires sont au moins
- // C1, on effectue le report par abscisse curviligne des decoupes sinon, on se
- // fait un report vertex / Vertex
+ // if the number of elements is not the same or if all wires are at least
+ // C1, the report is carried out by curvilinear abscissa of cuts, otherwise
+ // a report vertex / Vertex is done
report = (nbmax != nbmin || contS >= GeomAbs_C1 );
- // initialisation de la map
+ // initialization of the map
Standard_Integer nbE = 0;
TopTools_ListOfShape Empty;
for (i=1; i<=nbSects; i++) {
}
}
- // sections ouvertes / sections fermees
- // initialisation de myDegen1, myDegen2
+ // open/closed sections
+ // initialisation of myDegen1, myDegen2
Standard_Integer ideb=1, ifin=myWork.Length();
- // on regarde si le premier wire est ponctuel
+ // check if the first wire is punctual
myDegen1 = Standard_True;
for(anExp.Init(TopoDS::Wire(myWork(ideb))); anExp.More(); anExp.Next()) {
myDegen1 = myDegen1 && (BRep_Tool::Degenerated(anExp.Current()));
}
if (myDegen1) ideb++;
- // on regarde si le dernier wire est ponctuel
+ // check if the last wire is punctual
myDegen2 = Standard_True;
for(anExp.Init(TopoDS::Wire(myWork(ifin))); anExp.More(); anExp.Next()) {
myDegen2 = myDegen2 && (BRep_Tool::Degenerated(anExp.Current()));
for (i=ideb; i<=ifin; i++) {
wClosed = myWork(i).Closed();
if (!wClosed) {
- // on regarde quand meme si les vertex sont les memes.
+ // check if the vertices are the same.
TopoDS_Vertex V1, V2;
TopExp::Vertices(TopoDS::Wire(myWork(i)),V1,V2);
if ( V1.IsSame(V2)) wClosed = Standard_True;
}
if (allClosed) {
- // Toutes les sections sont fermees
+ // All sections are closed
if (report) {
// same number of elements
SameNumberByPolarMethod(WithRotation);
}
else {
- // origine
+ // origin
ComputeOrigin(Standard_False);
}
myIsDone = Standard_True;
}
else if (allOpen) {
- // Toutes les sections sont ouvertes
- // origine
+ // All sections are open
+ // origin
SearchOrigin();
// same number of elements
if (report) {
myIsDone = Standard_True;
}
else {
- // Il y a des sections ouvertes et des sections fermees :
- // on ne traite pas
+ // There are open and closed sections :
+ // not processed
Standard_DomainError::Raise("Sections must be all closed or all open");
}
}
}
- // construction des tableaux de plans des wires
+ // construction of tables of planes of wires
gp_Pln P;
Handle(TColgp_HArray1OfPnt) Pos
= new (TColgp_HArray1OfPnt) (1,NbSects);
Axe->SetValue(NbSects,Axe->Value(ifin));
}
- // construction de RMap, map des reports du wire i vers le wire i-1
+ // construction of RMap, map of reports of wire i to wire i-1
TopTools_DataMapOfShapeListOfShape RMap;
RMap.Clear();
- // boucle sur i
+ // loop on i
for (i=ifin; i>ideb; i--) {
const TopoDS_Wire& wire1 = TopoDS::Wire(myWork(i));
- // sequence des vertex du premier wire
+ // sequence of vertices of the first wire
SeqOfVertices(wire1,SeqV);
if (SeqV.Length()>NbMaxV)
Standard_NoSuchObject::Raise("BRepFill::SameNumberByPolarMethod failed");
- // extremite du premier wire
+ // extremity of the first wire
V1 = TopoDS::Vertex(SeqV.Value(1));
- // wire precedent
+ // previous wire
#ifdef DEB
const TopoDS_Wire& wire2 =
#endif
TopoDS::Wire(myWork(i-1));
- // boucle sur les vertex de wire1
+ // loop on vertices of wire1
for (ii=1;ii<=SeqV.Length();ii++) {
TopoDS_Vertex Vi = TopoDS::Vertex(SeqV.Value(ii));
- // init de RMap pour Vi
+ // init of RMap for Vi
TopTools_ListOfShape Init;
Init.Clear();
RMap.Bind(Vi,Init);
- // il faut chercher l'intersection Vi - wire2
+ // it is required to find intersection Vi - wire2
gp_Pnt Pi = BRep_Tool::Pnt(Vi);
- // on ramene Pi dans le plan courant
+ // return Pi in the current plane
gp_Pnt Pnew;
Transform(WithRotation,Pi,
Pos->Value(i),Axe->Value(i),
Pos->Value(i-1),Axe->Value(i-1),Pnew);
- // calcul de l'intersection
+ // calculate the intersection
TopoDS_Shape Support;
Standard_Boolean NewVertex;
TopoDS_Vertex Vsol;
RMap(Vi).Append(Vsol);
}
- } // boucle sur ii
- } // boucle sur i
+ } // loop on ii
+ } // loop on i
- // initialisation de MapVLV, map des correspondances vertex - liste de vertex
+ // initialisation of MapVLV, map of correspondences vertex - list of vertices
TopTools_DataMapOfShapeListOfShape MapVLV;
SeqOfVertices(TopoDS::Wire(myWork(ideb)),SeqV);
Standard_Integer SizeMap = SeqV.Length();
while (tantque) {
MapVLV(Vi).Append(V1);
NbV++;
- // test sur NbV necessaire pour les sections bouclantes
+ // test on NbV required for looping sections
if (V1.IsSame(Vi) || NbV >= myWork.Length()) {
tantque = Standard_False;
}
}
}
- // boucle sur i
+ // loop on i
for (i=ideb; i<ifin; i++) {
const TopoDS_Wire& wire1 = TopoDS::Wire(myWork(i));
- // sequence des vertex du premier wire
+ // sequence of vertices of the first wire
SeqOfVertices(wire1,SeqV);
if ( SeqV.Length()>NbMaxV || SeqV.Length()>SizeMap )
Standard_NoSuchObject::Raise("BRepFill::SameNumberByPolarMethod failed");
- // extremite du premier wire
+ // extremity of the first wire
V1 = TopoDS::Vertex(SeqV.Value(1));
- // wire suivant
+ // next wire
const TopoDS_Wire& wire2 = TopoDS::Wire(myWork(i+1));
- // boucle sur les vertex de wire1
+ // loop on vertices of wire1
for (ii=1;ii<=SeqV.Length();ii++) {
TopoDS_Vertex Vi = TopoDS::Vertex(SeqV.Value(ii));
}
if (intersect) {
- // il faut chercher l'intersection Vi - wire2
+ // it is necessary to find intersection Vi - wire2
gp_Pnt Pi = BRep_Tool::Pnt(Vi);
- // on ramene Pi dans le plan courant
+ // return Pi in the current plane
gp_Pnt Pnew;
Transform(WithRotation,Pi,
Pos->Value(i),Axe->Value(i),
Pos->Value(i+1),Axe->Value(i+1),Pnew);
- // calcul de l'intersection
+ // calculate the intersection
TopoDS_Shape Support;
Standard_Boolean NewVertex;
TopoDS_Vertex Vsol;
}
}
- } // boucle sur ii
- } // boucle sur i
+ } // loop on ii
+ } // loop on i
- // mise en ordre des wires en suivant MapVLV
+ // regularize wires following MapVLV
TopoDS_Wire wire = TopoDS::Wire(myWork(ideb));
- // sauf le dernier si les sections sont bouclantes
+ // except for the last if the sections loop
Standard_Integer ibout = ifin;
if (vClosed) ibout--;
TopoDS_Vertex VVF,VVL;
TopExp::Vertices(E,VVF,VVL,Standard_True);
- // tri des edges candidates
+ // parse candidate edges
Standard_Real scal1,scal2;
if ( (V1.IsSame(VVF)&&V2.IsSame(VVL)) || (V2.IsSame(VVF)&&V1.IsSame(VVL)) ) {
Standard_Real U1 = BRep_Tool::Parameter(VVF,E);
TopoDS_Vertex VVF,VVL;
TopExp::Vertices(E,VVF,VVL,Standard_True);
- // tri des edges candidates
+ // parse candidate edges
Standard_Real scal1,scal2;
U1 = BRep_Tool::Parameter(VVF,E);
U2 = BRep_Tool::Parameter(VVL,E);
myWork(i) = MW.Wire();
}
- // sections bouclantes ?
+ // blocking sections?
if (vClosed) myWork(myWork.Length()) = myWork(1);
- // verification du nombre d'edges pour debug
+ // check the number of edges for debug
Standard_Integer nbmax=0, nbmin=0;
for ( i=ideb; i<=ifin; i++) {
Standard_Integer nbEdges=0;
Standard_Integer ideb=1, ifin=myWork.Length();
BRepTools_WireExplorer anExp;
- // sections ponctuelles, sections bouclantes ?
+ // point sections, blocking sections?
if (myDegen1) ideb++;
if (myDegen2) ifin--;
Standard_Boolean vClosed = (!myDegen1) && (!myDegen2)
}
if (nbmax>1) {
- // plusieurs edges
+ // several edges
if (report || nbmin<nbmax) {
- // insertion des decoupes
+ // insertion of cuts
Standard_Integer nbdec=(nbmax-1)*nbSects+1;
Standard_Real tol = 0.01;
TColStd_Array1OfReal dec(1,nbdec);
dec.Init(0);
dec(2)=1;
- // calcul du tableau des decoupes
+ // calculate the table of cuts
Standard_Integer j,k,l;
for (i=1; i<=nbSects; i++) {
- // wire courant
+ // current wire
const TopoDS_Wire& wire1 = TopoDS::Wire(myWork(i));
Standard_Integer nbE = 0;
for(anExp.Init(wire1); anExp.More(); anExp.Next()) {
nbE++;
}
- // longueur et ACR du wire
+ // length and ACR of the wire
TColStd_Array1OfReal ACR(0,nbE);
ACR.Init(0);
BRepFill::ComputeACR(wire1, ACR);
- // insertion des ACR du wire dans le tableau des decoupes
+ // insertion of ACR of the wire in the table of cuts
for (j=1; j<ACR.Length()-1; j++) {
k=1;
while (dec(k)<ACR(j)) {
}
}
- // tableau effectif des decoupes
+ // table of cuts
k=1;
while (dec(k)<1) {
k++;
dec2(k) = dec(k);
}
- // insertion des decoupes dans chaque wire
+ // insertion of cuts in each wire
for (i=1; i<=nbSects; i++) {
const TopoDS_Wire& oldwire = TopoDS::Wire(myWork(i));
TopoDS_Wire newwire = BRepFill::InsertACR(oldwire, dec2, tol);
}
}
- // sections bouclantes ?
+ // blocking sections ?
if (vClosed) myWork(myWork.Length()) = myWork(1);
- // verification du nombre d'edges pour debug
+ // check the number of edges for debug
nbmax = 0;
for (i=ideb; i<=ifin; i++) {
nbEdges(i) = 0;
Standard_Integer NbSects = myWork.Length();
Standard_Integer i, ideb=1,ifin=NbSects;
- // sections ponctuelles, sections bouclantes
+ // point sections, blocking sections
if (myDegen1) ideb++;
if (myDegen2) ifin--;
Standard_Boolean vClosed = (!myDegen1) && (!myDegen2)
for (i=ideb; i<=ifin; i++) {
wClosed = myWork(i).Closed();
if (!wClosed) {
- // on regarde quand meme si les vertex sont les memes.
+ // check if the vertices are the same.
TopoDS_Vertex V1, V2;
TopExp::Vertices(TopoDS::Wire(myWork(i)),V1,V2);
if ( V1.IsSame(V2)) wClosed = Standard_True;
Standard_NoSuchObject::Raise("BRepFill_CompatibleWires::ComputeOrigin : the wires must be closed");
/*
- // Nombre max de decoupes possibles
+ // Max number of possible cuts
Standard_Integer NbMaxV = 0;
for (i=1; i<=NbSects; i++) {
for(anExp.Init(TopoDS::Wire(myWork(i))); anExp.More(); anExp.Next()) {
}
}
- // construction des tableaux de plans des wires
+ // construction of tables of planes of wires
gp_Pln P;
Handle(TColgp_HArray1OfPnt) Pos
= new (TColgp_HArray1OfPnt) (1,NbSects);
Standard_Boolean forward;
if (i == myWork.Length() && myDegen2)
{
- // derniere section ponctuelle
+ // last point section
jmin = 1;
forward = Standard_True;
}
}
*/
- // sections bouclantes ?
+ // blocking sections ?
if (vClosed) myWork(myWork.Length()) = myWork(1);
}
if (isline0 || isline) {
- // cas particulier des segments de droite
+ // particular case of straight segments
gp_Pnt P1 = BRep_Tool::Pnt(Vdeb),
P2 = BRep_Tool::Pnt(Vfin);
Standard_Real dist1, dist2;
//OCC86
gp_Pnt P1 = BRep_Tool::Pnt(Vdeb), P1o = Pdeb,
P2 = BRep_Tool::Pnt(Vfin), P2o = Pfin;
-/* // on ramene Pdeb dans le plan courant
+/* // return Pdeb in the current plane
gp_Pnt Pnew = Pdeb.Translated (P0.Location(),P.Location());
gp_Ax1 A0 = P0.Axis();
gp_Ax1 A1 = P.Axis();
parcours = (AStraight < PI/2.0? Standard_True: Standard_False);
}
- // reconstruction du wire
+ // reconstruction of the wire
Standard_Integer rang;
if (parcours) {
for (rang=1;rang<=nbEdges;rang++) {
}
}
- // orientation du wire
+ // orientation of the wire
newwire.Oriented(TopAbs_FORWARD);
myWork(i) = newwire;
- // on passe au wire suivant
+ // passe to the next wire
if (parcours) {
Pdeb = BRep_Tool::Pnt(Vdeb);
Pfin = BRep_Tool::Pnt(Vfin);
E0 = E;
}
- // sections bouclantes ?
+ // blocking sections ?
if (vClosed) myWork(myWork.Length()) = myWork(1);
}
while(!Triee);
//
infinite_roots=Standard_False;
- if(NbRoots==0) {
- //--!!!!! Detection du cas Pol = Cte ( 1e-50 ) !!!!
+ if(NbRoots==0) { //--!!!!! Detect case Pol = Cte ( 1e-50 ) !!!!
if((Abs(CC) + Abs(SC) + Abs(C) + Abs(S)) < 1e-10) {
if(Abs(Cte) < 1e-10) {
infinite_roots=Standard_True;
} // else #1
} // if(MTFR.IsDone()) {
else {
- // on essaie en mettant les tres petits coeff. a ZERO
+ // try to set very small coefficients to ZERO
if (Abs(CC)<1e-10) {
cc = 0.0;
}
Extrema_ExtElC::Extrema_ExtElC (const gp_Lin& C1,
const gp_Lin& C2,
const Standard_Real)
-// Fonction:
-// Recherche de la distance minimale entre 2 droites.
+// Function:
+// Find min distance between 2 straight lines.
-// Methode:
-// Soit D1 et D2, les 2 directions des droites C1 et C2.
-// 2 cas sont consideres:
-// 1- si Angle(D1,D2) < AngTol, les droites sont paralleles.
-// La distance est la distance entre un point quelconque de C1 et la droite
-// C2.
-// 2- si Angle(D1,D2) > AngTol:
-// Soit P1=C1(u1) et P2=C2(u2) les 2 points solutions:
-// Alors, ( P1P2.D1 = 0. (1)
+// Method:
+// Let D1 and D2, be 2 directions of straight lines C1 and C2.
+// 2 cases are considered:
+// 1- if Angle(D1,D2) < AngTol, straight lines are parallel.
+// The distance is the distance between a point of C1 and the straight line C2.
+// 2- if Angle(D1,D2) > AngTol:
+// Let P1=C1(u1) and P2=C2(u2) be 2 solution points:
+// Then, ( P1P2.D1 = 0. (1)
// ( P1P2.D2 = 0. (2)
-// Soit O1 et O2 les origines de C1 et C2;
-// Alors, (1) <=> (O1P2-u1*D1).D1 = 0. car O1P1 = u1*D1
-// <=> u1 = O1P2.D1 car D1.D1 = 1.
-// (2) <=> (P1O2+u2*D2).D2 = 0. car O2P2 = u2*D2
-// <=> u2 = O2P1.D2 car D2.D2 = 1.
+// Let O1 and O2 be the origins of C1 and C2;
+// THen, (1) <=> (O1P2-u1*D1).D1 = 0. as O1P1 = u1*D1
+// <=> u1 = O1P2.D1 as D1.D1 = 1.
+// (2) <=> (P1O2+u2*D2).D2 = 0. as O2P2 = u2*D2
+// <=> u2 = O2P1.D2 as D2.D2 = 1.
// <=> u2 = (O2O1+O1P1).D2
-// <=> u2 = O2O1.D2+((O1P2.T1)T1).T2) car O1P1 = u1*T1 = (O1P2.T1)T1
+// <=> u2 = O2O1.D2+((O1P2.T1)T1).T2) as O1P1 = u1*T1 = (O1P2.T1)T1
// <=> u2 = O2O1.D2+(((O1O2+O2P2).D1)D1).D2)
// <=> u2 = O2O1.D2+((O1O2.D1)D1).D2)+(O2P2.D1)(D1.D2)
// <=> u2 = ((O1O2.D1)D1-O1O2).D2 + u2*(D2.D1)(D1.D2)
const Standard_Real)
/*-----------------------------------------------------------------------------
Fonction:
- Recherche des distances extremales entre la droite C1 et le cercle C2.
+ Find extreme distances between straight line C1 and circle C2.
-Methode:
- Soit P1=C1(u1) et P2=C2(u2) deux points solutions
- D la direction de la droite C1
- T la tangente au point P2;
- Alors, ( P1P2.D = 0. (1)
+Method:
+ Let P1=C1(u1) and P2=C2(u2) be two solution points
+ D the direction of straight line C1
+ T tangent at point P2;
+ Then, ( P1P2.D = 0. (1)
( P1P2.T = 0. (2)
- Soit O1 et O2 les origines de C1 et C2;
- Alors, (1) <=> (O1P2-u1*D).D = 0. car O1P1 = u1*D
- <=> u1 = O1P2.D car D.D = 1.
- (2) <=> P1O2.T = 0. car O2P2.T = 0.
- <=> ((P2O1.D)D+O1O2).T = 0. car P1O1 = -u1*D = (P2O1.D)D
+ Let O1 and O2 be the origins of C1 and C2;
+ Then, (1) <=> (O1P2-u1*D).D = 0. as O1P1 = u1*D
+ <=> u1 = O1P2.D as D.D = 1.
+ (2) <=> P1O2.T = 0. as O2P2.T = 0.
+ <=> ((P2O1.D)D+O1O2).T = 0. as P1O1 = -u1*D = (P2O1.D)D
<=> (((P2O2+O2O1).D)D+O1O2).T = 0.
<=> ((P2O2.D)(D.T)+((O2O1.D)D-O2O1).T = 0.
- On se place dans le repere du cercle; soit:
- Cos = Cos(u2) et Sin = Sin(u2),
+ We are in the reference of the circle; let:
+ Cos = Cos(u2) and Sin = Sin(u2),
P2 (R*Cos,R*Sin,0.),
T (-R*Sin,R*Cos,0.),
D (Dx,Dy,Dz),
V (Vx,Vy,Vz) = (O2O1.D)D-O2O1;
- Alors, on obtient l'equation en Cos et Sin suivante:
+ Then, the equation by Cos and Sin is as follows:
-(2*R*R*Dx*Dy) * Cos**2 + A1
R*R*(Dx**2-Dy**2) * Cos*Sin + 2* A2
R*Vy * Cos + A3
-R*Vx * Sin + A4
R*R*Dx*Dy = 0. A5
- On utilise l'algorithme math_TrigonometricFunctionRoots pour resoudre
- cette equation.
+ Use the algorithm math_TrigonometricFunctionRoots to solve this equation.
-----------------------------------------------------------------------------*/
{
Standard_Real Dx,Dy,Dz,aRO2O1, aTolRO2O1;
myIsPar = Standard_False;
myDone = Standard_False;
myNbExt = 0;
- //
- // Calcul de T1 dans le repere du cercle ...
+
+// Calculate T1 in the reference of the circle ...
D = C1.Direction();
D1 = D;
x2 = C2.XAxis().Direction();
//modified by NIZNHY-PKV Wed Sep 21 07:45:42 2011t
//
gp_XYZ Vxyz = (D.XYZ()*(O2O1.Dot(D)))-O2O1.XYZ();
- //
- // Calcul des coefficients de l equation en Cos et Sin ...
+
+// Calculate the coefficients of the equation by Cos and Sin ...
aTol=1.e-12;
R = C2.Radius();
A5 = R*R*Dx*Dy;
myDone = Standard_True;
return;
}
- //
- // Stockage des solutions ...
+// Storage of solutions ...
Standard_Integer NoSol, NbSol;
Standard_Real U1,U2;
gp_Pnt P1,P2;
const gp_Elips& C2)
{
/*-----------------------------------------------------------------------------
-Fonction:
- Recherche des distances extremales entre la droite C1 et l ellipse C2.
+Function:
+ Find extreme distances between straight line C1 and ellipse C2.
-Methode:
- Soit P1=C1(u1) et P2=C2(u2) deux points solutions
- D la direction de la droite C1
- T la tangente au point P2;
- Alors, ( P1P2.D = 0. (1)
+Method:
+ Let P1=C1(u1) and P2=C2(u2) two solution points
+ D the direction of straight line C1
+ T the tangent to point P2;
+ Then, ( P1P2.D = 0. (1)
( P1P2.T = 0. (2)
- Soit O1 et O2 les origines de C1 et C2;
- Alors, (1) <=> (O1P2-u1*D).D = 0. car O1P1 = u1*D
- <=> u1 = O1P2.D car D.D = 1.
- (2) <=> P1O2.T = 0. car O2P2.T = 0.
- <=> ((P2O1.D)D+O1O2).T = 0. car P1O1 = -u1*D = (P2O1.D)D
+ Let O1 and O2 be the origins of C1 and C2;
+ Then, (1) <=> (O1P2-u1*D).D = 0. as O1P1 = u1*D
+ <=> u1 = O1P2.D as D.D = 1.
+ (2) <=> P1O2.T = 0. as O2P2.T = 0.
+ <=> ((P2O1.D)D+O1O2).T = 0. as P1O1 = -u1*D = (P2O1.D)D
<=> (((P2O2+O2O1).D)D+O1O2).T = 0.
<=> ((P2O2.D)(D.T)+((O2O1.D)D-O2O1).T = 0.
- On se place dans le repere de l ellipse; soit:
- Cos = Cos(u2) et Sin = Sin(u2),
+ We are in the reference of the ellipse; let:
+ Cos = Cos(u2) and Sin = Sin(u2),
P2 (MajR*Cos,MinR*Sin,0.),
T (-MajR*Sin,MinR*Cos,0.),
D (Dx,Dy,Dz),
V (Vx,Vy,Vz) = (O2O1.D)D-O2O1;
- Alors, on obtient l'equation en Cos et Sin suivante:
+ Then, get the following equation by Cos and Sin:
-(2*MajR*MinR*Dx*Dy) * Cos**2 +
(MajR*MajR*Dx**2-MinR*MinR*Dy**2) * Cos*Sin +
MinR*Vy * Cos +
- MajR*Vx * Sin +
MinR*MajR*Dx*Dy = 0.
- On utilise l'algorithme math_TrigonometricFunctionRoots pour resoudre
- cette equation.
+ Use algorithm math_TrigonometricFunctionRoots to solve this equation.
-----------------------------------------------------------------------------*/
myIsPar = Standard_False;
myDone = Standard_False;
myNbExt = 0;
-// Calcul de T1 dans le repere de l'ellipse ...
+// Calculate T1 the reference of the ellipse ...
gp_Dir D = C1.Direction();
gp_Dir D1 = D;
gp_Dir x2, y2, z2;
Standard_Real Dz = D.Dot(z2);
D.SetCoord(Dx,Dy,Dz);
-// Calcul de V ...
+// Calculate V ...
gp_Pnt O1 = C1.Location();
gp_Pnt O2 = C2.Location();
gp_Vec O2O1 (O2,O1);
O2O1.SetCoord(O2O1.Dot(x2), O2O1.Dot(y2), O2O1.Dot(z2));
gp_XYZ Vxyz = (D.XYZ()*(O2O1.Dot(D)))-O2O1.XYZ();
-// Calcul des coefficients de l equation en Cos et Sin ...
+// Calculate the coefficients of the equation by Cos and Sin ...
Standard_Real MajR = C2.MajorRadius();
Standard_Real MinR = C2.MinorRadius();
Standard_Real A5 = MajR*MinR*Dx*Dy;
ExtremaExtElC_TrigonometricRoots Sol(A1,A2,A3,A4,A5,0.,PI+PI);
if (!Sol.IsDone()) { return; }
-// Stockage des solutions ...
+// Storage of solutions ...
gp_Pnt P1,P2;
Standard_Real U1,U2;
Standard_Integer NbSol = Sol.NbSolutions();
const gp_Hypr& C2)
{
/*-----------------------------------------------------------------------------
-Fonction:
- Recherche des distances extremales entre la droite C1 et l'hyperbole C2.
+Function:
+ Find extrema between straight line C1 and hyperbola C2.
-Methode:
- Soit P1=C1(u1) et P2=C2(u2) deux points solutions
- D la direction de la droite C1
- T la tangente au point P2;
- Alors, ( P1P2.D = 0. (1)
- ( P1P2.T = 0. (2)
- Soit O1 et O2 les origines de C1 et C2;
- Alors, (1) <=> (O1P2-u1*D).D = 0. car O1P1 = u1*D
- <=> u1 = O1P2.D car D.D = 1.
+Method:
+ Let P1=C1(u1) and P2=C2(u2) be two solution points
+ D the direction of straight line C1
+ T the tangent at point P2;
+ Then, ( P1P2.D = 0. (1)
+ ( P1P2.T = 0. (2)
+ Let O1 and O2 be the origins of C1 and C2;
+ Then, (1) <=> (O1P2-u1*D).D = 0. as O1P1 = u1*D
+ <=> u1 = O1P2.D as D.D = 1.
(2) <=> (P1O2 + O2P2).T= 0.
- <=> ((P2O1.D)D+O1O2 + O2P2).T = 0. car P1O1 = -u1*D = (P2O1.D)D
+ <=> ((P2O1.D)D+O1O2 + O2P2).T = 0. as P1O1 = -u1*D = (P2O1.D)D
<=> (((P2O2+O2O1).D)D+O1O2 + O2P2).T = 0.
<=> (P2O2.D)(D.T)+((O2O1.D)D-O2O1).T + O2P2.T= 0.
- On se place dans le repere de l'hyperbole; soit:
- en ecrivant P (R* Chu, r* Shu, 0.0)
- et Chu = (v**2 + 1)/(2*v) ,
- Shu = (V**2 - 1)/(2*v)
+ We are in the reference of the hyperbola; let:
+ by writing P (R* Chu, r* Shu, 0.0)
+ and Chu = (v**2 + 1)/(2*v) ,
+ Shu = (V**2 - 1)/(2*v)
T(R*Shu, r*Chu)
D (Dx,Dy,Dz),
V (Vx,Vy,Vz) = (O2O1.D)D-O2O1;
- Alors, on obtient l'equation en v suivante:
+ Then we obtain the following equation by v:
(-2*R*r*Dx*Dy - R*R*Dx*Dx-r*r*Dy*Dy + R*R + r*r) * v**4 +
(2*R*Vx + 2*r*Vy) * v**3 +
(-2*R*Vx + 2*r*Vy) * v +
(-2*R*r*Dx*Dy - (R*R*Dx*Dx-r*r*Dy*Dy + R*R + r*r)) = 0
- On utilise l'algorithme math_DirectPolynomialRoots pour resoudre
- cette equation.
+ Use the algorithm math_DirectPolynomialRoots to solve this equation.
-----------------------------------------------------------------------------*/
myIsPar = Standard_False;
myDone = Standard_False;
myNbExt = 0;
-// Calcul de T1 dans le repere de l'hyperbole ...
+// Calculate T1 in the reference of the hyperbola...
gp_Dir D = C1.Direction();
gp_Dir D1 = D;
gp_Dir x2, y2, z2;
Standard_Real Dz = D.Dot(z2);
D.SetCoord(Dx,Dy,Dz);
-// Calcul de V ...
+// Calculate V ...
gp_Pnt O1 = C1.Location();
gp_Pnt O2 = C2.Location();
gp_Vec O2O1 (O2,O1);
Standard_Real Vx = Vxyz.X();
Standard_Real Vy = Vxyz.Y();
-// Calcul des coefficients de l equation en v
+// Calculate coefficients of the equation by v
Standard_Real R = C2.MajorRadius();
Standard_Real r = C2.MinorRadius();
Standard_Real a = -2*R*r*Dx*Dy;
math_DirectPolynomialRoots Sol(A1,A2,0.0,A4, A5);
if (!Sol.IsDone()) { return; }
-// Stockage des solutions ...
+// Store solutions ...
gp_Pnt P1,P2;
Standard_Real U1,U2, v;
Standard_Integer NbSol = Sol.NbSolutions();
const gp_Parab& C2)
{
/*-----------------------------------------------------------------------------
-Fonction:
- Recherche des distances extremales entre la droite C1 et la parabole C2.
+Function:
+ Find extreme distances between straight line C1 and parabole C2.
-Methode:
- Soit P1=C1(u1) et P2=C2(u2) deux points solutions
- D la direction de la droite C1
- T la tangente au point P2;
- Alors, ( P1P2.D = 0. (1)
- ( P1P2.T = 0. (2)
- Soit O1 et O2 les origines de C1 et C2;
- Alors, (1) <=> (O1P2-u1*D).D = 0. car O1P1 = u1*D
- <=> u1 = O1P2.D car D.D = 1.
+Method:
+ Let P1=C1(u1) and P2=C2(u2) be two solution points
+ D the direction of straight line C1
+ T the tangent to point P2;
+ Then, ( P1P2.D = 0. (1)
+ ( P1P2.T = 0. (2)
+ Let O1 and O2 be the origins of C1 and C2;
+ Then, (1) <=> (O1P2-u1*D).D = 0. as O1P1 = u1*D
+ <=> u1 = O1P2.D as D.D = 1.
(2) <=> (P1O2 + O2P2).T= 0.
- <=> ((P2O1.D)D+O1O2 + O2P2).T = 0. car P1O1 = -u1*D = (P2O1.D)D
+ <=> ((P2O1.D)D+O1O2 + O2P2).T = 0. as P1O1 = -u1*D = (P2O1.D)D
<=> (((P2O2+O2O1).D)D+O1O2 + O2P2).T = 0.
<=> (P2O2.D)(D.T)+((O2O1.D)D-O2O1).T + O2P2.T = 0.
- On se place dans le repere de la parabole; soit:
+ We are in the reference of the parabola; let:
P2 (y*y/(2*p), y, 0)
T (y/p, 1, 0)
D (Dx,Dy,Dz),
V (Vx,Vy,Vz) = (O2O1.D)D-O2O1;
- Alors, on obtient l'equation en y suivante:
+ Then, get the following equation by y:
((1-Dx*Dx)/(2*p*p)) * y*y*y + A1
(-3*Dx*Dy/(2*p)) * y*y + A2
(1-Dy*Dy + Vx/p) * y + A3
Vy = 0. A4
- On utilise l'algorithme math_DirectPolynomialRoots pour resoudre
- cette equation.
+ Use the algorithm math_DirectPolynomialRoots to solve this equation.
-----------------------------------------------------------------------------*/
myIsPar = Standard_False;
myDone = Standard_False;
myNbExt = 0;
-// Calcul de T1 dans le repere de la parabole ...
+// Calculate T1 in the reference of the parabola...
gp_Dir D = C1.Direction();
gp_Dir D1 = D;
gp_Dir x2, y2, z2;
Standard_Real Dz = D.Dot(z2);
D.SetCoord(Dx,Dy,Dz);
-// Calcul de V ...
+// Calculate V ...
gp_Pnt O1 = C1.Location();
gp_Pnt O2 = C2.Location();
gp_Vec O2O1 (O2,O1);
O2O1.SetCoord(O2O1.Dot(x2), O2O1.Dot(y2), O2O1.Dot(z2));
gp_XYZ Vxyz = (D.XYZ()*(O2O1.Dot(D)))-O2O1.XYZ();
-// Calcul des coefficients de l equation en y
+// Calculate coefficients of the equation by y
Standard_Real P = C2.Parameter();
Standard_Real A1 = (1-Dx*Dx)/(2.0*P*P);
Standard_Real A2 = (-3.0*Dx*Dy/(2.0*P));
math_DirectPolynomialRoots Sol(A1,A2,A3,A4);
if (!Sol.IsDone()) { return; }
-// Stockage des solutions ...
+// Storage of solutions ...
gp_Pnt P1,P2;
Standard_Real U1,U2;
Standard_Integer NbSol = Sol.NbSolutions();