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