compatibility changes

Fork of LSM303DLHC by brian claus

Revision:
0:de767f4959ef
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vector.cpp	Wed Apr 06 05:05:10 2011 +0000
@@ -0,0 +1,22 @@
+#include <vector.h>
+#include <math.h>
+
+void vector_cross(const vector *a,const vector *b, vector *out)
+{
+  out->x = a->y*b->z - a->z*b->y;
+  out->y = a->z*b->x - a->x*b->z;
+  out->z = a->x*b->y - a->y*b->x;
+}
+
+float vector_dot(const vector *a,const vector *b)
+{
+  return a->x*b->x+a->y*b->y+a->z*b->z;
+}
+
+void vector_normalize(vector *a)
+{
+  float mag = sqrt(vector_dot(a,a));
+  a->x /= mag;
+  a->y /= mag;
+  a->z /= mag;
+}
\ No newline at end of file