Commit 6e8f8f8c by phkarl

Delete Lab5PracticeTask2.c

parent 793765d8
Showing with 0 additions and 50 deletions
#include <stdio.h>
#include <math.h>
int main(){
int matrix[4][3] = {
{1, 4, 6},
{2, -3, 1},
{3, 5, 0},
{3, 1, -3}
};
double angles[6];
int i;
int j;
int n;
int q;
int p;
int dot;
int lenSq1;
int lenSq2;
double angle;
for(i = 0; i < 6; i++){
for(j = 0; j < 4; j++){
for(n = 0; n < 4; n++){
if(n != j){
int x1 = matrix[j][0];
int y1 = matrix[j][1];
int z1 = matrix[j][2];
int x2 = matrix[n][0];
int y2 = matrix[n][1];
int z2 = matrix[n][2];
dot = x1 * x2 + y1 * y2 + z1 * z2;
lenSq1 = x1 * x1 + y1 * y1 + z1 * z1;
lenSq2 = x2 * x2 + y2 * y2 + z2 * z2;
angle = acos(dot / sqrt(lenSq1 * lenSq2));
angles[i] = angle * (180.0 / 3.14159265);
for(q = 0; q < 3; q++){
printf("%d ", matrix[j][q]);
}
printf(" ");
for(p = 0; p < 3; p++){
printf("%d ", matrix[n][p]);
}
printf(" ");
printf("%f\n", angles[i]);
}
}
}
}
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