00001 #include "../headers/calc.h" 00002 00003 /* 00004 00005 ## GENERAL INFORMATION 00006 ## 00007 ## FILE calc.c 00008 ## AUTHORS P. Schmidtke and V. Le Guilloux 00009 ## LAST MODIFIED 28-11-08 00010 ## 00011 ## SPECIFICATIONS 00012 ## 00013 ## Several function for calculations. CUrrently, only euclidian 00014 ## distances are available. 00015 ## 00016 ## MODIFICATIONS HISTORY 00017 ## 00018 ## 28-11-08 (v) Comments UTD 00019 ## 01-04-08 (v) Added comments and creation of history 00020 ## 01-01-08 (vp) Created (random date...) 00021 ## 00022 ## TODO or SUGGESTIONS 00023 ## 00024 00025 */ 00026 00027 00028 /* 00029 COPYRIGHT DISCLAIMER 00030 00031 Vincent Le Guilloux, Peter Schmidtke and Pierre Tuffery, hereby 00032 disclaim all copyright interest in the program “fpocket” (which 00033 performs protein cavity detection) written by Vincent Le Guilloux and Peter 00034 Schmidtke. 00035 00036 Vincent Le Guilloux 28 November 2008 00037 Peter Schmidtke 28 November 2008 00038 Pierre Tuffery 28 November 2008 00039 00040 GNU GPL 00041 00042 This file is part of the fpocket package. 00043 00044 fpocket is free software: you can redistribute it and/or modify 00045 it under the terms of the GNU General Public License as published by 00046 the Free Software Foundation, either version 3 of the License, or 00047 (at your option) any later version. 00048 00049 fpocket is distributed in the hope that it will be useful, 00050 but WITHOUT ANY WARRANTY; without even the implied warranty of 00051 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00052 GNU General Public License for more details. 00053 00054 You should have received a copy of the GNU General Public License 00055 along with fpocket. If not, see <http://www.gnu.org/licenses/>. 00056 00057 */ 00058 00059 /** 00060 ## FONCTION: 00061 float dist(float x1, float y1, float z1, float x2, float y2, float z2) 00062 00063 ## SPECIFICATION: 00064 Calculate euclidian distance between two points in space p1(x1, y1, z2) and 00065 p2(x2, y2, z2) 00066 00067 ## PARAMETRES: 00068 @ float x1, y1, z1: The first point's coordinates. 00069 @ float x2, y2, z2: The second point's coordinates. 00070 00071 ## RETURN: 00072 float: the distance between p1(x1, y1, z2) and p2(x2, y2, z2) 00073 00074 */ 00075 float dist(float x1, float y1, float z1, float x2, float y2, float z2) 00076 { 00077 float xdif = x1 - x2 ; 00078 float ydif = y1 - y2 ; 00079 float zdif = z1 - z2 ; 00080 00081 return sqrt((xdif*xdif) + (ydif*ydif) + (zdif*zdif)) ; 00082 } 00083 00084 /** 00085 ## FONCTION: 00086 float ddist(float x1, float y1, float z1, float x2, float y2, float z2) 00087 00088 ## SPECIFICATION: 00089 Calculate the square of the euclidian distance between two points in space 00090 p1(x1, y1, z2) and p2(x2, y2, z2) 00091 00092 ## PARAMETRES: 00093 @ float x1, y1, z1: The first point's coordinates. 00094 @ float x2, y2, z2: The second point's coordinates. 00095 00096 ## RETURN: 00097 float: the squared euclidian distance between the two points. 00098 00099 */ 00100 float ddist(float x1, float y1, float z1, float x2, float y2, float z2) 00101 { 00102 float xdif = x1 - x2 ; 00103 float ydif = y1 - y2 ; 00104 float zdif = z1 - z2 ; 00105 00106 return (xdif*xdif) + (ydif*ydif) + (zdif*zdif) ; 00107 } 00108