KiCad PCB EDA Suite
matrix3x3.h File Reference
#include <math/vector2d.h>

Go to the source code of this file.

Classes

class  MATRIX3x3< T >
 Class MATRIX3x3 describes a general 3x3 matrix. More...
 
class  MATRIX3x3< T >
 Class MATRIX3x3 describes a general 3x3 matrix. More...
 

Typedefs

typedef MATRIX3x3< double > MATRIX3x3D
 

Functions

template<class T >
std::ostream & operator<< (std::ostream &aStream, const MATRIX3x3< T > &aMatrix)
 
template<class T >
MATRIX3x3< T > const operator* (MATRIX3x3< T > const &aA, MATRIX3x3< T > const &aB)
 Matrix multiplication. More...
 
template<class T >
VECTOR2< T > const operator* (MATRIX3x3< T > const &aA, VECTOR2< T > const &aB)
 Multiplication with a 2D vector, the 3rd z-component is assumed to be 1. More...
 
template<class T , class S >
MATRIX3x3< T > const operator* (MATRIX3x3< T > const &aA, T aScalar)
 Multiplication with a scalar. More...
 
template<class T , class S >
MATRIX3x3< T > const operator* (T aScalar, MATRIX3x3< T > const &aMatrix)
 
template<class T , class S >
MATRIX3x3< T > const operator* (MATRIX3x3< T > const &aMatrix, S aScalar)
 
template<class T , class S >
MATRIX3x3< T > const operator* (S aScalar, MATRIX3x3< T > const &aMatrix)
 

Typedef Documentation

typedef MATRIX3x3<double> MATRIX3x3D

Definition at line 402 of file matrix3x3.h.

Function Documentation

template<class T >
MATRIX3x3< T > const operator* ( MATRIX3x3< T > const &  aA,
MATRIX3x3< T > const &  aB 
)

Matrix multiplication.

Definition at line 278 of file matrix3x3.h.

References MATRIX3x3< T >::m_data.

279 {
280  MATRIX3x3<T> result;
281 
282  for( int i = 0; i < 3; i++ )
283  {
284  for( int j = 0; j < 3; j++ )
285  {
286  result.m_data[i][j] = aA.m_data[i][0] * aB.m_data[0][j] +
287  aA.m_data[i][1] * aB.m_data[1][j] +
288  aA.m_data[i][2] * aB.m_data[2][j];
289  }
290  }
291 
292  return result;
293 }
T m_data[3][3]
Definition: matrix3x3.h:64
Class MATRIX3x3 describes a general 3x3 matrix.
Definition: matrix3x3.h:55
template<class T >
VECTOR2< T > const operator* ( MATRIX3x3< T > const &  aA,
VECTOR2< T > const &  aB 
)

Multiplication with a 2D vector, the 3rd z-component is assumed to be 1.

Definition at line 297 of file matrix3x3.h.

References MATRIX3x3< T >::m_data, VECTOR2< T >::x, and VECTOR2< T >::y.

298 {
299  VECTOR2<T> result( 0, 0 );
300  result.x = aMatrix.m_data[0][0] * aVector.x + aMatrix.m_data[0][1] * aVector.y
301  + aMatrix.m_data[0][2];
302  result.y = aMatrix.m_data[1][0] * aVector.x + aMatrix.m_data[1][1] * aVector.y
303  + aMatrix.m_data[1][2];
304 
305  return result;
306 }
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:65
template<class T , class S >
MATRIX3x3<T> const operator* ( MATRIX3x3< T > const &  aA,
aScalar 
)

Multiplication with a scalar.

template<class T , class S >
MATRIX3x3<T> const operator* ( aScalar,
MATRIX3x3< T > const &  aMatrix 
)
template<class T , class S >
MATRIX3x3<T> const operator* ( MATRIX3x3< T > const &  aMatrix,
aScalar 
)

Definition at line 319 of file matrix3x3.h.

References MATRIX3x3< T >::m_data.

320 {
321  MATRIX3x3<T> result;
322 
323  for( int i = 0; i < 3; i++ )
324  {
325  for( int j = 0; j < 3; j++ )
326  {
327  result.m_data[i][j] = aMatrix.m_data[i][j] * aScalar;
328  }
329  }
330 
331  return result;
332 }
T m_data[3][3]
Definition: matrix3x3.h:64
Class MATRIX3x3 describes a general 3x3 matrix.
Definition: matrix3x3.h:55
template<class T , class S >
MATRIX3x3<T> const operator* ( aScalar,
MATRIX3x3< T > const &  aMatrix 
)

Definition at line 336 of file matrix3x3.h.

337 {
338  return aMatrix * aScalar;
339 }
template<class T >
std::ostream & operator<< ( std::ostream &  aStream,
const MATRIX3x3< T > &  aMatrix 
)

Definition at line 381 of file matrix3x3.h.

References MATRIX3x3< T >::m_data.

382 {
383  for( int i = 0; i < 3; i++ )
384  {
385  aStream << "| ";
386 
387  for( int j = 0; j < 3; j++ )
388  {
389  aStream << aMatrix.m_data[i][j];
390  aStream << " ";
391  }
392 
393  aStream << "|";
394  aStream << "\n";
395  }
396 
397  return aStream;
398 }
T m_data[3][3]
Definition: matrix3x3.h:64