quaternion man page on Plan9

Man page or keyword search:  
man Server   549 pages
apropos Keyword Search (all sections)
Output format
Plan9 logo
[printable version]

QUATERNION(2)							 QUATERNION(2)

NAME
       qtom,  mtoq,  qadd,  qsub,  qneg, qmul, qdiv, qunit, qinv, qlen, slerp,
       qmid, qsqrt - Quaternion arithmetic

SYNOPSIS
       #include <draw.h>
       #include <geometry.h>

       Quaternion qadd(Quaternion q, Quaternion r)

       Quaternion qsub(Quaternion q, Quaternion r)

       Quaternion qneg(Quaternion q)

       Quaternion qmul(Quaternion q, Quaternion r)

       Quaternion qdiv(Quaternion q, Quaternion r)

       Quaternion qinv(Quaternion q)

       double qlen(Quaternion p)

       Quaternion qunit(Quaternion q)

       void qtom(Matrix m, Quaternion q)

       Quaternion mtoq(Matrix mat)

       Quaternion slerp(Quaternion q, Quaternion r, double a)

       Quaternion qmid(Quaternion q, Quaternion r)

       Quaternion qsqrt(Quaternion q)

DESCRIPTION
       The Quaternions are a non-commutative extension field of the Real  num‐
       bers,  designed to do for rotations in 3-space what the complex numbers
       do for rotations in 2-space.  Quaternions have a real component	r  and
       an imaginary vector component v=(i,j,k).	 Quaternions add componentwise
       and multiply according  to  the	rule  (r,v)(s,w)=(rs-v.w,  rw+vs+v×w),
       where . and × are the ordinary vector dot and cross products.  The mul‐
       tiplicative inverse of a non-zero quaternion (r,v) is (r,-v)/(r2-v.v).

       The following routines do arithmetic on quaternions, represented as

	      typedef struct Quaternion Quaternion;
	      struct Quaternion{
		    double r, i, j, k;
	      };

       Name   Description

       qadd   Add two quaternions.

       qsub   Subtract two quaternions.

       qneg   Negate a quaternion.

       qmul   Multiply two quaternions.

       qdiv   Divide two quaternions.

       qinv   Return the multiplicative inverse of a quaternion.

       qlen   Return sqrt(q.r*q.r+q.i*q.i+q.j*q.j+q.k*q.k), the	 length	 of  a
	      quaternion.

       qunit  Return a unit quaternion (length=1) with components proportional
	      to q's.

       A rotation by angle θ about axis A (where A is a unit  vector)  can  be
       represented  by	the  unit  quaternion q=(cos θ/2, Asin θ/2).  The same
       rotation is represented by −q; a rotation by −θ about −A is the same as
       a  rotation  by	θ  about  A.   The  quaternion	q transforms points by
       (0,x',y',z') = q-1(0,x,y,z)q.  Quaternion multiplication composes rota‐
       tions.  The orientation of an object in 3-space can be represented by a
       quaternion giving its rotation relative to some `standard' orientation.

       The following routines operate on rotations or orientations represented
       as unit quaternions:

       mtoq   Convert a rotation matrix (see matrix(2)) to a unit quaternion.

       qtom   Convert a unit quaternion to a rotation matrix.

       slerp  Spherical	 lerp.	 Interpolate  between  two  orientations.  The
	      rotation that carries q to r is  q-1r,  so  slerp(q,  r,	t)  is
	      q(q-1r)t.

       qmid   slerp(q, r, .5)

       qsqrt  The  square  root	 of q.	This is just a rotation about the same
	      axis by half the angle.

SOURCE
       /sys/src/libgeometry/quaternion.c

SEE ALSO
       matrix(2), qball(2)

								 QUATERNION(2)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Plan9

List of man pages available for Plan9

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net