90 MATRIX3x3( T a00, T a01, T a02, T a10, T a11, T a12, T a20, T a21, T a22 );
165 friend std::ostream& operator<<<T>( std::ostream& aStream,
const MATRIX3x3<T>& aMatrix );
195 for(
int j = 0; j < 3; j++ )
197 for(
int i = 0; i < 3; i++ )
242 for(
int j = 0; j < 3; j++ )
244 for(
int i = 0; i < 3; i++ )
258 m_data[0][2] = aTranslation.
x;
259 m_data[1][2] = aTranslation.
y;
267 result.
x = m_data[0][2];
268 result.
y = m_data[1][2];
277 T cosValue = cos( aAngle );
278 T sinValue = sin( aAngle );
279 m_data[0][0] = cosValue;
280 m_data[0][1] = -sinValue;
281 m_data[1][0] = sinValue;
282 m_data[1][1] = cosValue;
289 m_data[0][0] = aScale.
x;
290 m_data[1][1] = aScale.
y;
297 VECTOR2<T> result( m_data[0][0], m_data[1][1] );
308 for(
int i = 0; i < 3; i++ )
310 for(
int j = 0; j < 3; j++ )
326 result.
x = aMatrix.
m_data[0][0] * aVector.
x + aMatrix.
m_data[0][1] * aVector.
y
328 result.
y = aMatrix.
m_data[1][0] * aVector.
x + aMatrix.
m_data[1][1] * aVector.
y
339 result.
x = aMatrix.
m_data[0][0] * aVector.
x + aMatrix.
m_data[0][1] * aVector.
y
340 + aMatrix.
m_data[0][2] * aVector.
z;
341 result.
y = aMatrix.
m_data[1][0] * aVector.
x + aMatrix.
m_data[1][1] * aVector.
y
342 + aMatrix.
m_data[1][2] * aVector.
z;
343 result.
z = aMatrix.
m_data[2][0] * aVector.
x + aMatrix.
m_data[2][1] * aVector.
y
344 + aMatrix.
m_data[2][2] * aVector.
z;
353 return m_data[0][0] * ( m_data[1][1] * m_data[2][2] - m_data[1][2] * m_data[2][1] )
354 - m_data[0][1] * ( m_data[1][0] * m_data[2][2] - m_data[1][2] * m_data[2][0] )
355 + m_data[0][2] * ( m_data[1][0] * m_data[2][1] - m_data[1][1] * m_data[2][0] );
359template <
class T,
class S>
364 for(
int i = 0; i < 3; i++ )
366 for(
int j = 0; j < 3; j++ )
376template <
class T,
class S>
379 return aMatrix * aScalar;
388 result.
m_data[0][0] = m_data[1][1] * m_data[2][2] - m_data[2][1] * m_data[1][2];
389 result.
m_data[0][1] = m_data[0][2] * m_data[2][1] - m_data[2][2] * m_data[0][1];
390 result.
m_data[0][2] = m_data[0][1] * m_data[1][2] - m_data[1][1] * m_data[0][2];
392 result.
m_data[1][0] = m_data[1][2] * m_data[2][0] - m_data[2][2] * m_data[1][0];
393 result.
m_data[1][1] = m_data[0][0] * m_data[2][2] - m_data[2][0] * m_data[0][2];
394 result.
m_data[1][2] = m_data[0][2] * m_data[1][0] - m_data[1][2] * m_data[0][0];
396 result.
m_data[2][0] = m_data[1][0] * m_data[2][1] - m_data[2][0] * m_data[1][1];
397 result.
m_data[2][1] = m_data[0][1] * m_data[2][0] - m_data[2][1] * m_data[0][0];
398 result.
m_data[2][2] = m_data[0][0] * m_data[1][1] - m_data[1][0] * m_data[0][1];
400 return result * ( 1.0 / Determinant() );
409 for(
int i = 0; i < 3; i++ )
411 for(
int j = 0; j < 3; j++ )
413 result.
m_data[j][i] = m_data[i][j];
424 for(
int i = 0; i < 3; i++ )
428 for(
int j = 0; j < 3; j++ )
430 aStream << aMatrix.
m_data[i][j];
445 return aOtherMatrix.
m_data[0][0] == m_data[0][0] &&
446 aOtherMatrix.
m_data[0][1] == m_data[0][1] &&
447 aOtherMatrix.
m_data[0][2] == m_data[0][2] &&
448 aOtherMatrix.
m_data[1][0] == m_data[1][0] &&
449 aOtherMatrix.
m_data[1][1] == m_data[1][1] &&
450 aOtherMatrix.
m_data[1][2] == m_data[1][2] &&
451 aOtherMatrix.
m_data[2][0] == m_data[2][0] &&
452 aOtherMatrix.
m_data[2][1] == m_data[2][1] &&
453 aOtherMatrix.
m_data[2][2] == m_data[2][2];
460 return aOtherMatrix.
m_data[0][0] != m_data[0][0] ||
461 aOtherMatrix.
m_data[0][1] != m_data[0][1] ||
462 aOtherMatrix.
m_data[0][2] != m_data[0][2] ||
463 aOtherMatrix.
m_data[1][0] != m_data[1][0] ||
464 aOtherMatrix.
m_data[1][1] != m_data[1][1] ||
465 aOtherMatrix.
m_data[1][2] != m_data[1][2] ||
466 aOtherMatrix.
m_data[2][0] != m_data[2][0] ||
467 aOtherMatrix.
m_data[2][1] != m_data[2][1] ||
468 aOtherMatrix.
m_data[2][2] != m_data[2][2];
MATRIX3x3 describes a general 3x3 matrix.
VECTOR2< T > GetTranslation() const
Get the translation components of the matrix.
MATRIX3x3 Transpose() const
Get the transpose of the matrix.
void SetIdentity()
Set the matrix to the identity matrix.
bool operator==(const MATRIX3x3< T > &aOtherMatrix) const
Not equality operator.
void SetRotation(T aAngle)
Set the rotation components of the matrix.
void SetScale(VECTOR2< T > aScale)
Set the scale components of the matrix.
MATRIX3x3(T a00, T a01, T a02, T a10, T a11, T a12, T a20, T a21, T a22)
Initialize with given matrix members.
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
MATRIX3x3()
Initialize all matrix members to zero.
void SetTranslation(VECTOR2< T > aTranslation)
Set the translation components of the matrix.
bool operator!=(const MATRIX3x3< T > &aOtherMatrix) const
T Determinant() const
Compute the determinant of the matrix.
MATRIX3x3 Inverse() const
Determine the inverse of the matrix.
MATRIX3x3(VECTOR3< T > a1, VECTOR3< T > a2, VECTOR3< T > a3)
Initialize with 3 vectors.
Define a general 2D-vector/point.
Define a general 3D-vector.
std::ostream & operator<<(std::ostream &aStream, const EDA_TEXT &aText)
MATRIX3x3< double > MATRIX3x3D
MATRIX3x3< T > const operator*(MATRIX3x3< T > const &aA, MATRIX3x3< T > const &aB)
Matrix multiplication.