b311480e |
1 | // Created on: 1993-03-24 |
2 | // Created by: JCV |
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 | |
42cf5bc1 |
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> |
7fd59977 |
23 | #include <Standard_ConstructionError.hxx> |
42cf5bc1 |
24 | #include <Standard_Type.hxx> |
7fd59977 |
25 | |
25e59720 |
26 | IMPLEMENT_STANDARD_RTTIEXT(Geom2d_Geometry,Standard_Transient) |
92efcf78 |
27 | |
7fd59977 |
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 | |
7fd59977 |
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 | |
c04c30b3 |
82 | Handle(Geom2d_Geometry) Geom2d_Geometry::Mirrored (const gp_Pnt2d& P) const |
83 | { |
84 | Handle(Geom2d_Geometry) G = Copy(); |
7fd59977 |
85 | G->Mirror (P); |
86 | return G; |
87 | } |
88 | |
89 | |
c04c30b3 |
90 | Handle(Geom2d_Geometry) Geom2d_Geometry::Mirrored (const gp_Ax2d& A) const |
91 | { |
92 | Handle(Geom2d_Geometry) G = Copy(); |
7fd59977 |
93 | G->Mirror (A); |
94 | return G; |
95 | } |
96 | |
97 | |
c04c30b3 |
98 | Handle(Geom2d_Geometry) Geom2d_Geometry::Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const |
99 | { |
100 | Handle(Geom2d_Geometry) G = Copy(); |
7fd59977 |
101 | G->Rotate (P, Ang); |
102 | return G; |
103 | } |
104 | |
105 | |
c04c30b3 |
106 | Handle(Geom2d_Geometry) Geom2d_Geometry::Scaled (const gp_Pnt2d& P, const Standard_Real S) const |
107 | { |
108 | Handle(Geom2d_Geometry) G = Copy(); |
7fd59977 |
109 | G->Scale (P, S); |
110 | return G; |
111 | } |
112 | |
113 | |
c04c30b3 |
114 | Handle(Geom2d_Geometry) Geom2d_Geometry::Transformed (const gp_Trsf2d& T) const |
115 | { |
116 | Handle(Geom2d_Geometry) G = Copy(); |
7fd59977 |
117 | G->Transform (T); |
118 | return G; |
119 | } |
120 | |
121 | |
c04c30b3 |
122 | Handle(Geom2d_Geometry) Geom2d_Geometry::Translated (const gp_Vec2d& V) const |
123 | { |
124 | Handle(Geom2d_Geometry) G = Copy(); |
7fd59977 |
125 | G->Translate (V); |
126 | return G; |
127 | } |
128 | |
129 | |
c04c30b3 |
130 | Handle(Geom2d_Geometry) Geom2d_Geometry::Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const |
131 | { |
132 | Handle(Geom2d_Geometry) G = Copy(); |
7fd59977 |
133 | G->Translate (P1, P2); |
134 | return G; |
135 | } |