aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-26 12:20:41 +0100
committerThomas White <taw@physics.org>2009-11-26 12:20:41 +0100
commit844947d19261a2c71280b9f638ad7f5e88e16c73 (patch)
tree9f0e24499843267b8fd731639d73274b7c97cdab /src/utils.h
parent3d22f28223ee6dcef7e8d0cba247ac112942e344 (diff)
Add more options, including random orientations
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index b4b5a58e..39988ae1 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -56,6 +56,11 @@ struct quaternion
double z;
};
+extern struct quaternion normalise_quaternion(struct quaternion q);
+extern double quaternion_modulus(struct quaternion q);
+extern struct quaternion random_quaternion(void);
+extern int quaternion_valid(struct quaternion q);
+
/* --------------------------- Useful functions ----------------------------- */
@@ -67,6 +72,16 @@ extern void progress_bar(int val, int total, const char *text);
extern double poisson_noise(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));