0023024: Update headers of OCCT files
[occt.git] / src / Geom2d / Geom2d_Geometry.cxx
1 // Created on: 1993-03-24
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 #include <Geom2d_Geometry.ixx>
24 #include <Standard_ConstructionError.hxx>
25
26 typedef Handle(Geom2d_Geometry) Handle(Geometry);
27 typedef Geom2d_Geometry Geometry;
28 typedef gp_Ax2d   Ax2d;
29 typedef gp_Pnt2d  Pnt2d;
30 typedef gp_Vec2d  Vec2d;
31 typedef gp_Trsf2d Trsf2d;
32
33
34
35 void Geom2d_Geometry::Mirror (const gp_Pnt2d& P) {
36    
37   Trsf2d T;
38   T.SetMirror (P);
39   Transform (T);
40 }
41
42
43
44 void Geom2d_Geometry::Mirror (const gp_Ax2d& A) {
45
46   Trsf2d T;
47   T.SetMirror (A);
48   Transform (T);
49 }
50
51
52 void Geom2d_Geometry::Rotate (const gp_Pnt2d& P, const Standard_Real Ang) {
53
54   Trsf2d T;
55   T.SetRotation (P, Ang);
56   Transform (T);
57 }
58
59
60 void Geom2d_Geometry::Scale (const gp_Pnt2d& P, const Standard_Real S) {
61
62   Trsf2d T;
63   T.SetScale (P, S);
64   Transform (T);
65 }
66
67
68 void Geom2d_Geometry::Translate (const gp_Vec2d& V) {
69
70   Trsf2d T;
71   T.SetTranslation (V);
72   Transform (T);
73 }
74
75
76 void Geom2d_Geometry::Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2) {
77
78   Vec2d V (P1, P2);
79   Translate (V);
80 }
81
82
83  Handle(Geometry) Geom2d_Geometry::Mirrored (const gp_Pnt2d& P) const {
84
85   Handle(Geometry) me = this;
86   Handle(Geometry) G = me->Copy();
87   G->Mirror (P);
88   return G;
89 }
90
91
92 Handle(Geometry) Geom2d_Geometry::Mirrored (const gp_Ax2d& A) const {
93
94   Handle(Geometry) me = this;
95   Handle(Geometry) G = me->Copy();
96   G->Mirror (A);
97   return G;
98 }
99
100
101 Handle(Geometry) Geom2d_Geometry::Rotated (
102 const gp_Pnt2d& P, const Standard_Real Ang) const {
103
104   Handle(Geometry) me = this;
105   Handle(Geometry) G = me->Copy();
106   G->Rotate (P, Ang);
107   return G;
108 }
109
110
111 Handle(Geometry) Geom2d_Geometry::Scaled (
112 const gp_Pnt2d& P,  const Standard_Real S) const {
113
114   Handle(Geometry) me = this;
115   Handle(Geometry) G = me->Copy();
116   G->Scale (P, S);
117   return G;
118 }
119
120
121 Handle(Geometry) Geom2d_Geometry::Transformed (const gp_Trsf2d& T) const {
122
123   Handle(Geometry) me = this;
124   Handle(Geometry) G = me->Copy();
125   G->Transform (T);
126   return G;
127 }
128
129
130 Handle(Geometry) Geom2d_Geometry::Translated (const gp_Vec2d& V) const {
131
132   Handle(Geometry) me = this;
133   Handle(Geometry) G = me->Copy();
134   G->Translate (V);
135   return G;
136 }
137
138
139 Handle(Geometry) Geom2d_Geometry::Translated (
140 const gp_Pnt2d& P1, const gp_Pnt2d& P2) const {
141
142   Handle(Geometry) me = this;
143   Handle(Geometry) G = me->Copy();
144   G->Translate (P1, P2);
145   return G;
146 }