summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llquaternion.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h
index aa0b1752f4..95e4c09695 100644
--- a/indra/llmath/llquaternion.h
+++ b/indra/llmath/llquaternion.h
@@ -28,6 +28,7 @@
#define LLQUATERNION_H
#include <iostream>
+#include <llsd.h>
#ifndef LLMATH_H //enforce specific include order to avoid tangling inline dependencies
#error "Please include llmath.h first."
@@ -64,6 +65,29 @@ public:
const LLVector3 &y_axis,
const LLVector3 &z_axis); // Initializes Quaternion from Matrix3 = [x_axis ; y_axis ; z_axis]
+ explicit LLQuaternion(const LLSD& sd)
+ {
+ setValue(sd);
+ }
+
+ void setValue(const LLSD& sd)
+ {
+ mQ[VX] = (F32) sd[0].asReal();
+ mQ[VY] = (F32) sd[1].asReal();
+ mQ[VZ] = (F32) sd[2].asReal();
+ mQ[VS] = (F32) sd[3].asReal();
+ }
+
+ LLSD getValue() const
+ {
+ LLSD ret;
+ ret[0] = mQ[VX];
+ ret[1] = mQ[VY];
+ ret[2] = mQ[VZ];
+ ret[3] = mQ[VS];
+ return ret;
+ }
+
BOOL isIdentity() const;
BOOL isNotIdentity() const;
BOOL isFinite() const; // checks to see if all values of LLQuaternion are finite