b311480e |
1 | // Created on: 1992-10-02 |
2 | // Created by: Remi GILET |
3 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | #include <GC_MakePlane.ixx> |
18 | #include <gce_MakePln.hxx> |
19 | #include <gp.hxx> |
20 | #include <gp_Ax3.hxx> |
21 | #include <TColgp_Array1OfPnt.hxx> |
22 | #include <StdFail_NotDone.hxx> |
23 | #include <Standard_NotImplemented.hxx> |
24 | |
25 | |
26 | GC_MakePlane::GC_MakePlane(const gp_Ax2& ) //A2) |
27 | { |
28 | Standard_NotImplemented::Raise("GC_MakePlane"); |
29 | } |
30 | |
31 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl) |
32 | { |
33 | TheError = gce_Done; |
34 | ThePlane = new Geom_Plane(Pl); |
35 | } |
36 | |
37 | GC_MakePlane::GC_MakePlane(const gp_Pnt& P, |
38 | const gp_Dir& V) |
39 | { |
40 | TheError = gce_Done; |
41 | ThePlane = new Geom_Plane(P,V); |
42 | } |
43 | |
44 | GC_MakePlane::GC_MakePlane(const Standard_Real A, |
45 | const Standard_Real B, |
46 | const Standard_Real C, |
47 | const Standard_Real D) |
48 | { |
49 | if (Sqrt(A*A + B*B +C*C) <= gp::Resolution()) { |
50 | TheError = gce_BadEquation; |
51 | } |
52 | else { |
53 | TheError = gce_Done; |
54 | ThePlane = new Geom_Plane(gp_Pln(A,B,C,D)); |
55 | } |
56 | } |
57 | |
58 | //========================================================================= |
59 | // Creation d un Geom_Plane passant par trois points. + |
60 | //========================================================================= |
61 | |
62 | GC_MakePlane::GC_MakePlane(const gp_Pnt& P1 , |
63 | const gp_Pnt& P2 , |
64 | const gp_Pnt& P3 ) { |
65 | gce_MakePln Pl(P1,P2,P3); |
66 | TheError = Pl.Status(); |
67 | if (TheError == gce_Done) { |
68 | ThePlane = new Geom_Plane(Pl.Value()); |
69 | } |
70 | } |
71 | |
72 | //========================================================================= |
73 | // Creation d un Geom_Plane parallele a un pln a une distance donnee. + |
74 | //========================================================================= |
75 | |
76 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl , |
77 | const Standard_Real Dist ) { |
78 | gp_Pln Pln = gce_MakePln(Pl,Dist); |
79 | TheError = gce_Done; |
80 | ThePlane = new Geom_Plane(Pln); |
81 | } |
82 | |
83 | //========================================================================= |
84 | // Creation d un Geom_Plane parallele a un pln passant par un point + |
85 | // <Point1>. + |
86 | //========================================================================= |
87 | |
88 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl , |
89 | const gp_Pnt& Point ) { |
90 | gp_Pln Pln= gce_MakePln(Pl,Point); |
91 | TheError = gce_Done; |
92 | ThePlane = new Geom_Plane(Pln); |
93 | } |
94 | |
95 | //========================================================================= |
96 | // Creation d un Geom_Plane a partir d un Ax1 (Point + Normale). + |
97 | //========================================================================= |
98 | |
99 | GC_MakePlane::GC_MakePlane(const gp_Ax1& Axis ) { |
100 | gp_Pln Pln = gce_MakePln(Axis); |
101 | TheError = gce_Done; |
102 | ThePlane = new Geom_Plane(Pln); |
103 | } |
104 | |
105 | //========================================================================= |
106 | // Creation d un Geom_Plane par un tableau de points. + |
107 | //========================================================================= |
108 | |
109 | /*GC_MakePlane::GC_MakePlane(const TColgp_Array1OfPnt& Pts , |
110 | Standard_Real ErrMax , |
111 | Standard_Real ErrMean ) { |
112 | GC_MakePln Pln(Pts,ErrMax,ErrMean); |
113 | TheError = Pln.Status(); |
114 | if (TheError == GC_Done) { |
115 | ThePlane = new Geom_Plane(Pln.Value()); |
116 | } |
117 | } |
118 | */ |
119 | |
120 | const Handle(Geom_Plane)& GC_MakePlane::Value() const |
121 | { |
82fc327c |
122 | StdFail_NotDone_Raise_if(TheError != gce_Done,""); |
7fd59977 |
123 | return ThePlane; |
124 | } |
125 | |
126 | const Handle(Geom_Plane)& GC_MakePlane::Operator() const |
127 | { |
128 | return Value(); |
129 | } |
130 | |
131 | GC_MakePlane::operator Handle(Geom_Plane) () const |
132 | { |
133 | return Value(); |
134 | } |
135 | |