summaryrefslogtreecommitdiff
path: root/inc/gp_Mat2d.hxx
blob: 9bc0bf411003fa200259b1693f704065f303387f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _gp_Mat2d_HeaderFile
#define _gp_Mat2d_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_Storable_HeaderFile
#include <Standard_Storable.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_PrimitiveTypes_HeaderFile
#include <Standard_PrimitiveTypes.hxx>
#endif
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_Trsf2d;
class gp_GTrsf2d;
class gp_XY;


Standard_EXPORT const Handle(Standard_Type)& STANDARD_TYPE(gp_Mat2d);


//! Describes a two column, two row matrix. This sort of <br>
//! object is used in various vectorial or matrix computations. <br>
class gp_Mat2d  {

public:
  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  //! Creates  a matrix with null coefficients. <br>
      gp_Mat2d();
  
//!  Col1, Col2 are the 2 columns of the matrix. <br>
  Standard_EXPORT   gp_Mat2d(const gp_XY& Col1,const gp_XY& Col2);
  //!  Assigns the two coordinates of Value to the column of range <br>
//!   Col of this matrix <br>
//! Raises OutOfRange if Col < 1 or Col > 2. <br>
  Standard_EXPORT     void SetCol(const Standard_Integer Col,const gp_XY& Value) ;
  //! Assigns the number pairs Col1, Col2 to the two columns of   this matrix <br>
  Standard_EXPORT     void SetCols(const gp_XY& Col1,const gp_XY& Col2) ;
  
//!  Modifies the main diagonal of the matrix. <br>
//!  <me>.Value (1, 1) = X1 <br>
//!  <me>.Value (2, 2) = X2 <br>
//!  The other coefficients of the matrix are not modified. <br>
        void SetDiagonal(const Standard_Real X1,const Standard_Real X2) ;
  //! Modifies this matrix, so that it represents the Identity matrix. <br>
        void SetIdentity() ;
  
//!  Modifies this matrix, so that it representso a rotation. Ang is the angular <br>
//!  value in radian of the rotation. <br>
        void SetRotation(const Standard_Real Ang) ;
  //! Assigns the two coordinates of Value to the row of index Row of this matrix. <br>
//! Raises OutOfRange if Row < 1 or Row > 2. <br>
  Standard_EXPORT     void SetRow(const Standard_Integer Row,const gp_XY& Value) ;
  //! Assigns the number pairs Row1, Row2 to the two rows of this matrix. <br>
  Standard_EXPORT     void SetRows(const gp_XY& Row1,const gp_XY& Row2) ;
  
//!  Modifies the matrix such that it <br>
//! represents a scaling transformation, where S is the scale   factor : <br>
//!           | S    0.0 | <br>
//!   <me> =  | 0.0   S  | <br>
        void SetScale(const Standard_Real S) ;
  //! Assigns <Value> to the coefficient of row Row, column Col of this matrix. <br>
//! Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 2 <br>
        void SetValue(const Standard_Integer Row,const Standard_Integer Col,const Standard_Real Value) ;
  //! Returns the column of Col index. <br>
//! Raises OutOfRange if Col < 1 or Col > 2 <br>
  Standard_EXPORT     gp_XY Column(const Standard_Integer Col) const;
  //! Computes the determinant of the matrix. <br>
        Standard_Real Determinant() const;
  //! Returns the main diagonal of the matrix. <br>
  Standard_EXPORT     gp_XY Diagonal() const;
  //! Returns the row of index Row. <br>//! Raised if Row < 1 or Row > 2 <br>
  Standard_EXPORT     gp_XY Row(const Standard_Integer Row) const;
  //! Returns the coefficient of range (Row, Col) <br>
//! Raises OutOfRange <br>
//! if Row < 1 or Row > 2 or Col < 1 or Col > 2 <br>
       const Standard_Real& Value(const Standard_Integer Row,const Standard_Integer Col) const;
     const Standard_Real& operator()(const Standard_Integer Row,const Standard_Integer Col) const
{
  return Value(Row,Col);
}
  //! Returns the coefficient of range (Row, Col) <br>
//! Raises OutOfRange <br>
//! if Row < 1 or Row > 2 or Col < 1 or Col > 2 <br>
        Standard_Real& ChangeValue(const Standard_Integer Row,const Standard_Integer Col) ;
      Standard_Real& operator()(const Standard_Integer Row,const Standard_Integer Col) 
{
  return ChangeValue(Row,Col);
}
  
//! Returns true if this matrix is singular (and therefore, cannot be inverted). <br>
//!  The Gauss LU decomposition is used to invert the matrix <br>
//!  so the matrix is considered as singular if the largest <br>
//!  pivot found is lower or equal to Resolution from gp. <br>
        Standard_Boolean IsSingular() const;
  
