GLYLIB
0.3.0b
|
00001 // Function written by B. Lachele Foley, 2007 00002 #include <mylib.h> 00003 #include <molecules.h> 00004 /* This function returns the cross product of two vectors. 00005 It also calculates and saves d in the structure. */ 00006 /******************** get_crossprod() *********************/ 00007 vectormag_3D get_crossprod(vectormag_3D a,vectormag_3D b){ 00008 vectormag_3D xp; 00009 xp.i=a.j*b.k-a.k*b.j; 00010 xp.j=-(a.i*b.k-a.k*b.i); 00011 xp.k=a.i*b.j-a.j*b.i; 00012 xp.d=sqrt(xp.i*xp.i+xp.j*xp.j+xp.k*xp.k); 00013 return xp; 00014 }