0024927: Getting rid of "Persistent" functionality -- Storable
[occt.git] / src / gp / gp_GTrsf2d.cdl
CommitLineData
b311480e 1-- Copyright (c) 1991-1999 Matra Datavision
973c2be1 2-- Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3--
973c2be1 4-- This file is part of Open CASCADE Technology software library.
b311480e 5--
d5f74e42 6-- This library is free software; you can redistribute it and/or modify it under
7-- the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8-- by the Free Software Foundation, with special exception defined in the file
9-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10-- distribution for complete text of the license and disclaimer of any warranty.
b311480e 11--
973c2be1 12-- Alternatively, this file may be used under the terms of Open CASCADE
13-- commercial license or contractual agreement.
7fd59977 14
087da3bd 15class GTrsf2d from gp
7fd59977 16
17
18 --- Purpose :
19 -- Defines a non persistent transformation in 2D space.
20 -- This transformation is a general transformation.
21 -- It can be a Trsf2d from package gp, an affinity, or you can
22 -- define your own transformation giving the corresponding
23 -- matrix of transformation.
24 --
25 -- With a GTrsf2d you can transform only a doublet of coordinates
26 -- XY. It is not possible to transform other geometric objects
27 -- because these transformations can change the nature of non-
28 -- elementary geometric objects.
29 -- A GTrsf2d is represented with a 2 rows * 3 columns matrix :
30 --
31 -- V1 V2 T XY XY
32 -- | a11 a12 a14 | | x | | x'|
33 -- | a21 a22 a24 | | y | | y'|
34 -- | 0 0 1 | | 1 | | 1 |
35 --
36 -- where {V1, V2} defines the vectorial part of the
37 -- transformation and T defines the translation part of
38 -- the transformation.
39 -- Warning
40 -- A GTrsf2d transformation is only applicable on
41 -- coordinates. Be careful if you apply such a
42 -- transformation to all the points of a geometric object,
43 -- as this can change the nature of the object and thus
44 -- render it incoherent!
45 -- Typically, a circle is transformed into an ellipse by an
46 -- affinity transformation. To avoid modifying the nature of
47 -- an object, use a gp_Trsf2d transformation instead, as
48 -- objects of this class respect the nature of geometric objects.
49
50uses Ax2d from gp,
51 Mat2d from gp,
52 Trsf2d from gp,
53 Vec2d from gp,
54 XY from gp,
55 TrsfForm from gp
56
57raises ConstructionError from Standard,
58 OutOfRange from Standard
59
60
61
62is
63
64
65
66 Create returns GTrsf2d;
67 ---C++: inline
68 --- Purpose : returns identity transformation.
69
70
71 Create (T : Trsf2d) returns GTrsf2d;
72 ---C++: inline
73 --- Purpose : Converts the gp_Trsf2d transformation T into a
74 -- general transformation.
75
76 Create (M : Mat2d; V : XY) returns GTrsf2d;
77 ---C++: inline
78 --- Purpose : Creates a transformation based on the matrix M and the
79 -- vector V where M defines the vectorial part of the
80 -- transformation, and V the translation part.
81
82
83 SetAffinity (me : in out; A : Ax2d; Ratio : Real) is static;
84 --- Purpose :
85 -- Changes this transformation into an affinity of ratio Ratio
86 -- with respect to the axis A.
87 -- Note: An affinity is a point-by-point transformation that
88 -- transforms any point P into a point P' such that if H is
89 -- the orthogonal projection of P on the axis A, the vectors
90 -- HP and HP' satisfy: HP' = Ratio * HP.
91
92
93
94 SetValue (me : in out; Row, Col : Integer; Value : Real)
95 ---C++: inline
96 --- Purpose :
97 -- Replaces the coefficient (Row, Col) of the matrix representing
98 -- this transformation by Value,
99 -- Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
100 raises OutOfRange
101
102 is static;
103
104
105 SetTranslationPart (me : in out; Coord : XY) is static;
106 --- Purpose : Replacesthe translation part of this
107 -- transformation by the coordinates of the number pair Coord.
108
109
110 SetTrsf2d (me : in out; T : Trsf2d) is static;
111 ---C++: inline
112 --- Purpose :
113 -- Assigns the vectorial and translation parts of T to this transformation.
114
115
116 SetVectorialPart (me : in out; Matrix : Mat2d) is static;
117 ---C++: inline
118 --- Purpose :
119 -- Replaces the vectorial part of this transformation by Matrix.
120
121
122
123 IsNegative (me) returns Boolean is static;
124 ---C++: inline
125 --- Purpose :
126 -- Returns true if the determinant of the vectorial part of
127 -- this transformation is negative.
128
129 IsSingular (me) returns Boolean is static;
130 ---C++: inline
131 --- Purpose : Returns true if this transformation is singular (and
132 -- therefore, cannot be inverted).
133 -- Note: The Gauss LU decomposition is used to invert the
134 -- transformation matrix. Consequently, the transformation
135 -- is considered as singular if the largest pivot found is less
136 -- than or equal to gp::Resolution().
137 -- Warning
138 -- If this transformation is singular, it cannot be inverted.
139
140
141 Form (me) returns TrsfForm is static;
142 ---C++: inline
143 --- Purpose :
144 -- Returns the nature of the transformation. It can be
145 -- an identity transformation, a rotation, a translation, a mirror
146 -- transformation (relative to a point or axis), a scaling
147 -- transformation, a compound transformation or some
148 -- other type of transformation.
149
150
151 TranslationPart (me) returns XY is static;
152 --- Purpose : Returns the translation part of the GTrsf2d.
153 ---C++: inline
154 ---C++: return const&
155
156
157 VectorialPart (me) returns Mat2d is static;
158 --- Purpose :
159 -- Computes the vectorial part of the GTrsf2d. The returned
160 -- Matrix is a 2*2 matrix.
161 ---C++: inline
162 ---C++: return const&
163
164
165 Value (me; Row, Col : Integer) returns Real
166 --- Purpose :
167 -- Returns the coefficients of the global matrix of transformation.
168 --- Raised OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
169 ---C++: inline
170 ---C++: alias operator()
171 raises OutOfRange
172 is static;
173
174
175
176
177
178 Invert (me : in out) raises ConstructionError is static;
179
180 Inverted (me) returns GTrsf2d raises ConstructionError is static;
181 ---C++: inline
182 --- Purpose :
183 -- Computes the reverse transformation.
184 -- Raised an exception if the matrix of the transformation
185 -- is not inversible.
186
7fd59977 187 Multiplied (me; T : GTrsf2d) returns GTrsf2d is static;
188 ---C++: inline
189 ---C++: alias operator *
190 --- Purpose :
191 -- Computes the transformation composed with T and <me>.
192 -- In a C++ implementation you can also write Tcomposed = <me> * T.
193 -- Example :
194 -- GTrsf2d T1, T2, Tcomp; ...............
195 -- //composition :
196 -- Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
197 -- // transformation of a point
198 -- XY P(10.,3.);
199 -- XY P1(P);
200 -- Tcomp.Transforms(P1); //using Tcomp
201 -- XY P2(P);
202 -- T1.Transforms(P2); //using T1 then T2
203 -- T2.Transforms(P2); // P1 = P2 !!!
204
008297e1 205 Multiply (me : in out; T : GTrsf2d) is static;
206 ---C++: alias operator *=
207 -- Computes the product of the transformation T and this
208 -- transformation, and assigns the result to this transformation:
209 -- this = this * T
7fd59977 210
211 PreMultiply (me : in out; T : GTrsf2d) is static;
7fd59977 212 --- Purpose :
213 -- Computes the product of the transformation T and this
214 -- transformation, and assigns the result to this transformation:
215 -- this = T * this
216
217
218
219 Power (me : in out; N : Integer) raises ConstructionError is static;
220
221 Powered (me; N : Integer) returns GTrsf2d raises ConstructionError is static;
222 ---C++: inline
223 --- Purpose :
224 -- Computes the following composition of transformations
225 -- <me> * <me> * .......* <me>, N time.
226 -- if N = 0 <me> = Identity
227 -- if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
228 --
229 -- Raises an exception if N < 0 and if the matrix of the
230 -- transformation is not inversible.
231
232
233
234 Transforms (me; Coord : in out XY) is static;
235 ---C++: inline
236
237 Transformed(me; Coord : in XY from gp)
238 returns XY from gp
239 is static;
240 ---C++: inline
241
242
243 Transforms (me; X, Y : in out Real) is static;
244 ---C++: inline
245 ---Purpose:
246 -- Applies this transformation to the coordinates:
247 -- - of the number pair Coord, or
248 -- - X and Y.
249 --
250 -- Note:
251 -- - Transforms modifies X, Y, or the coordinate pair Coord, while
252 -- - Transformed creates a new coordinate pair.
253
254
255
256 Trsf2d (me) returns Trsf2d raises ConstructionError is static;
257 ---Purpose:
258 -- Converts this transformation into a gp_Trsf2d transformation.
259 -- Exceptions
260 -- Standard_ConstructionError if this transformation
261 -- cannot be converted, i.e. if its form is gp_Other.
262
263
264fields
265
266 matrix : Mat2d;
267 loc : XY;
268 shape : TrsfForm;
269 scale : Real;
270
271end;