GLYLIB
0.3.0b
|
00001 // Function written by Oliver Grant, 2011 00002 #include <glylib.h> 00003 //#include <mylib.h> 00004 //#include <molecules.h> 00005 /************** get_distance_from_point_to_plane() ******************/ 00006 double get_distance_from_point_to_plane(plane p, coord_3D pt, int absl){ 00007 00008 double sum, sqroot, d; 00009 00010 sum=(p.A)*(pt.i) + (p.B)*(pt.j) + (p.C)*(pt.k); 00011 sqroot=sqrt(p.A*p.A + p.B*p.B + p.C*p.C); 00012 d=sum/sqroot; 00013 00014 //get absolute value 00015 if (absl==1){ 00016 if (d<0) {d=d*(-1);} 00017 } 00018 return d; 00019 }