Package tf :: Module transformations :: Class Arcball
[hide private]
[frames] | no frames]

Class Arcball

source code

object --+
         |
        Arcball

Virtual Trackball Control.

>>> ball = Arcball()
>>> ball = Arcball(initial=numpy.identity(4))
>>> ball.place([320, 320], 320)
>>> ball.down([500, 250])
>>> ball.drag([475, 275])
>>> R = ball.matrix()
>>> numpy.allclose(numpy.sum(R), 3.90583455)
True
>>> ball = Arcball(initial=[0, 0, 0, 1])
>>> ball.place([320, 320], 320)
>>> ball.setaxes([1,1,0], [-1, 1, 0])
>>> ball.setconstrain(True)
>>> ball.down([400, 200])
>>> ball.drag([200, 400])
>>> R = ball.matrix()
>>> numpy.allclose(numpy.sum(R), 0.2055924)
True
>>> ball.next()
Instance Methods [hide private]
 
__init__(self, initial=None)
Initialize virtual trackball control.
source code
 
place(self, center, radius)
Place Arcball, e.g. when window size changes.
source code
 
setaxes(self, *axes)
Set axes to constrain rotations.
source code
 
setconstrain(self, constrain)
Set state of constrain to axis mode.
source code
 
getconstrain(self)
Return state of constrain to axis mode.
source code
 
down(self, point)
Set initial cursor window coordinates and pick constrain-axis.
source code
 
drag(self, point)
Update current cursor window coordinates.
source code
 
next(self, acceleration=0.0)
Continue rotation in direction of last drag.
source code
 
matrix(self)
Return homogeneous rotation matrix.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, initial=None)
(Constructor)

source code 

Initialize virtual trackball control.

initial : quaternion or rotation matrix

Overrides: object.__init__

place(self, center, radius)

source code 

Place Arcball, e.g. when window size changes.

center : sequence[2]
Window coordinates of trackball center.
radius : float
Radius of trackball in window coordinates.