qball man page on Plan9

Printed from http://www.polarhome.com/service/man/?qf=qball&af=0&tf=2&of=Plan9

QBALL(2)							      QBALL(2)

       qball - 3-d rotation controller

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

       void qball(Rectangle r, Mouse *mousep,
	    Quaternion *orientation,
	    void (*redraw)(void), Quaternion *ap)

       Qball  is an interactive controller that allows arbitrary 3-space rota‐
       tions to be specified with the mouse.  Imagine a sphere with its center
       at  the midpoint of rectangle r, and diameter the smaller of r's dimen‐
       sions.  Dragging from one point on the sphere to another specifies  the
       endpoints  of a great-circle arc.  (Mouse points outside the sphere are
       projected to the nearest point on the sphere.)  The axis of rotation is
       normal  to the plane of the arc, and the angle of rotation is twice the
       angle of the arc.

       Argument mousep is a pointer to the  mouse  event  that	triggered  the
       interaction.   It  should  have	some button set.  Qball will read more
       events into mousep, and return when no buttons are down.

       While qball is reading mouse events, it calls out  to  the  caller-sup‐
       plied routine redraw, which is expected to update the screen to reflect
       the changing orientation.  Argument orientation is the orientation that
       redraw  should  examine,	 represented as a unit Quaternion (see quater‐
       nion(2)).  The caller may set  it  to  any  orientation.	  It  will  be
       updated	before	each  call to redraw (and on return) by multiplying by
       the rotation specified with the mouse.

       It is possible to restrict qball's attention to rotations about a  par‐
       ticular	axis.	If  ap is null, the rotation is unconstrained.	Other‐
       wise, the rotation will be about the same axis as *ap.  This is	accom‐
       plished by projecting points on the sphere to the nearest point also on
       the plane through the sphere's center and normal to the axis.


       Ken Shoemake, ``Animating Rotation with Quaternion  Curves'',  SIGGRAPH
       '85 Conference Proceedings.

                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
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]
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