        void Add(const gp_Mat2d& Other) ;
      void operator +=(const gp_Mat2d& Other) 
{
  Add(Other);
}
  
//!  Computes the sum of this matrix and the matrix <br>
//! Other.for each coefficient of the matrix : <br>
//!  <me>.Coef(i,j) + <Other>.Coef(i,j) <br>
//! Note: <br>
//! -   operator += assigns the result to this matrix, while <br>
//! -   operator + creates a new one. <br>
        gp_Mat2d Added(const gp_Mat2d& Other) const;
      gp_Mat2d operator +(const gp_Mat2d& Other) const
{
  return Added(Other);
}
  
        void Divide(const Standard_Real Scalar) ;
      void operator /=(const Standard_Real Scalar) 
{
  Divide(Scalar);
}
  
//!  Divides all the coefficients of the matrix by a scalar. <br>
        gp_Mat2d Divided(const Standard_Real Scalar) const;
      gp_Mat2d operator /(const Standard_Real Scalar) const
{
  return Divided(Scalar);
}
  
  Standard_EXPORT     void Invert() ;
  
//!  Inverses the matrix and raises exception if the matrix <br>
//!  is singular. <br>
        gp_Mat2d Inverted() const;
  
        gp_Mat2d Multiplied(const gp_Mat2d& Other) const;
      gp_Mat2d operator *(const gp_Mat2d& Other) const
{
  return Multiplied(Other);
}
  
//!  Computes the product of two matrices <me> * <Other> <br>
        void Multiply(const gp_Mat2d& Other) ;
  //! Modifies this matrix by premultiplying it by the matrix Other <br>
//! <me> = Other * <me>. <br>
        void PreMultiply(const gp_Mat2d& Other) ;
  
        gp_Mat2d Multiplied(const Standard_Real Scalar) const;
      gp_Mat2d operator *(const Standard_Real Scalar) const
{
  return Multiplied(Scalar);
}
  
//!  Multiplies all the coefficients of the matrix by a scalar. <br>
        void Multiply(const Standard_Real Scalar) ;
      void operator *=(const Standard_Real Scalar) 
{
  Multiply(Scalar);
}
  
  Standard_EXPORT     void Power(const Standard_Integer N) ;
  
//!  computes <me> = <me> * <me> * .......* <me>, N time. <br>
//!  if N = 0 <me> = Identity <br>
//!  if N < 0 <me> = <me>.Invert() *...........* <me>.Invert(). <br>
//!  If N < 0 an exception can be raised if the matrix is not <br>
//!  inversible <br>
        gp_Mat2d Powered(const Standard_Integer N) const;
  
        void Subtract(const gp_Mat2d& Other) ;
      void operator -=(const gp_Mat2d& Other) 
{
  Subtract(Other);
}
  
//!  Computes for each coefficient of the matrix : <br>
//!  <me>.Coef(i,j) - <Other>.Coef(i,j) <br>
        gp_Mat2d Subtracted(const gp_Mat2d& Other) const;
      gp_Mat2d operator -(const gp_Mat2d& Other) const
{
  return Subtracted(Other);
}
  
        void Transpose() ;
  
//!  Transposes the matrix. A(j, i) -> A (i, j) <br>
        gp_Mat2d Transposed() const;
    Standard_Real& _CSFDB_Getgp_Mat2dmatrix(const Standard_Integer i1,const Standard_Integer i2) { return matrix[i1][i2]; }

friend class gp_Trsf2d;
friend class gp_GTrsf2d;
friend class gp_XY;


protected:




private: 


Standard_Real matrix[2][2];


};


#include <gp_Mat2d.lxx>



// other Inline functions and methods (like "C++: function call" methods)


#endif