quaternionArcballExample
About Quaternion Arc Ball Example
--

Learning Objectives
This openFrameworks example illustrates how to rotate a sphere as an arcball by dragging it, utilizing quaternions.
In the code, pay attention to:
ofTranslate(ofGetWidth()/2, ofGetHeight()/2, 40);to make 0,0 the center of the screencurRot.getRotate(angle,axis)which gets the current rotationofDrawSphereto draw the sphereofRotatewhich applies the rotation from the quaternion to the viewportofApp::mousePressedto capture the last position of the mouse when pressedvoid ofApp::mouseDraggedto capture the mouse drag movement change and apply those changes in terms of rotation to be applied in thedrawfunction
Expected Behavior
When launching this app, you should see
- A white mesh sphere centered in the middle of the screen with a black background
Instructions for use:
- Drag the mouse across the sphere to rotate it.