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. |
7fd59977 |
14 | |
0797d9d3 |
15 | #ifndef OCCT_DEBUG |
7fd59977 |
16 | #define No_Standard_RangeError |
17 | #define No_Standard_OutOfRange |
18 | #endif |
19 | |
42cf5bc1 |
20 | |
21 | #include <gp.hxx> |
22 | #include <gp_Pln.hxx> |
23 | #include <gp_Pnt.hxx> |
24 | #include <IntAna_Int3Pln.hxx> |
7fd59977 |
25 | #include <math_Gauss.hxx> |
26 | #include <math_Matrix.hxx> |
27 | #include <math_Vector.hxx> |
42cf5bc1 |
28 | #include <Standard_DomainError.hxx> |
29 | #include <StdFail_NotDone.hxx> |
7fd59977 |
30 | |
31 | IntAna_Int3Pln::IntAna_Int3Pln () : done(Standard_False) {} |
32 | |
33 | |
34 | IntAna_Int3Pln::IntAna_Int3Pln (const gp_Pln& P1, const gp_Pln& P2, |
35 | const gp_Pln& P3) { |
36 | |
37 | Perform(P1,P2,P3); |
38 | } |
39 | |
40 | void IntAna_Int3Pln::Perform (const gp_Pln& P1, const gp_Pln& P2, |
41 | const gp_Pln& P3) { |
42 | |
43 | done=Standard_False; |
7e59624d |
44 | math_Matrix M(1,3,1,3); |
45 | math_Vector V(1,3); |
7fd59977 |
46 | |
47 | P1.Coefficients(M(1,1),M(1,2),M(1,3),V(1)); |
48 | P2.Coefficients(M(2,1),M(2,2),M(2,3),V(2)); |
49 | P3.Coefficients(M(3,1),M(3,2),M(3,3),V(3)); |
50 | |
51 | math_Gauss Resol(M,gp::Resolution()); |
52 | |
53 | if (!Resol.IsDone()) { |
54 | empt=Standard_True; |
55 | } |
56 | else { |
57 | empt=Standard_False; |
58 | V=-V; |
59 | Resol.Solve(V); |
60 | pnt.SetCoord(V(1),V(2),V(3)); |
61 | } |
62 | done=Standard_True; |
63 | } |
64 | |
65 | |
66 | |