7fd59977 |
1 | // File: BRepPrimAPI_MakeCone.cxx |
2 | // Created: Fri Jul 23 15:51:44 1993 |
3 | // Author: Remi LEQUETTE |
4 | // <rle@nonox> |
5 | |
6 | |
7 | #include <BRepPrimAPI_MakeCone.ixx> |
8 | #include <BRepBuilderAPI.hxx> |
9 | |
10 | |
11 | |
12 | #include <gp.hxx> |
13 | #include <gp_Dir.hxx> |
14 | #include <gp_Ax2.hxx> |
15 | |
16 | |
0d969553 |
17 | |
7fd59977 |
18 | static gp_Ax2 ConeComputeAxes() { |
19 | static Standard_Integer firsttime=1; |
20 | static Standard_Integer modif=0; |
21 | static Standard_Real cosa=cos(0.122); |
22 | static Standard_Real sina=sin(0.122); |
23 | static Standard_Real ux=1.0; |
24 | static Standard_Real uy=0.0; |
25 | |
26 | if(firsttime) { |
27 | modif = getenv("PRIM_CONE") != NULL; |
28 | firsttime = 0; |
29 | } |
30 | if(modif) { |
31 | Standard_Real nux = cosa*ux+sina*uy; |
32 | Standard_Real nuy =-sina*ux+cosa*uy; |
33 | ux=nux; uy=nuy; |
34 | return(gp_Ax2(gp::Origin(),gp::DZ(),gp_Dir(ux,uy,0.0))); |
35 | } |
36 | else { |
37 | return(gp::XOY()); |
38 | } |
39 | } |
40 | |
41 | |
42 | |
43 | //======================================================================= |
44 | //function : BRepPrimAPI_MakeCone |
45 | //purpose : |
46 | //======================================================================= |
47 | |
48 | BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const Standard_Real R1, |
49 | const Standard_Real R2, |
50 | const Standard_Real H) : |
51 | myCone(ConeComputeAxes(),R1, R2, H) |
52 | { |
53 | } |
54 | |
55 | |
56 | //======================================================================= |
57 | //function : BRepPrimAPI_MakeCone |
58 | //purpose : |
59 | //======================================================================= |
60 | |
61 | BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const Standard_Real R1, |
62 | const Standard_Real R2, |
63 | const Standard_Real H, |
64 | const Standard_Real angle) : |
65 | myCone( R1, R2, H) |
66 | { |
67 | myCone.Angle(angle); |
68 | } |
69 | |
70 | |
71 | //======================================================================= |
72 | //function : BRepPrimAPI_MakeCone |
73 | //purpose : |
74 | //======================================================================= |
75 | |
76 | BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const gp_Ax2& Axes, |
77 | const Standard_Real R1, |
78 | const Standard_Real R2, |
79 | const Standard_Real H) : |
80 | myCone( Axes, R1, R2, H) |
81 | { |
82 | } |
83 | |
84 | |
85 | //======================================================================= |
86 | //function : BRepPrimAPI_MakeCone |
87 | //purpose : |
88 | //======================================================================= |
89 | |
90 | BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const gp_Ax2& Axes, |
91 | const Standard_Real R1, |
92 | const Standard_Real R2, |
93 | const Standard_Real H, |
94 | const Standard_Real angle) : |
95 | myCone( Axes, R1, R2, H) |
96 | { |
97 | myCone.Angle(angle); |
98 | } |
99 | |
100 | |
101 | //======================================================================= |
102 | //function : OneAxis |
103 | //purpose : |
104 | //======================================================================= |
105 | |
106 | Standard_Address BRepPrimAPI_MakeCone::OneAxis() |
107 | { |
108 | return &myCone; |
109 | } |
110 | |
111 | |
112 | //======================================================================= |
113 | //function : Cone |
114 | //purpose : |
115 | //======================================================================= |
116 | |
117 | BRepPrim_Cone& BRepPrimAPI_MakeCone::Cone() |
118 | { |
119 | return myCone; |
120 | } |
121 | |
122 | |
123 | |