1 -- Copyright (c) 1991-1999 Matra Datavision
2 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
4 -- This file is part of Open CASCADE Technology software library.
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
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.
12 -- Alternatively, this file may be used under the terms of Open CASCADE
13 -- commercial license or contractual agreement.
15 class Mat2d from gp inherits Storable
17 -- Describes a two column, two row matrix. This sort of
18 -- object is used in various vectorial or matrix computations.
23 raises ConstructionError from Standard,
24 OutOfRange from Standard
34 --- Purpose : Creates a matrix with null coefficients.
37 Create (Col1, Col2 : XY) returns Mat2d;
39 -- Col1, Col2 are the 2 columns of the matrix.
45 SetCol (me : in out; Col : Integer; Value : XY)
46 --- Purpose : Assigns the two coordinates of Value to the column of range
48 -- Raises OutOfRange if Col < 1 or Col > 2.
53 SetCols (me : in out; Col1, Col2 : XY)
54 --- Purpose : Assigns the number pairs Col1, Col2 to the two columns of this matrix
58 SetDiagonal (me : in out; X1, X2 : Real) is static;
61 -- Modifies the main diagonal of the matrix.
62 -- <me>.Value (1, 1) = X1
63 -- <me>.Value (2, 2) = X2
64 -- The other coefficients of the matrix are not modified.
67 SetIdentity (me : in out) is static;
69 --- Purpose : Modifies this matrix, so that it represents the Identity matrix.
72 SetRotation (me : in out; Ang : Real) is static;
74 -- Modifies this matrix, so that it representso a rotation. Ang is the angular
75 -- value in radian of the rotation.
78 SetRow (me : in out; Row : Integer; Value : XY)
79 --- Purpose : Assigns the two coordinates of Value to the row of index Row of this matrix.
80 -- Raises OutOfRange if Row < 1 or Row > 2.
85 SetRows (me : in out; Row1, Row2 : XY) is static;
86 --- Purpose : Assigns the number pairs Row1, Row2 to the two rows of this matrix.
89 SetScale (me : in out; S : Real) is static;
92 -- Modifies the matrix such that it
93 -- represents a scaling transformation, where S is the scale factor :
98 SetValue (me : in out; Row, Col : Integer; Value : Real)
99 --- Purpose : Assigns <Value> to the coefficient of row Row, column Col of this matrix.
100 -- Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 2
105 Column (me; Col : Integer) returns XY
106 --- Purpose : Returns the column of Col index.
107 -- Raises OutOfRange if Col < 1 or Col > 2
112 Determinant (me) returns Real is static;
114 --- Purpose : Computes the determinant of the matrix.
117 Diagonal (me) returns XY is static;
118 --- Purpose : Returns the main diagonal of the matrix.
121 Row (me; Row : Integer) returns XY
122 --- Purpose : Returns the row of index Row.
124 --- Purpose : Raised if Row < 1 or Row > 2
128 Value (me; Row, Col : Integer) returns Real
129 --- Purpose : Returns the coefficient of range (Row, Col)
131 -- if Row < 1 or Row > 2 or Col < 1 or Col > 2
133 ---C++: return const &
134 ---C++: alias operator()
140 ChangeValue (me : in out; Row, Col : Integer) returns Real
141 --- Purpose : Returns the coefficient of range (Row, Col)
143 -- if Row < 1 or Row > 2 or Col < 1 or Col > 2
146 ---C++: alias operator()
152 IsSingular (me) returns Boolean is static;
154 -- Returns true if this matrix is singular (and therefore, cannot be inverted).
155 -- The Gauss LU decomposition is used to invert the matrix
156 -- so the matrix is considered as singular if the largest
157 -- pivot found is lower or equal to Resolution from gp.
161 Add (me : in out; Other : Mat2d) is static;
163 ---C++: alias operator +=
165 Added (me; Other : Mat2d) returns Mat2d is static;
167 ---C++: alias operator +
170 -- Computes the sum of this matrix and the matrix
171 -- Other.for each coefficient of the matrix :
172 -- <me>.Coef(i,j) + <Other>.Coef(i,j)
174 -- - operator += assigns the result to this matrix, while
175 -- - operator + creates a new one.
179 Divide (me : in out; Scalar : Real) is static;
181 ---C++: alias operator /=
183 Divided (me; Scalar : Real) returns Mat2d is static;
185 ---C++: alias operator /
187 -- Divides all the coefficients of the matrix by a scalar.
191 Invert (me : in out) raises ConstructionError is static;
193 Inverted (me) returns Mat2d raises ConstructionError is static;
195 -- Inverses the matrix and raises exception if the matrix
201 Multiplied (me; Other : Mat2d) returns Mat2d is static;
203 ---C++: alias operator *
205 Multiply (me : in out; Other : Mat2d) is static;
207 -- Computes the product of two matrices <me> * <Other>
209 -- C++: alias operator *=
211 PreMultiply(me : in out; Other : Mat2d) is static;
212 --- Purpose : Modifies this matrix by premultiplying it by the matrix Other
213 -- <me> = Other * <me>.
218 Multiplied (me; Scalar : Real) returns Mat2d is static;
220 ---C++: alias operator *
222 Multiply (me : in out; Scalar : Real) is static;
224 -- Multiplies all the coefficients of the matrix by a scalar.
226 ---C++: alias operator *=
229 Power (me : in out; N : Integer) raises ConstructionError is static;
231 Powered (me; N : Integer) returns Mat2d raises ConstructionError is static;
233 -- computes <me> = <me> * <me> * .......* <me>, N time.
234 -- if N = 0 <me> = Identity
235 -- if N < 0 <me> = <me>.Invert() *...........* <me>.Invert().
236 -- If N < 0 an exception can be raised if the matrix is not
241 Subtract (me : in out; Other : Mat2d) is static;
243 ---C++: alias operator -=
245 Subtracted (me; Other : Mat2d) returns Mat2d is static;
247 ---C++: alias operator -
249 -- Computes for each coefficient of the matrix :
250 -- <me>.Coef(i,j) - <Other>.Coef(i,j)
253 Transpose (me : in out) is static;
256 Transposed (me) returns Mat2d is static;
258 -- Transposes the matrix. A(j, i) -> A (i, j)
266 class Trsf2d from gp,
267 class GTrsf2d from gp,