7fd59977 |
1 | // File: GC_MakeCylindricalSurface.cxx |
2 | // Created: Fri Oct 2 16:35:54 1992 |
3 | // Author: Remi GILET |
4 | // <reg@topsn3> |
5 | |
6 | #include <GC_MakeCylindricalSurface.ixx> |
7 | #include <gce_MakeCylinder.hxx> |
8 | #include <gp_Lin.hxx> |
9 | #include <StdFail_NotDone.hxx> |
10 | |
11 | GC_MakeCylindricalSurface::GC_MakeCylindricalSurface(const gp_Cylinder& C) |
12 | { |
13 | TheError = gce_Done; |
14 | TheCylinder = new Geom_CylindricalSurface(C); |
15 | } |
16 | |
17 | GC_MakeCylindricalSurface::GC_MakeCylindricalSurface(const gp_Ax2& A2 , |
18 | const Standard_Real Radius) |
19 | { |
20 | if (Radius < 0.0) { TheError = gce_NegativeRadius; } |
21 | else { |
22 | TheError = gce_Done; |
23 | TheCylinder = new Geom_CylindricalSurface(A2,Radius); |
24 | } |
25 | } |
26 | |
27 | //========================================================================= |
28 | // Construction d un cylindre par axe <A1> et rayon <Radius>. + |
29 | //========================================================================= |
30 | |
31 | GC_MakeCylindricalSurface::GC_MakeCylindricalSurface(const gp_Ax1& A1 , |
32 | const Standard_Real Radius ) |
33 | { |
34 | gce_MakeCylinder Cyl = gce_MakeCylinder(A1,Radius); |
35 | TheError = Cyl.Status(); |
36 | if (TheError == gce_Done) { |
37 | TheCylinder=new Geom_CylindricalSurface(Cyl.Value()); |
38 | } |
39 | } |
40 | |
41 | //========================================================================= |
42 | // Construction d un cylindre par un cercle <Cir>. + |
43 | //========================================================================= |
44 | |
45 | GC_MakeCylindricalSurface::GC_MakeCylindricalSurface(const gp_Circ& Circ ) { |
46 | gp_Cylinder Cyl = gce_MakeCylinder(Circ); |
47 | TheCylinder=new Geom_CylindricalSurface(Cyl); |
48 | TheError = gce_Done; |
49 | } |
50 | |
51 | //========================================================================= |
52 | // Construction d un cylindre par trois points <P1>, <P2>, <P3>. + |
53 | // Les deux premiers points definissent l axe. + |
54 | // Le troisieme donne le rayon. + |
55 | //========================================================================= |
56 | |
57 | GC_MakeCylindricalSurface::GC_MakeCylindricalSurface(const gp_Pnt& P1 , |
58 | const gp_Pnt& P2 , |
59 | const gp_Pnt& P3 ) { |
60 | gce_MakeCylinder Cyl = gce_MakeCylinder(P1,P2,P3); |
61 | TheError = Cyl.Status(); |
62 | if (TheError == gce_Done) { |
63 | TheCylinder=new Geom_CylindricalSurface(Cyl.Value()); |
64 | } |
65 | } |
66 | |
67 | GC_MakeCylindricalSurface::GC_MakeCylindricalSurface(const gp_Cylinder& Cyl , |
68 | const Standard_Real Dist) |
69 | { |
70 | TheError = gce_Done; |
71 | Standard_Real R = Abs(Cyl.Radius()-Dist); |
72 | TheCylinder = new Geom_CylindricalSurface(Cyl); |
73 | TheCylinder->SetRadius(R); |
74 | } |
75 | |
76 | GC_MakeCylindricalSurface::GC_MakeCylindricalSurface(const gp_Cylinder& Cyl , |
77 | const gp_Pnt& Point) |
78 | { |
79 | TheError = gce_Done; |
80 | gp_Cylinder C(Cyl); |
81 | gp_Lin L(C.Axis()); |
82 | Standard_Real R = L.Distance(Point); |
83 | C.SetRadius(R); |
84 | TheCylinder = new Geom_CylindricalSurface(C); |
85 | } |
86 | |
87 | const Handle(Geom_CylindricalSurface)& |
88 | GC_MakeCylindricalSurface::Value() const |
89 | { |
90 | StdFail_NotDone_Raise_if(!TheError == gce_Done,""); |
91 | return TheCylinder; |
92 | } |
93 | |
94 | const Handle(Geom_CylindricalSurface)& GC_MakeCylindricalSurface::Operator() const |
95 | { |
96 | return Value(); |
97 | } |
98 | |
99 | GC_MakeCylindricalSurface::operator Handle(Geom_CylindricalSurface) () const |
100 | { |
101 | return Value(); |
102 | } |