1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <gp_Circ2d.hxx>
17 #include <gp_Elips2d.hxx>
18 #include <gp_Hypr2d.hxx>
19 #include <gp_Lin2d.hxx>
20 #include <gp_Parab2d.hxx>
21 #include <IntAna2d_AnaIntersection.hxx>
22 #include <IntAna2d_Conic.hxx>
23 #include <IntAna2d_IntPoint.hxx>
24 #include <Standard_OutOfRange.hxx>
25 #include <StdFail_NotDone.hxx>
27 void IntAna2d_AnaIntersection::Perform (const gp_Lin2d& L1,
31 done = Standard_False;
33 Standard_Real A1,B1,C1;
34 Standard_Real A2,B2,C2;
35 L1.Coefficients(A1,B1,C1);
36 L2.Coefficients(A2,B2,C2);
38 Standard_Real al1,be1,ga1;
39 Standard_Real al2,be2,ga2;
41 Standard_Real Det =Max (Abs(A1),Max(Abs(A2),Max(Abs(B1),Abs(B2))));
51 else if (Abs(B1)==Det) {
59 else if (Abs(A2)==Det) {
76 Standard_Real rap=al2/al1;
77 Standard_Real denom=be2-rap*be1;
79 if (Abs(denom)<=RealEpsilon()) { // Directions confondues
82 if (Abs(ga2-rap*ga1)<=RealEpsilon()) { // Droites confondues
86 else { // Droites paralleles
96 Standard_Real XS = (be1*ga2/al1-be2*ga1/al1)/denom;
97 Standard_Real YS = (rap*ga1-ga2)/denom;
99 if (((Abs(A1)!=Det)&&(Abs(B1)==Det))||
100 ((Abs(A1)!=Det)&&(Abs(B1)!=Det)&&(Abs(A2)!=Det))) {
101 Standard_Real temp=XS;
107 if (Abs(A1)>=Abs(B1)) {
108 La=(YS-L1.Location().Y())/A1;
111 La=(L1.Location().X()-XS)/B1;
113 if (Abs(A2)>=Abs(B2)) {
114 Mu=(YS-L2.Location().Y())/A2;
117 Mu=(L2.Location().X()-XS)/B2;
119 lpnt[0].SetValue(XS,YS,La,Mu);