GLYLIB
0.3.0b
|
00001 // Function written by Spandana Makeneni, 2011 00002 #include <glylib.h> 00003 //#include <mylib.h> 00004 //#include <molecules.h> 00005 /************** get_distance_from_point_to_plane() ******************/ 00006 double get_signed_distance_from_point_to_plane(plane p, coord_3D pt ){ 00007 00008 double sum, sqroot, d; 00009 //printf("%f %f %f\n",pt.i,pt.j,pt.k); 00010 //printf("%f %f %f\n",p.A,p.B,p.C); 00011 //printf("%f %f %f\n",p.A*pt.i,p.B*pt.j,p.C*pt.k); 00012 sum=(p.A)*(pt.i) + (p.B)*(pt.j) + (p.C)*(pt.k)+p.D; 00013 //printf(" sum is %f\n",sum); 00014 sqroot=sqrt(p.A*p.A + p.B*p.B + p.C*p.C); 00015 d=sum/sqroot; 00016 00017 //get absolute value 00018 return d; 00019 }