0022939: Make B-Spline internal cache thread-safe to be used in multy-threaded mode
[occt.git] / src / Geom / Geom_Geometry.cxx
1 // Created on: 1993-03-10
2 // Created by: JCV
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23 //JCV 09/07/92 portage sur C1
24
25
26 #include <Geom_Geometry.ixx>
27 #include <Standard_ConstructionError.hxx>
28
29 typedef Handle(Geom_Geometry) Handle(Geometry);
30 typedef Geom_Geometry         Geometry;
31 typedef gp_Pnt                Pnt;
32 typedef gp_Vec                Vec;
33 typedef gp_Ax1                Ax1;
34 typedef gp_Ax2                Ax2;
35 typedef gp_Trsf               Trsf;
36
37
38
39 Handle(Geom_Geometry) Geom_Geometry::Copy() const {
40
41    Handle(Geom_Geometry) G;
42    Standard_ConstructionError::Raise();
43    return G;
44 }
45
46
47 void Geom_Geometry::Mirror (const gp_Pnt& P) {
48    
49   Trsf T;
50   T.SetMirror (P);
51   Transform (T);
52 }
53
54
55
56 void Geom_Geometry::Mirror (const gp_Ax1& A1) {
57
58   Trsf T;
59   T.SetMirror (A1);
60   Transform (T);
61 }
62
63
64 void Geom_Geometry::Mirror (const gp_Ax2& A2) {
65
66   Trsf T;
67   T.SetMirror (A2);
68   Transform (T);
69 }
70
71
72 void Geom_Geometry::Rotate (const gp_Ax1& A1, const Standard_Real Ang) {
73
74   Trsf T;
75   T.SetRotation (A1, Ang);
76   Transform (T);
77 }
78
79
80 void Geom_Geometry::Scale (const gp_Pnt& P, const Standard_Real S) {
81
82   Trsf T;
83   T.SetScale (P, S);
84   Transform (T);
85 }
86
87
88 void Geom_Geometry::Translate (const gp_Vec& V) {
89
90   Trsf T;
91   T.SetTranslation (V);
92   Transform (T);
93 }
94
95
96 void Geom_Geometry::Translate (const gp_Pnt& P1, const gp_Pnt& P2) {
97
98   Vec V (P1, P2);
99   Translate (V);
100 }
101
102
103 Handle(Geometry) Geom_Geometry::Mirrored (const gp_Pnt& P) const {
104
105   Handle(Geometry) me = this;
106   Handle(Geometry) G  = me->Copy();
107   G->Mirror (P);
108   return G;
109 }
110
111
112 Handle(Geometry) Geom_Geometry::Mirrored (const gp_Ax1& A1) const {
113
114   Handle(Geometry) me = this;
115   Handle(Geometry) G = me->Copy();
116   G->Mirror (A1);
117   return G;
118 }
119
120
121 Handle(Geometry) Geom_Geometry::Mirrored (const gp_Ax2& A2) const {
122
123   Handle(Geometry) me = this;
124   Handle(Geometry) G = me->Copy();
125   G->Mirror (A2);
126   return G;
127 }
128
129
130
131 Handle(Geometry) Geom_Geometry::Rotated (
132
133 const gp_Ax1& A1, 
134 const Standard_Real Ang
135 ) const {
136
137   Handle(Geometry) me = this;
138   Handle(Geometry) G  = me->Copy();
139   G->Rotate (A1, Ang);
140   return G;
141 }
142
143
144
145 Handle(Geometry) Geom_Geometry::Scaled (const gp_Pnt& P, const Standard_Real S) const {
146
147   Handle(Geometry) me = this;
148   Handle(Geometry) G  = me->Copy();
149   G->Scale (P, S);
150   return G;
151 }
152
153
154
155 Handle(Geometry) Geom_Geometry::Transformed (const gp_Trsf& T) const {
156
157   Handle(Geometry) me = this;
158   Handle(Geometry) G  = me->Copy();
159   G->Transform (T);
160   return G;
161 }
162
163
164
165 Handle(Geometry) Geom_Geometry::Translated (const gp_Vec& V) const {
166
167   Handle(Geometry) me = this;
168   Handle(Geometry) G  = me->Copy();
169   G->Translate (V);
170   return G;
171 }
172
173
174 Handle(Geometry) Geom_Geometry::Translated (
175
176 const gp_Pnt& P1,
177 const gp_Pnt& P2
178 ) const {
179
180    Handle(Geometry) me = this;
181    Handle(Geometry) G  = me->Copy();
182    G->Translate (P1, P2);
183    return G;
184 }
185
186