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

Go to the source code of this file.

Classes

class  MATRIX3x3< T >
 MATRIX3x3 describes a general 3x3 matrix. More...
 
class  MATRIX3x3< T >
 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

◆ MATRIX3x3D

typedef MATRIX3x3<double> MATRIX3x3D

Definition at line 398 of file matrix3x3.h.

Function Documentation

◆ operator *() [1/6]

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

Matrix multiplication.

Definition at line 274 of file matrix3x3.h.

275 {
276  MATRIX3x3<T> result;
277 
278  for( int i = 0; i < 3; i++ )
279  {
280  for( int j = 0; j < 3; j++ )
281  {
282  result.m_data[i][j] = aA.m_data[i][0] * aB.m_data[0][j] +
283  aA.m_data[i][1] * aB.m_data[1][j] +
284  aA.m_data[i][2] * aB.m_data[2][j];
285  }
286  }
287 
288  return result;
289 }
T m_data[3][3]
Definition: matrix3x3.h:64
MATRIX3x3 describes a general 3x3 matrix.
Definition: matrix3x3.h:55

References MATRIX3x3< T >::m_data.

◆ operator *() [2/6]

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 293 of file matrix3x3.h.

294 {
295  VECTOR2<T> result( 0, 0 );
296  result.x = aMatrix.m_data[0][0] * aVector.x + aMatrix.m_data[0][1] * aVector.y
297  + aMatrix.m_data[0][2];
298  result.y = aMatrix.m_data[1][0] * aVector.x + aMatrix.m_data[1][1] * aVector.y
299  + aMatrix.m_data[1][2];
300 
301  return result;
302 }
Define a general 2D-vector/point.
Definition: vector2d.h:61

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

◆ operator *() [3/6]

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

Multiplication with a scalar.

◆ operator *() [4/6]

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

◆ operator *() [5/6]

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

Definition at line 315 of file matrix3x3.h.

316 {
317  MATRIX3x3<T> result;
318 
319  for( int i = 0; i < 3; i++ )
320  {
321  for( int j = 0; j < 3; j++ )
322  {
323  result.m_data[i][j] = aMatrix.m_data[i][j] * aScalar;
324  }
325  }
326 
327  return result;
328 }
T m_data[3][3]
Definition: matrix3x3.h:64
MATRIX3x3 describes a general 3x3 matrix.
Definition: matrix3x3.h:55

References MATRIX3x3< T >::m_data.

◆ operator *() [6/6]

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

Definition at line 332 of file matrix3x3.h.

333 {
334  return aMatrix * aScalar;
335 }

◆ operator<<()

template<class T >
std::ostream & operator<< ( std::ostream &  aStream,
const MATRIX3x3< T > &  aMatrix 
)

Definition at line 377 of file matrix3x3.h.

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

References MATRIX3x3< T >::m_data.