Commit c6e93e85 by emonyi

Upload New File

parent 3e981cab
Showing with 119 additions and 0 deletions
#include <stdio.h>
#include <math.h>
int main(){
int i, j;
int matrixArray1[1][3]={
{1,4,6}
};
int matrixArray2[1][3]={
{2,-3,1}
};
int matrixArray3[1][3]={
{3,5,0}
};
int matrixArray4[1][3]={
{3,1,-3}
};
float aDOTb=0, aDOTc=0, aDOTd=0, bDOTc=0, bDOTd=0, cDOTd=0, magA=0, magB=0, magC=0, magD=0;
float ang1, ang2, ang3, ang4, ang5, ang6;
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
magA = (magA + (matrixArray1[i][j] * matrixArray1[i][j]));
}
magA = sqrt(magA);
}
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
magB = (magB + (matrixArray2[i][j] * matrixArray2[i][j]));
}
magB = sqrt(magB);
}
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
magC = (magC + (matrixArray3[i][j] * matrixArray3[i][j]));
}
magC = sqrt(magC);
}
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
magD = (magD + (matrixArray4[i][j] * matrixArray4[i][j]));
}
magD = sqrt(magD);
}
// last bit of magnitude
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
aDOTb = aDOTb + matrixArray1[i][j] * matrixArray2[i][j];
}
}
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
aDOTc = aDOTc + matrixArray1[i][j] * matrixArray3[i][j];
}
}
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
aDOTd = aDOTd + matrixArray1[i][j] * matrixArray4[i][j];
}
}
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
bDOTc = bDOTc + matrixArray2[i][j] * matrixArray3[i][j];
}
}
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
bDOTd = bDOTd + matrixArray2[i][j] * matrixArray4[i][j];
}
}
for(i = 0; i < 1; i++){
for(j = 0; j < 3; j++){
cDOTd = cDOTd + matrixArray3[i][j] * matrixArray4[i][j];
}
}
//finish with dot products
ang1 = acos(aDOTb/(magA*magB));
ang2 = acos(aDOTc/(magA*magC));
ang3 = acos(aDOTd/(magA*magD));
ang4 = acos(bDOTc/(magB*magC));
ang5 = acos(bDOTd/(magB*magD));
ang6 = acos(cDOTd/(magC*magD));
printf("%f\n%f\n%f\n%f\n%f\n%f", ang1,ang2,ang3,ang4,ang5,ang6);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment