0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / IntAna2d / IntAna2d_AnaIntersection_7.cxx
CommitLineData
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//============================================================================
17#include <IntAna2d_AnaIntersection.jxx>
18
19#include <IntAna2d_Outils.hxx>
20
21void IntAna2d_AnaIntersection::Perform(const gp_Parab2d& P,
22 const IntAna2d_Conic& Conic)
23 {
24 Standard_Boolean PIsDirect = P.IsDirect();
25 Standard_Real A,B,C,D,E,F;
26 Standard_Real px4,px3,px2,px1,px0;
27 Standard_Integer i;
28 Standard_Real tx,ty,S;
29 Standard_Real un_sur_2p=0.5/(P.Parameter());
30 gp_Ax2d Axe_rep(P.MirrorAxis());
31
32 done = Standard_False;
33 nbp = 0;
34 para = Standard_False;
35 empt = Standard_False;
36 iden = Standard_False;
37
38 Conic.Coefficients(A,B,C,D,E,F);
39 Conic.NewCoefficients(A,B,C,D,E,F,Axe_rep);
40
41 //-------- 'Parametre' y avec y=y x=y^2/(2 p)
42
43 px0=F;
44 px1=E+E;
45 px2=B + un_sur_2p*(D+D);
46 px3=(C+C)*un_sur_2p;
47 px4=A*(un_sur_2p*un_sur_2p);
48
49 MyDirectPolynomialRoots Sol(px4,px3,px2,px1,px0);
50
51 if(!Sol.IsDone()) {
52 done=Standard_False;
53 }
54 else {
55 if(Sol.InfiniteRoots()) {
56 iden=Standard_True;
57 done=Standard_True;
58 }
59 nbp=Sol.NbSolutions();
60 for(i=1;i<=nbp;i++) {
61 S = Sol.Value(i);
62 tx=un_sur_2p*S*S;
63 ty=S;
64 Coord_Ancien_Repere(tx,ty,Axe_rep);
65 if(!PIsDirect)
66 S =-S;
67 lpnt[i-1].SetValue(tx,ty,S);
68 }
69 Traitement_Points_Confondus(nbp,lpnt);
70 }
71 done=Standard_True;
72 }
73
74
75
76
77
78
79
80