How you activate the different mouse modes depends on your front-end. If you use GLUT then the mouse mode is currently set via the keys 0 to 1. In CLUCalc you set the mouse mode either via a menu option or by pressing CTRL+0 to CTRL+9, i.e. hold down the CTRL (Strg) key and press one of the number keys. Independent of the mouse mode you are in you can always rotate or translate the whole space by holding down the CTRL (Strg) key and one of the mouse buttons while moving the mouse.
VecXX
functions. For example, if you write VecE3(1)
the vector returned is affected by moving the mouse with the right mouse button pressed in mouse mode 1. Initially, the internal variables that are affected by moving the mouse in different mouse modes are set to zero. Therefore, if you want to give a vector an initial offset simply write A = VecE3(1) + e1
, for example.
A different way to use user interaction is through the function Mouse
. This function expects three parameters:
The following example shows how the Mouse
function can be used to translate and rotate a vector. This script may be found under Mouse1.clu
.
DefVarsE3(); // Mouse(Mode, Rot(1)/Trans(2), Axis) // Read Rotation variables ?RX = Mouse(1,1,1); ?RY = Mouse(1,1,2); ?RZ = Mouse(1,1,3); // Read Translation variables ?TX = Mouse(1,2,1); ?TY = Mouse(1,2,2); ?TZ = Mouse(1,2,3); // Construct Rotor R = RotorE3(1, 0, 0, RX); R = R * RotorE3(0, 1, 0, RY); R = R * RotorE3(0, 0, 1, RZ); // Draw Rotor :R:DBlue; // Rotate/Translate vector :X = VecE3(TX, TY, TZ) + e1:Red; :*X; :Y = R * X * ~R:Blue; :*Y;