From 9224412274e1e1a31a959083bb257a7d6ab2b113 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 19 Aug 2016 20:40:12 -0400 Subject: Add Sly manual. --- manuals/sly/Quaternions.html | 185 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 manuals/sly/Quaternions.html (limited to 'manuals/sly/Quaternions.html') diff --git a/manuals/sly/Quaternions.html b/manuals/sly/Quaternions.html new file mode 100644 index 0000000..bde3992 --- /dev/null +++ b/manuals/sly/Quaternions.html @@ -0,0 +1,185 @@ + + + + + +Sly: Quaternions + + + + + + + + + + + + + + + + + + + + +
+

+Next: , Previous: , Up: Math   [Contents][Index]

+
+
+ +

4.2.5 Quaternions

+ +
+
(use-modules (sly math quaternion))
+
+ +

Quaternions are used to express rotations about an arbitrary axis in a +way that avoids “gimbal lock” and allows for useful interpolation, +unlike matrices or Euler angles. +

+

Quaternions can be used in rotation transformations +(see Transforms), as well as converted to and from Vectors. +

+
+
Record Type: <quaternion>
+

Data type with 4 fields: w, x, y, z, in +that order. This type descriptor has been exposed for destructuring +via Guile’s (ice-9 match) module. +

+ +
+
Scheme Procedure: make-quaternion v theta
+
Scheme Procedure: make-quaternion w x y z
+

Create a new quaternion from an axis angle (a 3D vector v plus +an angle theta) or from individual coordinates w, x, +y, and z. +

+ +
+
Scheme Procedure: quaternion v theta
+
Scheme Procedure: quaternion w x y z
+

Alternate spelling of make-quaternion. +

+ +
+
Scheme Syntax: quaternion? obj
+

Return #t if obj is a quaternion. +

+ +
+
Scheme Syntax: quaternion-w q
+

Return the w coordinate of the quaternion q. +

+ +
+
Scheme Syntax: quaternion-x q
+

Return the x coordinate of the quaternion q. +

+ +
+
Scheme Syntax: quaternion-y q
+

Return the y coordinate of the quaternion q. +

+ +
+
Scheme Syntax: quaternion-z q
+

Return the z coordinate of the quaternion q. +

+ +
+
Scheme Variable: identity-quaternion
+

The multiplicative identity quaternion. +

+ +
+
Scheme Variable: null-quaternion
+

A quaternion with all fields set to zero. +

+ +
+
Scheme Procedure: quaternion* . quaternions
+

Return the product of all quaternions. Return +identity-quaternion if called without arguments. +

+ +
+
Scheme Procedure: quaternion-slerp q1 q2 delta
+

Perform a spherical linear interpolation of the quaternions q1 +and q2 and blending factor delta. +

+ +
+
Scheme Procedure: quaternion-magnitude q
+

Return the magnitude of the quaternion q. +

+ +
+
Scheme Procedure: quaternion-normalize q
+

Return the normalized form of the quaternion q. +

+ +
+
Scheme Procedure: vector->quaternion v
+

Convert the 4D vector v to a quaternion. +

+ +
+
Scheme Procedure: quaternion->vector q
+

Convert the quaternion q to a 4D vector. +

+ +
+
+

+Next: , Previous: , Up: Math   [Contents][Index]

+
+ + + + + -- cgit v1.2.3