diff --git a/Quaternion.cpp b/Quaternion.cpp
index c23016a..0107389 100644
--- a/Quaternion.cpp
+++ b/Quaternion.cpp
@@ -28,13 +28,6 @@ Quaternion::Quaternion(float _x, float _y, float _z, float _w) {
w = _w;
}
-Quaternion::Quaternion(Vector3 _xyz, float _w) {
- x = _xyz.x;
- y = _xyz.y;
- z = _xyz.z;
- w = _w;
-}
-
Quaternion::Quaternion(Quat q) {
x = q.x;
y = q.y;
@@ -320,8 +313,8 @@ Quaternion Quaternion::SlerpUnclamped(const Quaternion& a, const Quaternion& b,
blendA = 1.0f - t;
blendB = t;
}
-
- Quaternion result = Quaternion(axyz * blendA + b2.xyz() * blendB, blendA * a.w + blendB * b2.w);
+ Vector3 v = axyz * blendA + b2.xyz() * blendB;
+ Quaternion result = Quaternion(v.x, v.y, v.z, blendA * a.w + blendB * b2.w);
if (result.GetLengthSquared() > 0.0f)
return Quaternion::Normalize(result);
else
diff --git a/Quaternion.h b/Quaternion.h
index cff9c69..e5ece6d 100644
--- a/Quaternion.h
+++ b/Quaternion.h
@@ -20,23 +20,34 @@ extern "C" {
///
struct Quaternion : Quat {
public:
+ ///
+ /// Create a new identity quaternion
+ ///
Quaternion();
+ ///
+ /// create a new quaternion with the given values
+ ///
+ /// x axis value
+ /// y axis value
+ /// z axis value
+ /// w axis value
Quaternion(float _x, float _y, float _z, float _w);
- Quaternion(Vector3 _xyz, float _w);
+ ///
+ /// Create a quaternion from C-style Quat
+ ///
+ ///
Quaternion(Quat q);
~Quaternion();
+ ///
+ /// An identity quaternion
+ ///
const static Quaternion identity;
- float GetLength() const;
- float GetLengthSquared() const;
- static float GetLengthSquared(const Quaternion& q);
void Normalize();
static Quaternion Normalize(const Quaternion& q);
static void Normalize(const Quaternion& q, Quaternion& result);
- static float Dot(Quaternion a, Quaternion b);
-
static Vector3 ToAngles(const Quaternion& q1);
Vector3 operator *(const Vector3& p) const;
@@ -65,6 +76,14 @@ public:
static float GetAngleAround(Vector3 axis, Quaternion rotation);
static Quaternion GetRotationAround(Vector3 axis, Quaternion rotation);
static void GetSwingTwist(Vector3 axis, Quaternion rotation, Quaternion* swing, Quaternion* twist);
+
+protected:
+ float GetLength() const;
+ float GetLengthSquared() const;
+ static float GetLengthSquared(const Quaternion& q);
+
+ static float Dot(Quaternion a, Quaternion b);
+
public:
Vector3 xyz() const;
};
diff --git a/README.md b/README.md
index cfe5ca8..6c5904b 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,8 @@
-\author PasserVR
-\version 0.1
\mainpage Vector Algebra
3D Vector algebra library (Vector3, Quaternion)
-Note: this documentation is still work in progress....
-
Main components
---------------
-* Vector3
-* Quaternion
\ No newline at end of file
+* [Vector3](https://passervr.com/apis/VectorAlgebra/struct_vector3.html)
+* [Quaternion](https://passervr.com/apis/VectorAlgebra/struct_quaternion.html)
\ No newline at end of file