7fd59977 |
1 | // File: GC_MakePlane.cxx |
2 | // Created: Fri Oct 2 16:37:10 1992 |
3 | // Author: Remi GILET |
4 | // <reg@topsn3> |
5 | |
6 | #include <GC_MakePlane.ixx> |
7 | #include <gce_MakePln.hxx> |
8 | #include <gp.hxx> |
9 | #include <gp_Ax3.hxx> |
10 | #include <TColgp_Array1OfPnt.hxx> |
11 | #include <StdFail_NotDone.hxx> |
12 | #include <Standard_NotImplemented.hxx> |
13 | |
14 | |
15 | GC_MakePlane::GC_MakePlane(const gp_Ax2& ) //A2) |
16 | { |
17 | Standard_NotImplemented::Raise("GC_MakePlane"); |
18 | } |
19 | |
20 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl) |
21 | { |
22 | TheError = gce_Done; |
23 | ThePlane = new Geom_Plane(Pl); |
24 | } |
25 | |
26 | GC_MakePlane::GC_MakePlane(const gp_Pnt& P, |
27 | const gp_Dir& V) |
28 | { |
29 | TheError = gce_Done; |
30 | ThePlane = new Geom_Plane(P,V); |
31 | } |
32 | |
33 | GC_MakePlane::GC_MakePlane(const Standard_Real A, |
34 | const Standard_Real B, |
35 | const Standard_Real C, |
36 | const Standard_Real D) |
37 | { |
38 | if (Sqrt(A*A + B*B +C*C) <= gp::Resolution()) { |
39 | TheError = gce_BadEquation; |
40 | } |
41 | else { |
42 | TheError = gce_Done; |
43 | ThePlane = new Geom_Plane(gp_Pln(A,B,C,D)); |
44 | } |
45 | } |
46 | |
47 | //========================================================================= |
48 | // Creation d un Geom_Plane passant par trois points. + |
49 | //========================================================================= |
50 | |
51 | GC_MakePlane::GC_MakePlane(const gp_Pnt& P1 , |
52 | const gp_Pnt& P2 , |
53 | const gp_Pnt& P3 ) { |
54 | gce_MakePln Pl(P1,P2,P3); |
55 | TheError = Pl.Status(); |
56 | if (TheError == gce_Done) { |
57 | ThePlane = new Geom_Plane(Pl.Value()); |
58 | } |
59 | } |
60 | |
61 | //========================================================================= |
62 | // Creation d un Geom_Plane parallele a un pln a une distance donnee. + |
63 | //========================================================================= |
64 | |
65 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl , |
66 | const Standard_Real Dist ) { |
67 | gp_Pln Pln = gce_MakePln(Pl,Dist); |
68 | TheError = gce_Done; |
69 | ThePlane = new Geom_Plane(Pln); |
70 | } |
71 | |
72 | //========================================================================= |
73 | // Creation d un Geom_Plane parallele a un pln passant par un point + |
74 | // <Point1>. + |
75 | //========================================================================= |
76 | |
77 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl , |
78 | const gp_Pnt& Point ) { |
79 | gp_Pln Pln= gce_MakePln(Pl,Point); |
80 | TheError = gce_Done; |
81 | ThePlane = new Geom_Plane(Pln); |
82 | } |
83 | |
84 | //========================================================================= |
85 | // Creation d un Geom_Plane a partir d un Ax1 (Point + Normale). + |
86 | //========================================================================= |
87 | |
88 | GC_MakePlane::GC_MakePlane(const gp_Ax1& Axis ) { |
89 | gp_Pln Pln = gce_MakePln(Axis); |
90 | TheError = gce_Done; |
91 | ThePlane = new Geom_Plane(Pln); |
92 | } |
93 | |
94 | //========================================================================= |
95 | // Creation d un Geom_Plane par un tableau de points. + |
96 | //========================================================================= |
97 | |
98 | /*GC_MakePlane::GC_MakePlane(const TColgp_Array1OfPnt& Pts , |
99 | Standard_Real ErrMax , |
100 | Standard_Real ErrMean ) { |
101 | GC_MakePln Pln(Pts,ErrMax,ErrMean); |
102 | TheError = Pln.Status(); |
103 | if (TheError == GC_Done) { |
104 | ThePlane = new Geom_Plane(Pln.Value()); |
105 | } |
106 | } |
107 | */ |
108 | |
109 | const Handle(Geom_Plane)& GC_MakePlane::Value() const |
110 | { |
111 | StdFail_NotDone_Raise_if(!TheError == gce_Done,""); |
112 | return ThePlane; |
113 | } |
114 | |
115 | const Handle(Geom_Plane)& GC_MakePlane::Operator() const |
116 | { |
117 | return Value(); |
118 | } |
119 | |
120 | GC_MakePlane::operator Handle(Geom_Plane) () const |
121 | { |
122 | return Value(); |
123 | } |
124 | |