0024428: Implementation of LGPL license
[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-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public version 2.1 as published
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <Geom2d_Geometry.ixx>
18 #include <Standard_ConstructionError.hxx>
19
20 typedef Handle(Geom2d_Geometry) Handle(Geometry);
21 typedef Geom2d_Geometry Geometry;
22 typedef gp_Ax2d   Ax2d;
23 typedef gp_Pnt2d  Pnt2d;
24 typedef gp_Vec2d  Vec2d;
25 typedef gp_Trsf2d Trsf2d;
26
27
28
29 void Geom2d_Geometry::Mirror (const gp_Pnt2d& P) {
30    
31   Trsf2d T;
32   T.SetMirror (P);
33   Transform (T);
34 }
35
36
37
38 void Geom2d_Geometry::Mirror (const gp_Ax2d& A) {
39
40   Trsf2d T;
41   T.SetMirror (A);
42   Transform (T);
43 }
44
45
46 void Geom2d_Geometry::Rotate (const gp_Pnt2d& P, const Standard_Real Ang) {
47
48   Trsf2d T;
49   T.SetRotation (P, Ang);
50   Transform (T);
51 }
52
53
54 void Geom2d_Geometry::Scale (const gp_Pnt2d& P, const Standard_Real S) {
55
56   Trsf2d T;
57   T.SetScale (P, S);
58   Transform (T);
59 }
60
61
62 void Geom2d_Geometry::Translate (const gp_Vec2d& V) {
63
64   Trsf2d T;
65   T.SetTranslation (V);
66   Transform (T);
67 }
68
69
70 void Geom2d_Geometry::Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2) {
71
72   Vec2d V (P1, P2);
73   Translate (V);
74 }
75
76
77  Handle(Geometry) Geom2d_Geometry::Mirrored (const gp_Pnt2d& P) const {
78
79   Handle(Geometry) me = this;
80   Handle(Geometry) G = me->Copy();
81   G->Mirror (P);
82   return G;
83 }
84
85
86 Handle(Geometry) Geom2d_Geometry::Mirrored (const gp_Ax2d& A) const {
87
88   Handle(Geometry) me = this;
89   Handle(Geometry) G = me->Copy();
90   G->Mirror (A);
91   return G;
92 }
93
94
95 Handle(Geometry) Geom2d_Geometry::Rotated (
96 const gp_Pnt2d& P, const Standard_Real Ang) const {
97
98   Handle(Geometry) me = this;
99   Handle(Geometry) G = me->Copy();
100   G->Rotate (P, Ang);
101   return G;
102 }
103
104
105 Handle(Geometry) Geom2d_Geometry::Scaled (
106 const gp_Pnt2d& P,  const Standard_Real S) const {
107
108   Handle(Geometry) me = this;
109   Handle(Geometry) G = me->Copy();
110   G->Scale (P, S);
111   return G;
112 }
113
114
115 Handle(Geometry) Geom2d_Geometry::Transformed (const gp_Trsf2d& T) const {
116
117   Handle(Geometry) me = this;
118   Handle(Geometry) G = me->Copy();
119   G->Transform (T);
120   return G;
121 }
122
123
124 Handle(Geometry) Geom2d_Geometry::Translated (const gp_Vec2d& V) const {
125
126   Handle(Geometry) me = this;
127   Handle(Geometry) G = me->Copy();
128   G->Translate (V);
129   return G;
130 }
131
132
133 Handle(Geometry) Geom2d_Geometry::Translated (
134 const gp_Pnt2d& P1, const gp_Pnt2d& P2) const {
135
136   Handle(Geometry) me = this;
137   Handle(Geometry) G = me->Copy();
138   G->Translate (P1, P2);
139   return G;
140 }