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 | |
17 | class Transformation from Geom2d inherits TShared from MMgt |
18 | |
19 | |
20 | --- Purpose : |
21 | -- The class Transformation allows to create Translation, |
22 | -- Rotation, Symmetry, Scaling and complex transformations |
23 | -- obtained by combination of the previous elementary |
24 | -- transformations. |
25 | -- The Transformation class can also be used to |
26 | -- construct complex transformations by combining |
27 | -- these elementary transformations. |
28 | -- However, these transformations can never change |
29 | -- the type of an object. For example, the projection |
30 | -- transformation can change a circle into an ellipse, |
31 | -- and therefore change the real type of the object. |
32 | -- Such a transformation is forbidden in this |
33 | -- environment and cannot be a Geom2d_Transformation. |
34 | -- The transformation can be represented as follow : |
35 | -- |
36 | -- V1 V2 T |
37 | -- | a11 a12 a14 | | x | | x'| |
38 | -- | a21 a22 a24 | | y | | y'| |
39 | -- | 0 0 1 | | 1 | | 1 | |
40 | -- |
41 | -- where {V1, V2} defines the vectorial part of the |
42 | -- transformation and T defines the translation part of |
43 | -- the transformation. |
44 | -- - Geom2d_Transformation transformations provide |
45 | -- the same kind of "geometric" services as |
46 | -- gp_Trsf2d ones but have more complex data |
47 | -- structures. The geometric objects provided by the |
48 | -- Geom2d package use gp_Trsf2d transformations |
49 | -- in the syntaxes Transform and Transformed. |
50 | -- - Geom2d_Transformation transformations are |
51 | -- used in a context where they can be shared by |
52 | -- several objects contained inside a common data structure. |
53 | |
54 | uses Ax2d from gp, |
55 | Pnt2d from gp, |
56 | Trsf2d from gp, |
57 | TrsfForm from gp, |
58 | Vec2d from gp |
59 | |
60 | raises ConstructionError from Standard, |
61 | OutOfRange from Standard |
62 | |
63 | is |
64 | |
65 | |
6e33d3ce |
66 | Create returns Transformation; |
7fd59977 |
67 | --- Purpose : Creates an identity transformation. |
68 | |
69 | |
6e33d3ce |
70 | Create (T : Trsf2d) returns Transformation; |
7fd59977 |
71 | --- Purpose : Creates a persistent copy of T. |
72 | |
73 | |
74 | SetMirror (me : mutable; P : Pnt2d); |
75 | --- Purpose : |
76 | -- Makes the transformation into a symmetrical transformation |
77 | -- with respect to a point P. |
78 | -- P is the center of the symmetry. |
79 | |
80 | |
81 | SetMirror (me : mutable; A : Ax2d); |
82 | --- Purpose : |
83 | -- Makes the transformation into a symmetrical transformation |
84 | -- with respect to an axis A. |
85 | -- A is the center of the axial symmetry. |
86 | |
87 | |
88 | SetRotation (me : mutable; P : Pnt2d; Ang : Real); |
89 | --- Purpose : Assigns to this transformation the geometric |
90 | -- properties of a rotation at angle Ang (in radians) about point P. |
91 | |
92 | SetScale (me : mutable; P : Pnt2d; S : Real); |
93 | --- Purpose : |
94 | -- Makes the transformation into a scale. P is the center of |
95 | -- the scale and S is the scaling value. |
96 | |
97 | |
98 | SetTransformation (me : mutable; FromSystem1, ToSystem2 : Ax2d); |
99 | --- Purpose : |
100 | -- Makes a transformation allowing passage from the coordinate |
101 | -- system "FromSystem1" to the coordinate system "ToSystem2". |
102 | |
103 | |
104 | SetTransformation (me : mutable; ToSystem : Ax2d); |
105 | --- Purpose : |
106 | -- Makes the transformation allowing passage from the basic |
107 | -- coordinate system |
108 | -- {P(0.,0.,0.), VX (1.,0.,0.), VY (0.,1.,0.)} |
109 | -- to the local coordinate system defined with the Ax2d ToSystem. |
110 | |
111 | |
112 | SetTranslation (me : mutable; V : Vec2d); |
113 | --- Purpose : |
114 | -- Makes the transformation into a translation. |
115 | -- V is the vector of the translation. |
116 | |
117 | |
118 | SetTranslation(me : mutable; P1, P2 : Pnt2d); |
119 | --- Purpose : |
120 | -- Makes the transformation into a translation from the point |
121 | -- P1 to the point P2. |
122 | |
123 | |
124 | SetTrsf2d (me : mutable; T : Trsf2d); |
125 | --- Purpose : |
126 | -- Makes the transformation into a transformation T from |
127 | -- package gp. |
128 | |
129 | |
130 | IsNegative (me) returns Boolean; |
131 | --- Purpose : Checks whether this transformation is an indirect |
132 | -- transformation: returns true if the determinant of the |
133 | -- matrix of the vectorial part of the transformation is less than 0. |
134 | |
135 | Form (me) returns TrsfForm; |
136 | --- Purpose : Returns the nature of this transformation as a value |
137 | -- of the gp_TrsfForm enumeration. |
138 | -- Returns the nature of the transformation. It can be |
139 | -- Identity, Rotation, Translation, PntMirror, Ax1Mirror, |
140 | -- Scale, CompoundTrsf |
141 | |
142 | |
143 | ScaleFactor (me) returns Real; |
144 | --- Purpose : Returns the scale value of the transformation. |
145 | |
146 | |
147 | Trsf2d (me) returns Trsf2d; |
148 | --- Purpose : Converts this transformation into a gp_Trsf2d transformation. |
149 | -- Returns a non persistent copy of <me>. |
150 | -- -C++: return const& |
151 | |
152 | |
153 | Value (me; Row, Col : Integer) returns Real |
154 | --- Purpose : |
155 | -- Returns the coefficients of the global matrix of tranformation. |
156 | -- It is a 2 rows X 3 columns matrix. |
157 | raises OutOfRange; |
158 | --- Purpose : |
159 | -- Raised if Row < 1 or Row > 2 or Col < 1 or Col > 2 |
160 | |
161 | |
162 | |
163 | --- Purpose : |
164 | -- Computes the reverse transformation. |
165 | |
166 | Invert (me : mutable) |
167 | ---Purpose: Computes the inverse of this transformation. |
168 | -- and assigns the result to this transformatio |
169 | raises ConstructionError; |
170 | --- Purpose : |
171 | -- Raised if the the transformation is singular. This means that |
172 | -- the ScaleFactor is lower or equal to Resolution from |
173 | -- package gp. |
174 | |
175 | |
6e33d3ce |
176 | Inverted (me) returns Transformation |
7fd59977 |
177 | raises ConstructionError; |
178 | ---Purpose: Computes the inverse of this transformation and creates a new one. |
179 | -- Raises ConstructionError if the the transformation is singular. This means that |
180 | -- the ScaleFactor is lower or equal to Resolution from package gp. |
181 | |
182 | |
6e33d3ce |
183 | Multiplied (me; Other : Transformation) returns Transformation; |
7fd59977 |
184 | --- Purpose : |
185 | -- Computes the transformation composed with Other and <me>. |
186 | -- <me> * Other. |
187 | -- Returns a new transformation |
188 | ---C++: alias operator * |
189 | |
190 | |
191 | Multiply (me : mutable; Other : Transformation); |
192 | --- Purpose : |
193 | -- Computes the transformation composed with Other and <me> . |
194 | -- <me> = <me> * Other. |
195 | ---C++: alias operator *= |
196 | |
197 | |
198 | |
199 | |
200 | --- Purpose : |
201 | -- Computes the following composition of transformations |
202 | -- if N > 0 <me> * <me> * .......* <me>. |
203 | -- if N = 0 Identity |
204 | -- if N < 0 <me>.Invert() * .........* <me>.Invert() |
205 | |
206 | Power (me : mutable; N : Integer) |
207 | raises ConstructionError; |
208 | --- Purpose : |
209 | -- Raised if N < 0 and if the transformation is not inversible |
210 | |
211 | |
212 | Powered (me; N : Integer) returns Transformation |
213 | raises ConstructionError; |
214 | --- Purpose : |
215 | -- Raised if N < 0 and if the transformation is not inversible |
216 | |
217 | |
218 | |
219 | |
220 | PreMultiply (me : mutable; Other : Transformation); |
221 | --- Purpose : |
222 | -- Computes the matrix of the transformation composed with |
223 | -- <me> and Other. <me> = Other * <me> |
224 | |
225 | |
226 | Transforms (me; X, Y : in out Real); |
227 | --- Purpose : |
228 | -- Applies the transformation <me> to the triplet {X, Y}. |
229 | |
230 | |
231 | |
6e33d3ce |
232 | Copy (me) returns Transformation; |
7fd59977 |
233 | --- Purpose: Creates a new object, which is a copy of this transformation. |
234 | |
235 | fields |
236 | |
237 | gpTrsf2d : Trsf2d; |
238 | |
239 | end; |