Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Matrix.cpp
00001 void Vector_Cross_Product(float C[3], float A[3], float B[3]) 00002 { 00003 C[0] = (A[1] * B[2]) - (A[2] * B[1]); 00004 C[1] = (A[2] * B[0]) - (A[0] * B[2]); 00005 C[2] = (A[0] * B[1]) - (A[1] * B[0]); 00006 00007 return; 00008 } 00009 00010 void Vector_Scale(float C[3], float A[3], float b) 00011 { 00012 for (int m = 0; m < 3; m++) 00013 C[m] = A[m] * b; 00014 00015 return; 00016 } 00017 00018 float Vector_Dot_Product(float A[3], float B[3]) 00019 { 00020 float result = 0.0; 00021 00022 for (int i = 0; i < 3; i++) { 00023 result += A[i] * B[i]; 00024 } 00025 00026 return result; 00027 } 00028 00029 void Vector_Add(float C[3], float A[3], float B[3]) 00030 { 00031 for (int m = 0; m < 3; m++) 00032 C[m] = A[m] + B[m]; 00033 00034 return; 00035 } 00036 00037 void Vector_Add(float C[3][3], float A[3][3], float B[3][3]) 00038 { 00039 for (int m = 0; m < 3; m++) 00040 for (int n = 0; n < 3; n++) 00041 C[m][n] = A[m][n] + B[m][n]; 00042 } 00043 00044 void Matrix_Multiply(float C[3][3], float A[3][3], float B[3][3]) 00045 { 00046 for (int i = 0; i < 3; i++) { 00047 for (int j = 0; j < 3; j++) { 00048 C[i][j] = 0; 00049 for (int k = 0; k < 3; k++) { 00050 C[i][j] += A[i][k] * B[k][j]; 00051 } 00052 } 00053 } 00054 }
Generated on Sat Jul 16 2022 20:25:06 by
1.7.2