aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-25 16:28:37 +0100
committerThomas White <taw@physics.org>2009-11-25 16:28:37 +0100
commit3e7ab3ad8fa154e0ae724757c8b7c8489b70fb99 (patch)
tree629f12f148e8f59ebdb6e0b219160ad1546452eb /src/utils.c
parent7d9b0d7ecd2bc7e7eacb5be56ce64fdaabea8624 (diff)
Tidy up utils module
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c106
1 files changed, 0 insertions, 106 deletions
diff --git a/src/utils.c b/src/utils.c
index 034a2b2d..d5e1b874 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -16,50 +16,6 @@
#include "utils.h"
-/* Return the MOST POSITIVE of two numbers */
-unsigned int biggest(signed int a, signed int b)
-{
- if ( a>b ) {
- return a;
- }
- return b;
-}
-
-
-/* Return the LEAST POSITIVE of two numbers */
-unsigned int smallest(signed int a, signed int b)
-{
- if ( a<b ) {
- return a;
- }
- return b;
-}
-
-
-double distance(double x1, double y1, double x2, double y2)
-{
- return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
-}
-
-
-double modulus(double x, double y, double z)
-{
- return sqrt(x*x + y*y + z*z);
-}
-
-
-double modulus_squared(double x, double y, double z) {
- return x*x + y*y + z*z;
-}
-
-
-double distance3d(double x1, double y1, double z1,
- double x2, double y2, double z2)
-{
- return modulus(x1-x2, y1-y2, z1-z2);
-}
-
-
/* Angle between two vectors. Answer in radians */
double angle_between(double x1, double y1, double z1,
double x2, double y2, double z2)
@@ -70,26 +26,6 @@ double angle_between(double x1, double y1, double z1,
}
-/* As above, answer in degrees */
-double angle_between_d(double x1, double y1, double z1,
- double x2, double y2, double z2)
-{
- return rad2deg(angle_between(x1, y1, z1, x2, y2, z2));
-}
-
-
-/* Wavelength of an electron (in m) given accelerating potential (in V) */
-double lambda(double V)
-{
- double m = 9.110E-31;
- double h = 6.625E-34;
- double e = 1.60E-19;
- double c = 2.998E8;
-
- return h / sqrt(2*m*e*V*(1+((e*V) / (2*m*c*c))));
-}
-
-
size_t skipspace(const char *s)
{
size_t i;
@@ -117,48 +53,6 @@ void chomp(char *s)
}
-int sign(double a)
-{
- if ( a < 0 ) return -1;
- if ( a > 0 ) return +1;
- return 0;
-}
-
-
-void mapping_rotate(double x, double y, double z,
- double *ddx, double *ddy, double *ddz,
- double omega, double tilt)
-{
- double nx, ny, nz;
- double x_temp, y_temp, z_temp;
-
- /* First: rotate image clockwise until tilt axis is aligned
- * horizontally. */
- nx = x*cos(omega) + y*sin(omega);
- ny = -x*sin(omega) + y*cos(omega);
- nz = z;
-
- /* Now, tilt about the x-axis ANTICLOCKWISE around +x, i.e. the
- * "wrong" way. This is because the crystal is rotated in the
- * experiment, not the Ewald sphere. */
- x_temp = nx; y_temp = ny; z_temp = nz;
- nx = x_temp;
- ny = cos(tilt)*y_temp + sin(tilt)*z_temp;
- nz = -sin(tilt)*y_temp + cos(tilt)*z_temp;
-
- /* Finally, reverse the omega rotation to restore the location of the
- * image in 3D space */
- x_temp = nx; y_temp = ny; z_temp = nz;
- nx = x_temp*cos(-omega) + y_temp*sin(-omega);
- ny = -x_temp*sin(-omega) + y_temp*cos(-omega);
- nz = z_temp;
-
- *ddx = nx;
- *ddy = ny;
- *ddz = nz;
-}
-
-
void progress_bar(int val, int total)
{
double frac;