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