Miscellaneous Functions
[Functions]


Functions

void EnableAnimate (counter bVal)
 Sets or resets animation mode.
counter GetMouseMode ()
 Return the currently active mouse mode.
list GetMouseSens ()
 Returns the current mouse sensitivity values.
list GetMouseValue (counter iMode, counter iButton)
 Get all mouse values for a particular mode and button.
scalar GetTime ()
 Get time with millisecond precision.
scalar Mouse (counter Mode, counter Button, counter Axis)
 This function returns the value of one of the internal mouse mode variables.
scalar Scalar (any X)
 Tries to cast the element passed to a scalar.
void SetAnimateTimeStep (scalar dStep)
 Sets the time step in milliseconds between executions of the script in animation mode.
void SetEvalPrec (counter Prec)
 Set the number of decimal digits used when evaluating mathematical functions internally.
void SetMouseMode (counter iMode)
 Sets the current mouse mode.
void SetMouseSens (scalar dRot, scalar dTrans)
 Set mouse sensitivity.
void SetMouseValue (counter iMode, counter iButton, multivector vVal)
 Sets the value of the mouse variables for a particular mouse mode and mouse button.
void SetMouseValue (counter iMode, counter iButton, list lVal)
 Sets the value of the mouse variables for a particular mouse mode and mouse button.
void SetTextPrec (counter Prec)
 Set the number of decimal digits used when printing scalar values.
void SetVisPrec (counter Prec)
 Set the number of decimal digits used when doing visualization calculations.
counter Size (vertexlist L)
 Returns the number of elements in a vertex list.
counter Size (list L)
 Returns the number of elements in a list.
counter Size (string S)
 Returns the number of characters in a string.
string Str (any_type X)
 Obsolete name. Use String() instead.
string String (list lList, string sDel)
 Concatenates string representations of list elements with the delimiter symbol sDel.
string String (any_type X)
 Creates string representation of parameter.
string Type (any_type X)
 Returns a string identifying the type of the parameter.

Detailed Description

Functions that do not fit into any particular group.

Function Documentation

void EnableAnimate counter  bVal  ) 
 

Sets or resets animation mode.

Parameters:
bVal If bVal is not zero, then animation is enables. Otherwise it is disabled.
Returns:
Nothing.
This is equivalent to setting the variable _DoAnimate to the value of bVal.

counter GetMouseMode  ) 
 

Return the currently active mouse mode.

Returns:
The currently active mouse mode.
Since:
v2.2

list GetMouseSens  ) 
 

Returns the current mouse sensitivity values.

Returns:
A list with two scalar components, whereby the first gives the current rotation sensitity and the second the current translation sensitivity.

list GetMouseValue counter  iMode,
counter  iButton
 

Get all mouse values for a particular mode and button.

Parameters:
iMode The mouse mode.
iButton The mouse button, 1:left, 2:right.
Returns:
A list of three scalar values.
Instead of calling the function Mouse() three times to obtain all values for a mouse button in a particular mode, you can simply call this function once.

scalar GetTime  ) 
 

Get time with millisecond precision.

Returns:
A time value in seconds with millisecond precision.
This function is useful to measure execution times in CLUCalc.

scalar Mouse counter  Mode,
counter  Button,
counter  Axis
 

This function returns the value of one of the internal mouse mode variables.

Parameters:
Mode The mouse mode. Allowed value are in the range of 1 to 9.
Button The mouse button for which the mouse mode variable is to be read. Button equal to 1 refers to the left mouse button and Button equal to 2 refers to the right mouse button.
Axis The axis of rotation of translation.
  • 1: x-axis
  • 2: y-axis
  • 3: z-axis
Returns:
The current value of the respective mouse mode variable.
Since:
v1.0
See section User Interaction for details on this function.

scalar Scalar any  X  ) 
 

Tries to cast the element passed to a scalar.

Parameters:
X An element or a list of elements to be cast to a scalar.
Returns:
The scalar or a list of scalars.
Since:
v2.1
This function also transforms strings into scalars. In this way you can transform a string of a number into the number itself. If X is a list, then the return value is also a list of scalars.

void SetAnimateTimeStep scalar  dStep  ) 
 

Sets the time step in milliseconds between executions of the script in animation mode.

Parameters:
dStep Timestep in milliseconds.
Returns:
Nothing.

void SetEvalPrec counter  Prec  ) 
 

Set the number of decimal digits used when evaluating mathematical functions internally.

Parameters:
Prec The number of decimal digits.
Returns:
Nothing.
Since:
v2.1

void SetMouseMode counter  iMode  ) 
 

Sets the current mouse mode.

Parameters:
iMode The mouse mode that is to be made active.
Returns:
Nothing.
Since:
v2.2
This allows you to control the current mouse mode from inside a script.

void SetMouseSens scalar  dRot,
scalar  dTrans
 

