0
Help me please with vectors
Write a program in which to implement a function for computing the vector product of two vectors. The result of the vector product of the vectors a = (a1, a2, a3) and b = (b1, b2, b3) is the vector c = ((a3 * b3-a3 * b2), (a3 * b1-a1 * b3), (a1 * b2-a2 * b1))
1 Réponse
0
struct vector {
int x;
int y;
int z;
}
vector multiply (vector v1, vector v2){
vector v3;
v3.x=v1.z*v2.z-v1.z*v2.y;
v3.y=v1.z*v2.x-v1.x*v2.z;
v3.z=v1.x*v2.y-v2.y*v2.x;
return v3;
}
not the best solution but a simple one