- Initial commit of a UB calculation setup for four circle

diffractometers
This commit is contained in:
koennecke
2005-03-23 08:19:47 +00:00
parent 2b63ad06b2
commit beba0d4644
18 changed files with 1236 additions and 55 deletions

92
trigd.c Normal file
View File

@ -0,0 +1,92 @@
/**
* This is a library of trigonmetric functions acting upon proper
* angles and not radians. Lifted from the Risoe tascom code
*
* March 2005
*/
#include <math.h>
#include "trigd.h"
/* define constants */
#ifndef PI
#define PI (3.1415926536) /* pi */
#endif
#define DEGREE_RAD (PI/180.0) /* Radians per degree */
/*******************************************************************************/
double Sign(double d)
{
if(d < .0){
return -1;
} else {
return 1;
}
}
/*******************************************************************************
* Sinus of angle in degrees.
*******************************************************************************/
extern double Sind (double x)
{
return (sin (x*DEGREE_RAD));
}
/*******************************************************************************
* Tangens of angle in degrees.
*******************************************************************************/
extern double Tand(double x)
{
return (tan(x*DEGREE_RAD));
}
/*******************************************************************************
* Cosinus of angle in degrees.
*******************************************************************************/
extern double Cosd (double x)
{
return (cos (x*DEGREE_RAD));
}
/*******************************************************************************
* Atan of angle in degrees.
*******************************************************************************/
extern double Atand (double x)
{
double data;
data = (atan(x)/DEGREE_RAD);
return (data);
}
/*******************************************************************************
* Atan2 of angle in degrees.
*******************************************************************************/
extern double Atand2 (double x)
{
double data;
data = (atan(x)/DEGREE_RAD);
return (data);
}
/*******************************************************************************
* Acos of angle in degrees.
*******************************************************************************/
extern double Acosd (double x)
{
double data;
data = acos(x)/DEGREE_RAD;
return (data);
}
/*******************************************************************************
* Asin of angle in degrees.
*******************************************************************************/
extern double Asind (double x)
{
double data;
data = x*x;
if (data == 1.0)
return (180.00 - Sign (x)*90.00);
else if (data > 1)
{
return (0);
}
else
return (Atand (x/sqrt (1 - data)));
}