Set mouse sensitivity.

Parameters:
dRot Rotation sensitivity. Default 0.5.
dTrans Translation sensitivity. Default 0.02.
Returns:
Nothing.
Since:
v2.2
This allows you to set the sensitivity of the mouse.

void SetMouseValue counter  iMode,
counter  iButton,
multivector  vVal
 

Sets the value of the mouse variables for a particular mouse mode and mouse button.

Parameters:
iMode The mouse mode.
iButton The mouse button, 1:left, 2:right.
vVal A vector giving the new values.
Returns:
Nothing.
Since:
v2.2
This function allows you to set the mouse variables which can otherwise only be controlled by the user through the mouse.

void SetMouseValue counter  iMode,
counter  iButton,
list  lVal
 

Sets the value of the mouse variables for a particular mouse mode and mouse button.

Parameters:
iMode The mouse mode.
iButton The mouse button, 1:left, 2:right.
lVal A list of three scalar values.
Returns:
Nothing.
Since:
v2.2
This function allows you to set the mouse variables which can otherwise only be controlled by the user through the mouse.

void SetTextPrec counter  Prec  ) 
 

Set the number of decimal digits used when printing scalar values.

Parameters:
Prec The number of decimal digits.
Returns:
Nothing.
Since:
v1.4
Attention:
The setting of the precision with which scalar values are displayed does so far not work in all cases. This is something that still has to be done.
Nevertheless, here is an example.
A = 1.2345678;

SetTextPrec(1);
?A;

SetTextPrec(2);
?A;

SetTextPrec(3);
?A;

SetTextPrec(4);
?A;

This produces the output

A = 1.2
A = 1.23
A = 1.235
A = 1.2346

void SetVisPrec counter  Prec  ) 
 

Set the number of decimal digits used when doing visualization calculations.

Parameters:
Prec The number of decimal digits.
Returns:
Nothing.
Since:
v2.1
Especially when interpreting multivectors as geometrical objects, this precision is used to distinguish interpretable objects from non-interpretable objects. If you increase the precision, the visualization of certain multivectors may flicker, since sometimes that can be interpreted and at other times they are just about not interpretable.

counter Size vertexlist  L  ) 
 

Returns the number of elements in a vertex list.

Parameters:
L A vertex list.
Returns:
The number of elements in a vertex list.
Since:
v2.0
Size applied to a scalar val is equivalent to $( \mathtt{val}\; != 0)$ .

counter Size list  L  ) 
 

Returns the number of elements in a list.

Parameters:
L A list.
Returns:
The number of elements in a list.
Since:
v2.0
Attention:
The former name of the function is Len.
Here is a code example.

?L = [1, [2,3], 4];
?Size(L);

This code produces the following output.

L = [1, [2, 3], 4]
Constant = 3
Size applied to a scalar val is equivalent to $( \mathtt{val}\; != 0)$ .

counter Size string  S  ) 
 

Returns the number of characters in a string.

Parameters:
S A string.
Returns:
The number of characters in a string.
Since:
v2.0
Attention:
The former name of the function is Len.
Size applied to a scalar val is equivalent to $( \mathtt{val}\; != 0)$ .

string Str any_type  X  ) 
 

Obsolete name. Use String() instead.

Since:
v1.0

string String list  lList,
string  sDel
 

Concatenates string representations of list elements with the delimiter symbol sDel.

Parameters:
lList A list.
sDel The delimiter string.
Returns:
The concatenated string representations of the list elements.
Since:
v2.3
For example,
    ?lList = [ 1.2, VecE3(1,2,3), 4.5 ];
    ?Str(lList, " -> ");

produces the output

lList (3)=
[ 1.2 , 1 e1 + 2 e2 + 3 e3 , 4.5 ]


Constant (32)=
1.2 -> 1^e1 + 2^e2 + 3^e3 -> 4.5


string String any_type  X  ) 
 

Creates string representation of parameter.

Parameters:
X Any object.
Returns:
A string representation of X.
Since:
v1.0
This function is particularly useful if you want to concatenate lists with strings. Since the plus operator is applied recursively to every element of a list the line ?"List " + [1,2] has the output Constant = [List 1, List 2]. To obtain the desired result you can write ?"List " + Str([1,2]) which returns List [1, 2].

For example,

    ?L = [1, 2, 3];
    ?"List = " + L;
    ?"List = " + String(L);

produces the output

    L = [1, 2, 3]
    Constant = [List = 1, List = 2, List = 3]
    List = [1, 2, 3]

string Type any_type  X  ) 
 

Returns a string identifying the type of the parameter.

Parameters:
X Any object.
Returns:
A string identifying the type of X.
Since:
v1.0
For example,
?L = [1, [2,3], 4];
?Type(L);

produces the output

L = [1, [2, 3], 4]
List