b311480e |
1 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
7fd59977 |
15 | //============================================ IntAna2d_AnaIntersection_7.cxx |
16 | //============================================================================ |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <gp_Circ2d.hxx> |
19 | #include <gp_Elips2d.hxx> |
20 | #include <gp_Hypr2d.hxx> |
21 | #include <gp_Lin2d.hxx> |
22 | #include <gp_Parab2d.hxx> |
23 | #include <IntAna2d_AnaIntersection.hxx> |
24 | #include <IntAna2d_Conic.hxx> |
25 | #include <IntAna2d_IntPoint.hxx> |
7fd59977 |
26 | #include <IntAna2d_Outils.hxx> |
42cf5bc1 |
27 | #include <Standard_OutOfRange.hxx> |
28 | #include <StdFail_NotDone.hxx> |
7fd59977 |
29 | |
30 | void IntAna2d_AnaIntersection::Perform(const gp_Parab2d& P, |
31 | const IntAna2d_Conic& Conic) |
32 | { |
33 | Standard_Boolean PIsDirect = P.IsDirect(); |
34 | Standard_Real A,B,C,D,E,F; |
35 | Standard_Real px4,px3,px2,px1,px0; |
36 | Standard_Integer i; |
37 | Standard_Real tx,ty,S; |
38 | Standard_Real un_sur_2p=0.5/(P.Parameter()); |
39 | gp_Ax2d Axe_rep(P.MirrorAxis()); |
40 | |
41 | done = Standard_False; |
42 | nbp = 0; |
43 | para = Standard_False; |
44 | empt = Standard_False; |
45 | iden = Standard_False; |
46 | |
47 | Conic.Coefficients(A,B,C,D,E,F); |
48 | Conic.NewCoefficients(A,B,C,D,E,F,Axe_rep); |
49 | |
50 | //-------- 'Parametre' y avec y=y x=y^2/(2 p) |
51 | |
52 | px0=F; |
53 | px1=E+E; |
54 | px2=B + un_sur_2p*(D+D); |
55 | px3=(C+C)*un_sur_2p; |
56 | px4=A*(un_sur_2p*un_sur_2p); |
57 | |
58 | MyDirectPolynomialRoots Sol(px4,px3,px2,px1,px0); |
59 | |
60 | if(!Sol.IsDone()) { |
61 | done=Standard_False; |
62 | } |
63 | else { |
64 | if(Sol.InfiniteRoots()) { |
65 | iden=Standard_True; |
66 | done=Standard_True; |
67 | } |
68 | nbp=Sol.NbSolutions(); |
69 | for(i=1;i<=nbp;i++) { |
70 | S = Sol.Value(i); |
71 | tx=un_sur_2p*S*S; |
72 | ty=S; |
73 | Coord_Ancien_Repere(tx,ty,Axe_rep); |
74 | if(!PIsDirect) |
75 | S =-S; |
76 | lpnt[i-1].SetValue(tx,ty,S); |
77 | } |
78 | Traitement_Points_Confondus(nbp,lpnt); |
79 | } |
80 | done=Standard_True; |
81 | } |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | |