aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/utils.h')
-rw-r--r--libcrystfel/src/utils.h86
1 files changed, 41 insertions, 45 deletions
diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h
index 4955f875..a759ff15 100644
--- a/libcrystfel/src/utils.h
+++ b/libcrystfel/src/utils.h
@@ -61,44 +61,10 @@
#define THOMSON_LENGTH (2.81794e-15)
-/* ------------------------------ Quaternions ------------------------------- */
-
-/**
- * quaternion:
- *
- * <programlisting>
- * struct quaternion
- * {
- * double w
- * double x
- * double y
- * double z
- * };
- * </programlisting>
- *
- * A structure representing a quaternion.
- *
- **/
-struct quaternion;
-
-struct quaternion {
- double w;
- double x;
- double y;
- double z;
-};
-
#ifdef __cplusplus
extern "C" {
#endif
-extern struct quaternion normalise_quaternion(struct quaternion q);
-extern double quaternion_modulus(struct quaternion q);
-extern struct quaternion random_quaternion(gsl_rng *rng);
-extern int quaternion_valid(struct quaternion q);
-extern struct rvec quat_rot(struct rvec q, struct quaternion z);
-
-
/* --------------------------- Useful functions ----------------------------- */
extern void show_matrix_eqn(gsl_matrix *M, gsl_vector *v);
@@ -126,17 +92,6 @@ extern double flat_noise(gsl_rng *rng, double expected, double width);
extern double gaussian_noise(gsl_rng *rng, double expected, double stddev);
extern int poisson_noise(gsl_rng *rng, double expected);
-/* Keep these ones inline, to avoid function call overhead */
-static inline struct quaternion invalid_quaternion(void)
-{
- struct quaternion quat;
- quat.w = 0.0;
- quat.x = 0.0;
- quat.y = 0.0;
- quat.z = 0.0;
- return quat;
-}
-
static inline double distance(double x1, double y1, double x2, double y2)
{
return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
@@ -275,6 +230,47 @@ extern char *safe_basename(const char *in);
#define unlikely(x) (x)
#endif
+
+/* ------------------------------ Quaternions ------------------------------- */
+
+/**
+ * quaternion:
+ * @w: component
+ * @x: component
+ * @y: component
+ * @z: component
+ *
+ * A structure representing a quaternion.
+ *
+ **/
+struct quaternion;
+
+struct quaternion {
+ double w;
+ double x;
+ double y;
+ double z;
+};
+
+extern struct quaternion normalise_quaternion(struct quaternion q);
+extern double quaternion_modulus(struct quaternion q);
+extern struct quaternion random_quaternion(gsl_rng *rng);
+extern int quaternion_valid(struct quaternion q);
+extern struct rvec quat_rot(struct rvec q, struct quaternion z);
+
+/* Keep these ones inline, to avoid function call overhead */
+static inline struct quaternion invalid_quaternion(void)
+{
+ struct quaternion quat;
+ quat.w = 0.0;
+ quat.x = 0.0;
+ quat.y = 0.0;
+ quat.z = 0.0;
+ return quat;
+}
+
+
+
#ifdef __cplusplus
}
#endif