Advertisement
BORUTO-121

vector_cross_product

Sep 4th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. typedef struct {
  4.   double x,y,z;
  5. } Vektor3d;
  6.  
  7. Vektor3d vektorski_proizvod(Vektor3d v1, Vektor3d v2){
  8.   return (Vektor3d){v1.y*v2.z-v1.z*v2.y, v1.z*v2.x-v1.x*v2.z, v1.x*v2.y-v1.y*v2.x};
  9. }
  10. int main(){
  11.   Vektor3d v=vektorski_proizvod((Vektor3d){5,-2,3},(Vektor3d){1,3,-4});
  12.   printf("%lf %lf %lf",v.x,v.y,v.z);
  13.   return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement