Important facts about commercial licenses

  • Licenses are perpetual. They do not expire and do not need to be renewed.
  • Licenses can be upgraded. You can upgrade to a more expensive license later paying only the difference in cost.
  • Pay attention to the distribution type - Hosted (sites / servers), binary (applications) or source (includes all the others). Choose according to your needs (more below).
  • All licenses allow commercial use unless otherwise indicated.
  • Read the full license by clicking on the icon.
  • Read more about licenses in our handy license guide.
$4

Personal License

1 application Binary restricted distribution
$10

Developer License

Unlimited projects Source and binary distribution
You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

Fast 3x3 Matrix class

Fast 3x3 Matrix class
Developed by vincenzo panella, Released May 21, 2011

Fast 3x3 matrix handling class

C/C++

Tags: fast , game programming , math , matrix

Common operations are implemented through the use of templated overloaded operators, allowing for very readable and fast 3D matrix calculations. This class is compiler-agnostic, and can be used on multiple platforms (including mobile) with minimal refactoring. The class can be used wherever is needed a fast fixed 3x3 matrix computations , the application ranges from game development to mathematical programs which makes use of heavy computation tasks.

Usage Examples:

CMatrix3x3f Ma,Mb,Mc;

Ma.Set (  1 , 2 , 3,
     3 , 4,  5,
     6 , 7,  1 );

           Mb.Set (  1 , 2 , 3,
               3 , 4,  5,
     6 , 7,  1 );

Mc.Set (  1 , 2 , 3,
    3 , 4,  5,
     6 , 7,  8 );

Declare a matrix using :

CMatrix2x2f Ma;    

Ma.Set (  1 ,2 ,  3 ,4 );

Mb.Set (  4 ,5 ,  6 ,7 );

Mc.Set (  1 ,2 ,  2 ,1 );

Common operations :

// multiplication

Ma=Ma * 2.0f ;      

Ma*= 2.0f ;         

Ma = Mb * 3.0f;         

Ma = 3.0f * Mb ;            

Ma = Mb / 2.0f ; // multipication by inverse of a constant

// sum and subtraction

Ma+=Mb;      

Ma-=Mb;      

Ma = Mb + Mc;

Ma = -Mb + Mc;

// matrix multilication

Ma = Mb * Mc ;

Ma= 4.0f / Mb;  

Invert(Ma);     //invert matrix 

Transpose(Ma);      //transpose matrix 

Zero(Ma);               // zero out the matrix

Identity(Ma);               // identity matrix

Ma.Get(1,0);            // gets value at coordinates

Ma[0]=2.0f;         // setting a value by direct access

// logic operations

if ( Ma!=Mb )     cout << "Matrices are different" << endl;


if ( Ma==Mb )   cout << "Matrices are equal" << endl;

Ma.Rot ( 45.0f,10.0f,90.0f ); // compute matrix rotation

GetRank(Ma);                   // gets matrix rank

float d = Ma.Determinant();   // gets determinant

// compute the trace of the matrix

float t= GetMatrixTrace( Ma );

// Determine if the matrix is lower triangular

bool b=IsLowerTriangular (Ma);

// Determine if the matrix is upper triangular

bool b=IsUpperTriangular (Ma);

// Determine if the matrix is skew-symmetric

bool b=IsSkewSimmetric(Ma) ;

// test if matrix is simmetric

bool b=IsSimmetric(Ma);

// Determine if the matrix is diagonal

bool b=IsDiagonal (Ma) ;

// calculate the condition number // which is the norm multiplied // byt the norm of the matrix // inverse

float c=ConditionNumber(Ma);

// calculate the norm of a matrix

float n=Norm (Ma);

// Determine if the matrix is singular

bool b=Ma.IsSingular (Ma) ;

// solve the system defined by the matrix

SolveLinearMatrix( Ma,V,S );

User Reviews

No reviews have been submitted yet.

Questions & Comments


Or enter your name and Email
No comments have been posted yet.
You must be logged-in to vote. Log-in to your account or register now.