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