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 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Geom2d_Transformation.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_OutOfRange.hxx> |
25 | #include <Standard_Type.hxx> |
7fd59977 |
26 | |
27 | typedef Geom2d_Transformation Transformation; |
7fd59977 |
28 | typedef gp_Ax2d Ax2d; |
29 | typedef gp_Pnt2d Pnt2d; |
30 | typedef gp_TrsfForm TrsfForm; |
31 | typedef gp_Vec2d Vec2d; |
32 | |
7fd59977 |
33 | Handle(Geom2d_Transformation) Geom2d_Transformation::Copy() const { |
34 | |
c04c30b3 |
35 | Handle(Geom2d_Transformation) T; |
7fd59977 |
36 | T = new Transformation (gpTrsf2d); |
37 | return T; |
38 | } |
39 | |
40 | |
41 | |
42 | |
43 | Geom2d_Transformation::Geom2d_Transformation () { } |
44 | |
45 | |
46 | Geom2d_Transformation::Geom2d_Transformation (const gp_Trsf2d& T) |
47 | : gpTrsf2d (T) { } |
48 | |
49 | |
c04c30b3 |
50 | Handle(Geom2d_Transformation) Geom2d_Transformation::Inverted () const { |
7fd59977 |
51 | |
52 | return new Transformation (gpTrsf2d.Inverted()); |
53 | } |
54 | |
55 | |
c04c30b3 |
56 | Handle(Geom2d_Transformation) Geom2d_Transformation::Multiplied ( |
7fd59977 |
57 | |
c04c30b3 |
58 | const Handle(Geom2d_Transformation)& Other) const { |
7fd59977 |
59 | |
60 | return new Transformation (gpTrsf2d.Multiplied (Other->Trsf2d())); |
61 | } |
62 | |
63 | |
c04c30b3 |
64 | Handle(Geom2d_Transformation) Geom2d_Transformation::Powered (const Standard_Integer N) const{ |
7fd59977 |
65 | |
66 | gp_Trsf2d Temp = gpTrsf2d; |
67 | Temp.Power (N); |
68 | return new Transformation (Temp); |
69 | } |
70 | |
71 | |
72 | |
73 | void Geom2d_Transformation::SetMirror (const gp_Pnt2d& P) { |
74 | |
75 | gpTrsf2d.SetMirror (P); |
76 | } |
77 | |
78 | |
79 | void Geom2d_Transformation::SetMirror (const gp_Ax2d& A) { |
80 | |
81 | gpTrsf2d.SetMirror (A); |
82 | } |
83 | |
84 | |
85 | void Geom2d_Transformation::SetRotation (const gp_Pnt2d& P, const Standard_Real Ang) { |
86 | |
87 | gpTrsf2d.SetRotation (P, Ang); |
88 | } |
89 | |
90 | |
91 | void Geom2d_Transformation::SetScale (const gp_Pnt2d& P, const Standard_Real S) { |
92 | |
93 | gpTrsf2d.SetScale (P, S); |
94 | } |
95 | |
96 | |
97 | void Geom2d_Transformation::SetTransformation (const gp_Ax2d& ToAxis) { |
98 | |
99 | gpTrsf2d.SetTransformation (ToAxis); |
100 | } |
101 | |
102 | |
103 | void Geom2d_Transformation::SetTransformation ( |
104 | const gp_Ax2d& FromAxis1, const gp_Ax2d& ToAxis2) { |
105 | |
106 | gpTrsf2d.SetTransformation (FromAxis1, ToAxis2); |
107 | } |
108 | |
109 | |
110 | void Geom2d_Transformation::SetTranslation (const gp_Vec2d& V) { |
111 | |
112 | gpTrsf2d.SetTranslation (V); |
113 | } |
114 | |
115 | |
116 | void Geom2d_Transformation::SetTranslation (const gp_Pnt2d& P1, const gp_Pnt2d& P2) { |
117 | |
118 | gpTrsf2d.SetTranslation (P1, P2); |
119 | } |
120 | |
121 | |
122 | void Geom2d_Transformation::SetTrsf2d (const gp_Trsf2d& T) { gpTrsf2d = T; } |
123 | |
124 | |
125 | Standard_Boolean Geom2d_Transformation::IsNegative () const { |
126 | |
127 | return gpTrsf2d.IsNegative(); |
128 | } |
129 | |
130 | |
131 | TrsfForm Geom2d_Transformation::Form () const { return gpTrsf2d.Form(); } |
132 | |
133 | |
134 | Standard_Real Geom2d_Transformation::ScaleFactor () const { |
135 | |
136 | return gpTrsf2d.ScaleFactor(); |
137 | } |
138 | |
139 | |
140 | gp_Trsf2d Geom2d_Transformation::Trsf2d () const { return gpTrsf2d; } |
141 | |
142 | |
143 | |
144 | Standard_Real Geom2d_Transformation::Value (const Standard_Integer Row, const Standard_Integer Col) const{ |
145 | |
146 | return gpTrsf2d.Value (Row, Col); |
147 | } |
148 | |
149 | |
150 | void Geom2d_Transformation::Invert () { gpTrsf2d.Invert(); } |
151 | |
152 | |
153 | void Geom2d_Transformation::Transforms (Standard_Real& X, Standard_Real& Y) const { |
154 | |
155 | gpTrsf2d.Transforms (X, Y); |
156 | } |
157 | |
158 | |
159 | void Geom2d_Transformation::Multiply (const Handle(Geom2d_Transformation)& Other) { |
160 | |
161 | gpTrsf2d.Multiply (Other->Trsf2d()); |
162 | } |
163 | |
164 | |
165 | void Geom2d_Transformation::Power (const Standard_Integer N) { gpTrsf2d.Power (N); } |
166 | |
167 | |
168 | void Geom2d_Transformation::PreMultiply ( |
c04c30b3 |
169 | const Handle(Geom2d_Transformation)& Other) { |
7fd59977 |
170 | |
171 | gpTrsf2d.PreMultiply (Other->Trsf2d()); |
172 | } |
173 | |
174 | |
175 | |
176 | |