Documentation

Overview

    Package dualquat provides the dual quaternion numeric type and functions.

    Dual quaternions provide a system for rigid transformation with interpolation and blending in ℝ³. See https://www.cs.utah.edu/~ladislav/kavan06dual/kavan06dual.pdf and https://en.wikipedia.org/wiki/Dual_quaternion for more details.

    Example
    Output:
    
    
    cube:
     0 {x:0 y:0 z:0} -> {x:5 y:3 z:4}
     1 {x:0 y:0 z:1} -> {x:6 y:3 z:4}
     2 {x:0 y:1 z:0} -> {x:5 y:3 z:5}
     3 {x:0 y:1 z:1} -> {x:6 y:3 z:5}
     4 {x:1 y:0 z:0} -> {x:5 y:4 z:4}
     5 {x:1 y:0 z:1} -> {x:6 y:4 z:4}
     6 {x:1 y:1 z:0} -> {x:5 y:4 z:5}
     7 {x:1 y:1 z:1} -> {x:6 y:4 z:5}
    
    line segment:
     0 {x:2 y:1 z:1} -> {x:2 y:1 z:1}
     1 {x:2 y:1 z:2} -> {x:3 y:1 z:1}
    
    Example (Displace)
    Output:
    
    
    (0+7i+6j+11k)
    
    Example (DisplaceAndRotate)
    Output:
    
    
    (0+7i-6j-11k)
    
    Example (Rotate)
    Output:
    
    
    (0+3i-4j-5k)
    
    Example (RotateAndDisplace)
    Output:
    
    
    (0+7i-2j+1k)
    

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func Abs

    func Abs(d Number) dual.Number

      Abs returns the absolute value of d.

      Types

      type Number

      type Number struct {
      	Real, Dual quat.Number
      }

        Number is a float64 precision dual quaternion. A dual quaternion is a hypercomplex number composed of two quaternions, q₀+q₂ϵ, where ϵ²=0, but ϵ≠0. Here, q₀ is termed the real and q₂ the dual.

        func Add

        func Add(x, y Number) Number

          Add returns the sum of x and y.

          func Conj

          func Conj(d Number) Number

            Conj returns the dual quaternion conjugate of d₁+d₂ϵ, d̅₁-d̅₂ϵ.

            func ConjDual

            func ConjDual(d Number) Number

              ConjDual returns the dual conjugate of d₁+d₂ϵ, d₁-d₂ϵ.

              func ConjQuat

              func ConjQuat(d Number) Number

                ConjQuat returns the quaternion conjugate of d₁+d₂ϵ, d̅₁+d̅₂ϵ.

                func Exp

                func Exp(d Number) Number

                  Exp returns e**d, the base-e exponential of d.

                  Special cases are:

                  Exp(+Inf) = +Inf
                  Exp(NaN) = NaN
                  

                  Very large values overflow to 0 or +Inf. Very small values underflow to 1.

                  func Inv

                  func Inv(d Number) Number

                    Inv returns the dual inverse of d.

                    func Log

                    func Log(d Number) Number

                      Log returns the natural logarithm of d.

                      Special cases are:

                      Log(+Inf) = (+Inf+0ϵ)
                      Log(0) = (-Inf±Infϵ)
                      Log(x < 0) = NaN
                      Log(NaN) = NaN
                      

                      func Mul

                      func Mul(x, y Number) Number

                        Mul returns the dual product of x and y.

                        func Pow

                        func Pow(d, p Number) Number

                          Pow return d**p, the base-d exponential of p.

                          func PowReal

                          func PowReal(d Number, p float64) Number

                            PowReal returns d**p, the base-d exponential of p.

                            Special cases are (in order):

                            PowReal(NaN+xϵ, ±0) = 1+NaNϵ for any x
                            PowReal(x, ±0) = 1 for any x
                            PowReal(1+xϵ, y) = 1+xyϵ for any y
                            PowReal(x, 1) = x for any x
                            PowReal(NaN+xϵ, y) = NaN+NaNϵ
                            PowReal(x, NaN) = NaN+NaNϵ
                            PowReal(±0, y) = ±Inf for y an odd integer < 0
                            PowReal(±0, -Inf) = +Inf
                            PowReal(±0, +Inf) = +0
                            PowReal(±0, y) = +Inf for finite y < 0 and not an odd integer
                            PowReal(±0, y) = ±0 for y an odd integer > 0
                            PowReal(±0, y) = +0 for finite y > 0 and not an odd integer
                            PowReal(-1, ±Inf) = 1
                            PowReal(x+0ϵ, +Inf) = +Inf+NaNϵ for |x| > 1
                            PowReal(x+yϵ, +Inf) = +Inf for |x| > 1
                            PowReal(x, -Inf) = +0+NaNϵ for |x| > 1
                            PowReal(x, +Inf) = +0+NaNϵ for |x| < 1
                            PowReal(x+0ϵ, -Inf) = +Inf+NaNϵ for |x| < 1
                            PowReal(x, -Inf) = +Inf-Infϵ for |x| < 1
                            PowReal(+Inf, y) = +Inf for y > 0
                            PowReal(+Inf, y) = +0 for y < 0
                            PowReal(-Inf, y) = Pow(-0, -y)
                            

                            func Scale

                            func Scale(f float64, d Number) Number

                              Scale returns d scaled by f.

                              func Sqrt

                              func Sqrt(d Number) Number

                                Sqrt returns the square root of d

                                Special cases are:

                                Sqrt(+Inf) = +Inf
                                Sqrt(±0) = (±0+Infϵ)
                                Sqrt(x < 0) = NaN
                                Sqrt(NaN) = NaN
                                

                                func Sub

                                func Sub(x, y Number) Number

                                  Sub returns the difference of x and y, x-y.

                                  func (Number) Format

                                  func (d Number) Format(fs fmt.State, c rune)

                                    Format implements fmt.Formatter.