0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[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 under
9 // the terms of the GNU Lesser General Public License 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
18 #include <Geom2d_Geometry.hxx>
19 #include <gp_Ax2d.hxx>
20 #include <gp_Pnt2d.hxx>
21 #include <gp_Trsf2d.hxx>
22 #include <gp_Vec2d.hxx>
23 #include <Standard_ConstructionError.hxx>
24 #include <Standard_Type.hxx>
25
26 IMPLEMENT_STANDARD_RTTIEXT(Geom2d_Geometry,MMgt_TShared)
27
28 typedef Geom2d_Geometry Geometry;
29 typedef gp_Ax2d   Ax2d;
30 typedef gp_Pnt2d  Pnt2d;
31 typedef gp_Vec2d  Vec2d;
32 typedef gp_Trsf2d Trsf2d;
33
34 void Geom2d_Geometry::Mirror (const gp_Pnt2d& P) {
35    
36   Trsf2d T;
37   T.SetMirror (P);
38   Transform (T);
39 }
40
41
42
43 void Geom2d_Geometry::Mirror (const gp_Ax2d& A) {
44
45   Trsf2d T;
46   T.SetMirror (A);
47   Transform (T);
48 }
49
50
51 void Geom2d_Geometry::Rotate (const gp_Pnt2d& P, const Standard_Real Ang) {
52
53   Trsf2d T;
54   T.SetRotation (P, Ang);
55   Transform (T);
56 }
57
58
59 void Geom2d_Geometry::Scale (const gp_Pnt2d& P, const Standard_Real S) {
60
61   Trsf2d T;
62   T.SetScale (P, S);
63   Transform (T);
64 }
65
66
67 void Geom2d_Geometry::Translate (const gp_Vec2d& V) {
68
69   Trsf2d T;
70   T.SetTranslation (V);
71   Transform (T);
72 }
73
74
75 void Geom2d_Geometry::Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2) {
76
77   Vec2d V (P1, P2);
78   Translate (V);
79 }
80
81
82  Handle(Geom2d_Geometry) Geom2d_Geometry::Mirrored (const gp_Pnt2d& P) const
83  {
84   Handle(Geom2d_Geometry) G = Copy();
85   G->Mirror (P);
86   return G;
87 }
88
89
90 Handle(Geom2d_Geometry) Geom2d_Geometry::Mirrored (const gp_Ax2d& A) const
91 {
92   Handle(Geom2d_Geometry) G = Copy();
93   G->Mirror (A);
94   return G;
95 }
96
97
98 Handle(Geom2d_Geometry) Geom2d_Geometry::Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const
99 {
100   Handle(Geom2d_Geometry) G = Copy();
101   G->Rotate (P, Ang);
102   return G;
103 }
104
105
106 Handle(Geom2d_Geometry) Geom2d_Geometry::Scaled (const gp_Pnt2d& P,  const Standard_Real S) const
107 {
108   Handle(Geom2d_Geometry) G = Copy();
109   G->Scale (P, S);
110   return G;
111 }
112
113
114 Handle(Geom2d_Geometry) Geom2d_Geometry::Transformed (const gp_Trsf2d& T) const
115 {
116   Handle(Geom2d_Geometry) G = Copy();
117   G->Transform (T);
118   return G;
119 }
120
121
122 Handle(Geom2d_Geometry) Geom2d_Geometry::Translated (const gp_Vec2d& V) const
123 {
124   Handle(Geom2d_Geometry) G = Copy();
125   G->Translate (V);
126   return G;
127 }
128
129
130 Handle(Geom2d_Geometry) Geom2d_Geometry::Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const
131 {
132   Handle(Geom2d_Geometry) G = Copy();
133   G->Translate (P1, P2);
134   return G;
135 }