Drawing Functions
[Functions]


Functions

void AddFrameOrigin (scalar x, scalar y, scalar z)
 Adds a vector to the current origin of the drawing frame.
void AddFrameRotor (multivector R)
 Adds a rotation to the drawing frame.
color Color (scalar r, scalar g, scalar b, scalar a)
 Generate a color variable.
color Color (scalar r, scalar g, scalar b)
 Generate a color variable.
void DrawArc (multivector P, multivector A, multivector B, scalar Rad, counter Short)
 Draws an arc.
void DrawArrow (scalar ax, scalar ay, scalar az, scalar bx, scalar by, scalar bz)
 Draws an arrow.
void DrawArrow (multivector A, multivector B)
 Draws an arrow.
void DrawBox (multivector P, multivector A, multivector B, scalar Depth, list CornerColorList)
 Draws a box.
void DrawBox (multivector P, multivector A, multivector B, multivector C, list CornerColorList)
 Draws a box.
void DrawCircle (multivector P, multivector N, scalar Rad)
 Draws a circle.
vertexlist DrawCircleSurface (list LMV, list LCol, counter DoDraw)
 Draws the surface spanned by a set of circles.
void DrawCone (multivector P, multivector A, scalar Rad)
 Draws a cone.
vertexlist DrawCylinder (multivector P, multivector D, scalar Radius, counter DoDraw)
 Draws an open cylinder.
void DrawDisk (multivector P, multivector A, multivector B, scalar Rad, counter Short)
 Draws a partial disk.
void DrawEllipse (multivector P, multivector A, multivector B)
 Draws an ellipse.
void DrawEllipsoid (multivector P, multivector A, multivector B, multivector C)
 Draws an ellipsoid.
void DrawIcosahedron (multivector vC, scalar dRadius, counter iPower, counter bSolid)
 Draws an icosahedron.
void DrawLine (scalar ax, scalar ay, scalar az, scalar bx, scalar by, scalar bz)
 Draws a line.
void DrawLine (multivector A, multivector B)
 Draws a line.
vertexlist DrawLineSurface (list LMV, list LCol, counter DoDraw)
 Draws the surface spanned by a set of lines.
void DrawPlane (scalar cx, scalar cy, scalar cz, scalar ax, scalar ay, scalar az, scalar bx, scalar by, scalar bz, scalar Rad)
 Draws a plane.
void DrawPlane (multivector C, multivector A, multivector B, scalar Rad)
 Draws a plane.
void DrawPoint (scalar x, scalar y, scalar z)
 Draws a point.
void DrawPoint (multivector A)
 Draws a point.
vertexlist DrawPointGrid (counter CountX, counter CountY, list LMV, list LCol, counter DoDraw, counter NegNormals, list LNorm)
 Draws a surface grid over a 2-dimensional set of points.
vertexlist DrawPointList (list LMV, list LCol, counter DoDraw, counter NegNormals, list LNorm)
 Draws a line through a set of points.
vertexlist DrawPointSurface (counter CountX, counter CountY, list LMV, list LCol, counter DoDraw, counter NegNormals, list LNorm)
 Draws a surface over a 2-dimensional set of points.
void DrawSphere (multivector P, scalar Rad)
 Draws a sphere.
void DrawText (multivector A, string Text)
 Draws a simple text.
void DrawTriangle (multivector A, multivector B, multivector C)
 Draws a triangle.
void DrawTriangle (scalar ax, scalar ay, scalar az, scalar bx, scalar by, scalar bz, scalar cx, scalar cy, scalar cz)
 Draws a triangle.
void EnableAbsTexCoords (counter bVal)
 Enables or disables the use of absolute texture coordinates.
void EnableFog (counter bEnable)
 Enables or disables fog.
void EnableSmoothLine (counter IsSmooth)
 Enables anti-aliasing for lines.
void EnableSmoothPoint (counter IsSmooth)
 Enables anti-aliasing for points.
void EndOverlay (void)
 Ends an overlay block.
void EndView ()
 Exit the actual view.
counter GetLineWidth ()
 Returns the width of lines.
counter GetPointSize ()
 Returns the size of points.
void Offset (multivector A, multivector X, scalar scale)
 This function draw multivector A at the offset given by multivector X and scaled to scale. Use this function, for example, to draw plane or lines at particular positions.
vertexlist Plot (list A, list L1, list L2, scalar S)
 Draw a point-valued 2D-function, i.e. a surface, with associated colors and normals.
vertexlist Plot (list A, list L)
 Draw a point-, circle- or line-valued 1D-function with varying colors.
vertexlist Plot (multivector F, list L1, list L2, scalar S)
 Draw a point-valued 2D-function, i.e. a surface.
vertexlist Plot (multivector F, list L)
 Draw a point-, circle- or line-valued 1D-function.
void PopFrame (void)
 Restore saved projection matrix from the stack.
void PushFrame (void)
 Save current projection matrix to a stack.
void RotateFrame (multivector R)
 Rotates the drawing frame.
void RotateView (multivector R)
 Rotates the projectview matrix of OpenGl.
void SetArrowShape (scalar dLength, scalar dAngle)
 Sets the shape in which arrows are drawn.
void SetFogColor (color colFog)
 Sets the color of fog.
void SetFogDensity (scalar dDensity)
 Set the density of fog.
void SetFrameOrigin (scalar x, scalar y, scalar z)
 Sets the origin of the drawing frame.
void SetFrameRotor (multivector R)
 Sets the rotation of the drawing frame.
void SetLineWidth (scalar Width)
 Sets the width of lines in pixel.
void SetMode (counter mode)
 Sets one or a number of drawing modes.
void SetPlotMode (counter mode)
 Sets the plot mode for the function Plot().
void SetPointSize (scalar Size)
 Sets the size of points in pixel.
void SetTextSize (counter Size)
 Sets the size of text drawn with DrawText().
void SetTexture (image Img)
 Sets the texture for texture mapping, or disables texture mapping.
void SetTextureRepeat (scalar dFac)
 Sets the texture repetition factor.
void SetViewAngle (scalar a)
 Set the perspective angle which affects the modelview.
void SetVisWinSize (counter iWidth, counter iHeight)
 Set the size of the visualization window.
void StartOverlay (void)
 Starts an overlay block.
void StartView (scalar x, scalar y, scalar w, scalar h)
 Start a new view.
void TranslateFrame (multivector T)
 Translates the drawing frame.
void TranslateFrame (scalar x, scalar y, scalar z)
 Translates the drawing frame.
void TranslateView (multivector T)
 Translate the projectview matrix of OpenGl.
void TranslateView (scalar x, scalar y, scalar z)
 Translate the projectview matrix of OpenGl.

Detailed Description

Functions that draw geometric entities or influence the way they are visualized.

Function Documentation

void AddFrameOrigin scalar  x,
scalar  y,
scalar  z
 

Adds a vector to the current origin of the drawing frame.

Parameters:
x Displacement x-coordinate of frame origin.
x Displacement y-coordinate of frame origin.
x Displacement z-coordinate of frame origin.
Returns:
Nothing
Since:
v1.4
This allows you to move the origin of the basis frame into which all entities are drawn.

void AddFrameRotor multivector  R  ) 
 

Adds a rotation to the drawing frame.

Parameters:
R A rotor giving the rotation of the frame.
Returns:
Nothing
Since:
v1.4
This allows you to change the orientation of the basis frame relative to its current orientation. The rotor R is multiplied from the left to the current rotor.

color Color scalar  r,
scalar  g,
scalar  b,
scalar  a
 

Generate a color variable.

Parameters:
r The red color component.
g The green color component.
b The blue color component.
a The alpha (translucency) color component.
Returns:
A color variable that can be applied to the visualization state-machine via the colon operator (:).
Since:
v1.0
The color components are clamped to the range [0,1]. That is, if you pass a value outside this range it is changed to the nearest element of the range. See script Color1.clu for a nice example. The last parameter (the alpha component) gives the translucency of an object. If alpha is one, then the object is completely opaque. If alpha is zero, then the object is completely transparent.

color Color scalar  r,
scalar  g,
scalar  b
 

Generate a color variable.

Parameters:
r The red color component.
g The green color component.
b The blue color component.
Returns:
A color variable that can be applied to the visualization state-machine via the colon operator (:).
Since:
v1.0
Attention:
From CLUCalc v3.0.0 onwards you can create a code-line defining a color from a color chooser via the menu in the editor window. Also, if you place your cursor on the word "Color" of a Color-function call, and select the appropriate menu item, the color chooser will modify the code-line.
The color components are clamped to the range [0,1]. That is, if you pass a value outside this range it is changed to the nearest element of the range. See script Color1.clu for a nice example.

For example,

DefVarsE3();

?MyCol = Color(0.1, 0.4, 0.6);
:e1 :MyCol;

produces the output

MyCol = (0.1, 0.4, 0.6)

void DrawArc multivector  P,
multivector  A,
multivector  B,
scalar  Rad,
counter  Short
 

Draws an arc.

Parameters:
P Vector giving origin of arc.
A Vector giving start point of arc.
B Vector giving end point of arc.
Rad Radius of arc.
Short (optional) Boolean flag. If set to 1 it indicates that the arc along the shortest path from A to B is to be drawn (default). Otherwise, the arc is drawn along the longer path.
Returns:
Nothing
Since:
v1.4
Draws an arc in the plane passing through P and spanned by P - A and P - B. The origin of the arc is at P and its radius is given by Rad. The flag Short allows you to draw either the arc from A to B along the short path or along the long path. Here is an example.

DefVarsE3();

:Green;
:P = e2;

:Red;
:A = e1 + e2;

:Blue;
:B = e3 + e2;

:Magenta;
DrawArc(P, A, B, 1);

:Cyan;
DrawArc(P, A, B, 1, 0);

This script generates the following image.

ArcTest2_img1.jpg

void DrawArrow scalar  ax,
scalar  ay,
scalar  az,
scalar  bx,
scalar  by,
scalar  bz
 

Draws an arrow.

Parameters:
ax x-coordinate of start point of arrow.
ay y-coordinate of start point of arrow.
az z-coordinate of start point of arrow.
bx x-coordinate of end point of arrow.
by y-coordinate of end point of arrow.
bz z-coordinate of end point of arrow.
Returns:
Nothing
Since:
v1.4
Draws an arrow from (ax, ay, az) to (bx, by, bz).

void DrawArrow multivector  A,
multivector  B
 

Draws an arrow.

Parameters:
A Multivector giving start point of the arrow.
B Multivector giving end point of the arrow.
Returns:
Nothing
Since:
v1.4
Draws an arrow from position of A to position of B.

void DrawBox multivector  P,
multivector  A,
multivector  B,
scalar  Depth,
list  CornerColorList
 

Draws a box.

Parameters:
P Multivector giving center position of box.
A Multivector giving first edge direction and length.
B Multivector giving second edge direction and length.
Depth Scalar giving depth of box.
CornerColorList (optional) List of eight colors for the corners of the box.
Returns:
Nothing
Since:
v2.0
Draws a box centered on P, with edge directions A, B. The third edge direction is perpendicular to A and B and has a length given by Depth. The optional list of colors, draws the corners of the box in the respective colors and uses smooth color shading between the corners.

void DrawBox multivector  P,
multivector  A,
multivector  B,
multivector  C,
list  CornerColorList
 

Draws a box.

Parameters:
P Multivector giving center position of box.
A Multivector giving first edge direction and length.
B Multivector giving second edge direction and length.
C Multivector giving third edge direction and length.
CornerColorList (optional) List of eight colors for the corners of the box.
Returns:
Nothing
Since:
v2.0
Draws a box centered on P, with edge directions A, B and C. The optional list of colors, draws the corners of the box in the respective colors and uses smooth color shading between the corners. Here is an example. The script

    DefVarsE3();
    lCol = [ Red, Magenta, Blue, Cyan, Green, Yellow, White, DWhite ];
    DrawBox(id, e1, e2, e3, lCol);

produces the visualization

BoxEx1.jpg

void DrawCircle multivector  P,
multivector  N,
scalar  Rad
 

Draws a circle.

Parameters:
P Vector giving origin of circle.
N Vector giving normal of plane in which circle lies.
Rad Radius of circle
Returns:
Nothing
Since:
v1.4

vertexlist DrawCircleSurface list  LMV,
list  LCol,
counter  DoDraw
 

Draws the surface spanned by a set of circles.

Parameters:
LMV A list of multivectors in conformal space representing circles.
LCol A list with one color for each circle.
DoDraw (optional) A boolean flag indicating whether the surface is to be drawn directly (= 1, default), or not.
Returns:
A vertex list representing the surface spanned by the circles. This vertex list can be useful to draw the surface at some later stage without having to execute this function.
Since:
v1.4
This function only works with multivectors that represent circles in conformal space. How the surface connecting two circles is drawn, depends on their normals. In the following simple example, a nice effect is obtained by negating the normal of the central circle. Also see the script KleinBottle.clu which draws a Klein bottle.

// Switch on anti-aliasing for lines
EnableSmoothLine(1);

// Define the standard basis vector variables
// for conformal space.
DefVarsN3();

// Do not show the frame box
_FrameBoxSize = 0;

// Define three spheres
S1 = SphereN3(0,0,0, 1);
S2 = SphereN3(0.1,0.5,0, 1);
S3 = SphereN3(0.2,0.7,0, 1);

// Draw all spheres with a solid surface
:N3_SOLID;
// Use a transparent color
:Color(0.198, 0.264, 1.000, 0.8);
// Draw a fourth sphere, whose x-position 
// can also be influenced by the user in
// mouse mode one with the right 
// mouse button. 
:S4 = SphereN3(Mouse(1,2,1),0.8,0, 1);

// Set the color to red
:Red;
// Intersect spheres 1 and 2, and
// draw intersection circle
:C1 = *S1 . S2;

// Set Color to green
:Green;
// Intersect spheres 2 and 3, and
// draw intersection circle
// If you remove the minus sign in this equation,
// you obtain a completely different surface.
:C2 = -*S2 . S3;

// Set Color to magenta
:Magenta;
// Intersect spheres 3 and 4, and
// draw intersection circle
:C3 = *S3 . S4;

// Create a list of circles
LCircle = [C1, C2, C3];

// Create a list of colors
LColor = [Red, Green, Magenta];

// Draw surface spanned by circles.
DrawCircleSurface(LCircle, LColor);

This script generates the following visualization.

CircleSurface_img1.jpg

If you change the line :C2 = -*S2 . S3 into :C2 = *S2 . S3, you obtain the following visualization.

CircleSurface_img2.jpg

void DrawCone multivector  P,
multivector  A,
scalar  Rad
 

Draws a cone.

Parameters:
P Origin of cone.
A Direction and length of cone.
Rad Radius of cone at the opening.
Returns:
Nothing
Since:
v1.4
Draws a cone whose origin is in P. The cone opens in the direction of A and has the length of A. The radius at the opening of the cone is given by Rad.

vertexlist DrawCylinder multivector  P,
multivector  D,
scalar  Radius,
counter  DoDraw
 

Draws an open cylinder.

Parameters:
P A multivector that specifies the center of the cylinder bottom.
D A multivector that specifies direction and length.
Radius A scalar defining the radius.
DoDraw (optional) A boolean flag indicating whether the cylinder is to be drawn directly (= 1, default), or not.
Slices (optional) An integer value in the range of 3 to 360, which gives the number of slices in which a cylinder is separated. The default is 72.
Returns:
A vertex list representing the surface of the cylinder.
Since:
v2.0
Setting the number of slices to a lower value can be useful if the cylinders drawn appear rather small in the visualization. Less slices will then not change the visual quality, while speeding up the visualization considerably. Here's an example,

    _BGColor = White;
    d = 1.1;
    D = VecN3(0,0.5,0);
    DrawCylinder( VecN3( -2*d,0,0 ), D, 1 ):Blue;
    DrawCylinder( VecN3( 0,0,0 ), D, 1 ):Black;
    DrawCylinder( VecN3( 2*d,0,0 ), D, 1 ):Red;
    DrawCylinder( VecN3( -d,0,-d ), D, 1 ):Yellow;
    DrawCylinder( VecN3( d,0,-d ), D, 1 ):Green;

that produces a kind of olympic 'cylinders'.

DrawCylinder_img1.jpg

void DrawDisk multivector  P,
multivector  A,
multivector  B,
scalar  Rad,
counter  Short
 

Draws a partial disk.

Parameters:
P Vector giving origin of disk.
A Vector giving start point of disk.
B Vector giving end point of disk.
Rad Radius of disk.
Short (optional) Boolean flag. If set to 1 it indicates that the disk withn the arc along the shortest path from A to B is to be drawn (default). Otherwise, the disk is drawn along the longer path.
Returns:
Nothing
Since:
v2.0
This function works just like DrawArc(). However, instead of just drawing an arc, it draws a partial disk whose outer border is the arc.

void DrawEllipse multivector  P,
multivector  A,
multivector  B
 

Draws an ellipse.

Parameters:
P Vector giving origin of ellipse.
A Vector giving first axis of ellipse.
B Vector giving second axis of ellipse.
Returns:
Nothing
Since:
v1.5

void DrawEllipsoid multivector  P,
multivector  A,
multivector  B,
multivector  C
 

Draws an ellipsoid.

Parameters:
P Vector giving origin of ellipse.
A Vector giving first axis of ellipsoid.
B Vector giving second axis of ellipsoid.
C Vector giving third axis of ellipsoid.
Returns:
Nothing
Since:
v2.0

void DrawIcosahedron multivector  vC,
scalar  dRadius,
counter  iPower,
counter  bSolid
 

Draws an icosahedron.

Parameters:
vC Center of Icosahedron.
dRadius The radius of the icosahedron.
iPower The power of the icosahedron. Has to be >= 0 and <= 6.
bSolid If bSolid is not zero, then the icosahedron is drawn as a solid object, and as wireframe otherwise.
Returns:
Nothing.
Since:
v.2.2
This function draws an icosahedron. Note that spheres in CLUCalc are also drawn as icosahedrons. However, when you draw a sphere a pre-calculated icosahedron of a fixed power is used. Here is an example of drawing a wireframe icosahedron.

    DrawIcosahedron(VecE3(0,0,0), 1, 3, false);

Output:

Icosahedron1.png

void DrawLine scalar  ax,
scalar  ay,
scalar  az,
scalar  bx,
scalar  by,
scalar  bz
 

Draws a line.

Parameters:
ax x-coordinate of start point of line.
ay y-coordinate of start point of line.
az z-coordinate of start point of line.
bx x-coordinate of end point of line.
by y-coordinate of end point of line.
bz z-coordinate of end point of line.
Returns:
Nothing
Since:
v1.4
Draws a line from (ax, ay, az) to (bx, by, bz).

void DrawLine multivector  A,
multivector  B
 

Draws a line.

Parameters:
A Multivector giving start point of line.
B Multivector giving end point of line.
Returns:
Nothing
Since:
v1.4
Draws a line from position of A to position of B.

vertexlist DrawLineSurface list  LMV,
list  LCol,
counter  DoDraw
 

Draws the surface spanned by a set of lines.

Parameters:
LMV A list of multivectors in conformal space representing lines.
LCol A list with one color for each line.
DoDraw (optional) A boolean flag indicating whether the surface is to be drawn directly (= 1, default), or not.
Returns:
A vertex list representing the surface spanned by the lines.
Since:
v2.0
This function only works with multivectors that represent lines in conformal space. Its usage is the same as for the function DrawCircleSurface. The code

    DefVarsN3();
    :IPNS;
    _FrameBoxSize = 0;

    // Define a line and a transformation (mvT)
    mvLine = e^VecN3( 1,0,0) ^ VecN3( 2,0,0 );
    mvT = TranslatorN3( 0,0,0.2) * RotorN3( 0,0,1, 7*Pi/180 );

    lmvL = []; // declare empty lists for lines and colors
    lcolC = [];

    // create a set of lines
    dNum = 40;
    i = 0;
    loop{
        if ( i == dNum )
            break;
        i = i + 1;
    
        mvLine =  mvT * mvLine* ~mvT;
        lmvL << (mvLine * I);
        lcolC << Color( 1, pow(i/dNum,2), 0 );
    }
    
    DrawLineSurface( lmvL, lcolC );

generates for example the following output

LineSurface_img1.jpg

void DrawPlane scalar  cx,
scalar  cy,
scalar  cz,
scalar  ax,
scalar  ay,
scalar  az,
scalar  bx,
scalar  by,
scalar  bz,
scalar  Rad
 

Draws a plane.

Parameters:
cx x-coordinate of plane center.
cy y-coordinate of plane center.
cz z-coordinate of plane center.
ax x-coordinate of first base vector of plane.
ay y-coordinate of first base vector of plane.
az z-coordinate of first base vector of plane.
bx x-coordinate of second base vector of plane.
by y-coordinate of second base vector of plane.
bz z-coordinate of second base vector of plane.
Rad (optional) Radius of disk. If this is zero or not given plane is drawn as a rectangle.
Returns:
Nothing
Since:
v1.4
Draws a plane centered on (cx, cy, cz) with basis vectors (ax, ay, az) and (bx, by, bz). The side length of the rectangle drawn is just the magnitude of the respective basis vectors. If Rad is not zero, then a disk with radius Rad is drawn instead.

void DrawPlane multivector  C,
multivector  A,
multivector  B,
scalar  Rad
 

Draws a plane.

Parameters:
C Multivector giving center of plane.
A Multivector giving first basis vector of plane.
B Multivector giving second basis vector of plane.
Rad (optional) Radius of disk. If this is zero or not given plane is drawn as a rectangle.
Returns:
Nothing
Since:
v1.4
Draws a plane centered on C with basis vectors A and B. The side length of the rectangle drawn is just the magnitude of the respective basis vectors. If Rad is not zero, then a disk with radius Rad is drawn instead.

void DrawPoint scalar  x,
scalar  y,
scalar  z
 

Draws a point.

Parameters:
x x-coordinate
y y-coordinate
z z-coordinate
Returns:
Nothing
Since:
v1.4

void DrawPoint multivector  A  ) 
 

Draws a point.

Parameters:
A Multivector that represents a point Euclidean space.
Returns:
Nothing
Since:
v1.4
If the multivector passed is a vector in projective space, say, then this vector is projected into Euclidean space and then displayed.

vertexlist DrawPointGrid counter  CountX,
counter  CountY,
list  LMV,
list  LCol,
counter  DoDraw,
counter  NegNormals,
list  LNorm
 

Draws a surface grid over a 2-dimensional set of points.

Parameters:
CountX Number of points along x-direction.
CountY Number of points along y-direction.
LMV A list of multivectors containing the surface points.
LCol (optional) A list of colors with one entry for each surface point. By default all surface points take on the currently active color.
DoDraw (optional) A boolean flag. If this is one (default), the surface grid is drawn directly, otherwise it is not drawn. The latter case may be useful if you want to draw the vertex list returned at a later stage.
NegNormals (optional) A boolean flag. If this is one, the surface normals are negated. Otherwise (the default) they are not.
LNorm (optional) A list of multivectors containing one surface normal for each point. If this list is not given, the surface normals are evaluated automatically. Note that the algorithm used for this automatic generation of surface normals is probably not the best one currently.
Returns:
A vertex list representing the surface grid to be drawn.
Since:
v1.4
Attention:
The syntax of this function is preliminary and may change slightly in a future version.
With this function you can draw arbitrary vector valued, 2-dimensional functions. One important feature of this function is, that it returns a vertex list of the surface gird to be drawn. You can draw the vertex list by simply applying the colon operator (:) to it. This is much quicker than calling the DrawPointGrid function each time you want to draw the surface grid.

In order to get a surface grid drawn, you first need to generate a list of surface points. They have to be ordered row-wise. That is, the list of points contains first all points of the first row, then the points of the second row, etc. See function DrawPointSurface() for an example.

vertexlist DrawPointList list  LMV,
list  LCol,
counter  DoDraw,
counter  NegNormals,
list  LNorm
 

Draws a line through a set of points.

Parameters:
LMV A list of multivectors containing the points.
LCol (optional) A list of colors with one entry for each point. By default all points take on the currently active color.
DoDraw (optional) A boolean flag. If this is one (default), the line is drawn directly, otherwise it is not drawn. The latter case may be useful if you want to draw the vertex list returned at a later stage.
NegNormals (optional) A boolean flag. If this is one, the normals are negated. Otherwise (the default) they are not.
LNorm (optional) A list of multivectors containing one normal for each point. If this list is not given, the normals are evaluated automatically. To think of normals in a one dimensional function may seem strange. However, somehow the reflectance needs to be evaluated, so normals have to be given in some form. By default normals are evaluated that are perpendicular to the plane the line is drawn in.
Returns:
A vertex list representing the line function to be drawn.
Since:
v1.4
Attention:
The syntax of this function is preliminary and may change slightly in a future version.
With this function you can draw arbitrary vector valued, 1-dimensional functions. One important feature of this function is, that it returns a vertex list of the surface gird to be drawn. You can draw the vertex list by simply applying the colon operator (:) to it. This is much quicker than calling the DrawPointList function each time you want to draw the function.

This function can be used to replace the Plot() function. However, you will have to write the loop that generate the points yourself. See function DrawPointSurface() for an example of how to generate such a list.

vertexlist DrawPointSurface counter  CountX,
counter  CountY,
list  LMV,
list  LCol,
counter  DoDraw,
counter  NegNormals,
list  LNorm
 

Draws a surface over a 2-dimensional set of points.

Parameters:
CountX Number of points along x-direction.
CountY Number of points along y-direction.
LMV A list of multivectors containing the surface points.
LCol (optional) A list of colors with one entry for each surface point. By default all surface points take on the currently active color.
DoDraw (optional) A boolean flag. If this is one (default), the surface is drawn directly, otherwise it is not drawn. The latter case may be useful if you want to draw the vertex list returned at a later stage.
NegNormals (optional) A boolean flag. If this is one, the surface normals are negated. Otherwise (the default) they are not.
LNorm (optional) A list of multivectors containing one surface normal for each point. If this list is not given, the surface normals are evaluated automatically. Note that the algorithm used for this automatic generation of surface normals is probably not the best one currently.
Returns:
A vertex list representing the surface to be drawn.
Since:
v1.4
Attention:
The syntax of this function is preliminary and may change slightly in a future version.
With this function you can draw arbitrary vector valued, 2-dimensional functions. One important feature of this function is, that it returns a vertex list of the surface to be drawn. You can draw the vertex list by simply applying the colon operator (:) to it. This is much quicker than calling the DrawPointSurface function each time you want to draw the surface.

In order to get a surface drawn you first need to generate a list of surface points. They have to be ordered row-wise. That is, the list of points contains first all points of the first row, then the points of the second row, etc. Here is a simple example to draw the function $x\,y$ .

// Switch off the frame box
_FrameBoxSize = 0;

// Define the standard basis vector variables
// for Euclidean space.
DefVarsE3();

// The step width in x and y direction
StepX = 0.1;
StepY = 0.1;

// The Plot range
MinX = -1;
MaxX = 1;
MinY = -1;
MaxY = 1;

// Count the rows that we draw.
RowCount = 0;

// Reset lists
LP = [];
LC = [];
LC2 = [];

// Set y to initial value
y = MinY;
// and start a loop over y
loop
{
    // Check whether y is out of range
    if (y > MaxY)
        break; // if yes, then end loop over y
    
    // Set x to its initial value
    x = MinX;
    // and start a loop over x
    loop
    {
        // check whether x is out of range
        if (x > MaxX)
            break; // if yes, then end loop over x

        // Evaluate point a current x,y-position
        A = x*e1 + y*e3 + sin(3*x)*cos(2*y)*e2;

        // Evaluate color at current position
        c = exp(-x*x*y*y/0.1);
        Col = Color(c, 0, 1 - c);
    
        // Evaluate color for surface grid
        c = 0.9 * c;
        Col2 = Color(c, 0, 1-c);

        // Add point to list
        LP << A;
        // Add color to list
        LC << Col;
        // Add color to list
        LC2 << Col2;
        
        // Increase x-position by StepX
        x = x + StepX;
    }

    // Increase y-position by StepY
    y = y + StepY;

    // Count the rows
    RowCount = RowCount + 1;
}

// Evaluate the columns
ColCount = Len(LP) / RowCount;

// Draw Surface
DrawPointSurface(ColCount, RowCount, LP, LC);

// Draw Grid
DrawPointGrid(ColCount, RowCount, LP, LC2);

This generates the following image.

PointSurface1_img1.jpg

void DrawSphere multivector  P,
scalar  Rad
 

Draws a sphere.

Parameters:
P Vector giving origin of sphere.
Rad Radius of sphere.
Returns:
Nothing
Since:
v1.5

void DrawText multivector  A,
string  Text
 

Draws a simple text.

Parameters:
A The position where to draw the text.
Text The text to draw.
Returns:
Nothing
Since:
v2.1
Draws the given text at the given position in the currently active color and size. The font size can be set with SetTextSize(). Here is an example,

    :A = VecE3(1,2,1);
    :Red;
    SetTextSize(2);
    DrawText(A, A);

This code produces the following output.

DrawTextEx1.jpg

void DrawTriangle multivector  A,
multivector  B,
multivector  C
 

Draws a triangle.

Parameters:
A Multivector giving first point of triangle.
B Multivector giving second point of triangle.
C Multivector giving third point of triangle.
Returns:
Nothing
Since:
v1.4
Draws a triangle through the given points.

void DrawTriangle scalar  ax,
scalar  ay,
scalar  az,
scalar  bx,
scalar  by,
scalar  bz,
scalar  cx,
scalar  cy,
scalar  cz
 

Draws a triangle.

Parameters:
ax x-coordinate of first point of triangle.
ay y-coordinate of first point of triangle.
az z-coordinate of first point of triangle.
bx x-coordinate of second point of triangle.
by y-coordinate of second point of triangle.
bz z-coordinate of second point of triangle.
cx x-coordinate of third point of triangle.
cy y-coordinate of third point of triangle.
cz z-coordinate of third point of triangle.
Returns:
Nothing
Since:
v1.4
Draws a triangle whose corners are given by the specified points.

void EnableAbsTexCoords counter  bVal  ) 
 

Enables or disables the use of absolute texture coordinates.

Parameters:
bVal If bVal is not zero, then absolute texture coordinates are enabled and otherwise disabled.
Returns:
Nothing.
Since:
v2.2
See Texture Mapping for a detailed description.

void EnableFog counter  bEnable  ) 
 

Enables or disables fog.

Parameters:
bEnable If not zero then fog is enables, otherwise disabled.
Returns:
Nothing.
Since:
v2.2
This is a direct mapping of the OpenGL fog support. Enabling fog blends objects more and more into a fog color as they are further away from the camera.

void EnableSmoothLine counter  IsSmooth  ) 
 

Enables anti-aliasing for lines.

Parameters:
IsSmooth A boolean flag that either enables (1) or disables (0) anti-aliasing for lines. By default anti-aliasing is switched off.
Returns:
Nothing
Since:
v1.4
This only affects lines.

void EnableSmoothPoint counter  IsSmooth  ) 
 

Enables anti-aliasing for points.

Parameters:
IsSmooth A boolean flag that either enables (1) or disables (0) anti-aliasing for points. By default anti-aliasing is switched off.
Returns:
Nothing
Since:
v1.4
This only affects points.

void EndOverlay void   ) 
 

Ends an overlay block.

Returns:
Nothing
Since:
v1.4
Each call to StartOverlay() needs to have one call to EndOverlay(). See StartOverlay() for an example.

void EndView  ) 
 

Exit the actual view.

Returns:
Nothing
Since:
v2.0
This command quits an environment that had been begun by the function StartView.

counter GetLineWidth  ) 
 

Returns the width of lines.

Returns:
The width with which lines are drawn.
Since:
v2.2
See also SetLineWidth().

counter GetPointSize  ) 
 

Returns the size of points.

Returns:
The size with which points are drawn.
Since:
v2.2
See also SetPointSize().

void Offset multivector  A,
multivector  X,
scalar  scale
 

This function draw multivector A at the offset given by multivector X and scaled to scale. Use this function, for example, to draw plane or lines at particular positions.

Parameters:
A The multivector to be drawn.
X The offset by which the visualization of A is to be moved.
scale The scale with which the visualization is to be scaled.
Returns:
Nothing
Since:
v1.4
See section Visualizing Multivectors for more details.

vertexlist Plot list  A,
list  L1,
list  L2,
scalar  S
 

Draw a point-valued 2D-function, i.e. a surface, with associated colors and normals.

Parameters:
A A list containing a point-valued function and optionally also a color function and a normal function.
L1 A list containing the first free variable and its range.
L2 A list containing the second free variable and its range.
S (optional) Length of normals.
Returns:
This function returns a vertex list containing the evaluated points of the function.
Since:
v2.1
The list A may contain one to four elements. Let us call the first element F, the second element C, the third element N and the fourth element T. F is a point valued function, C is a color function, N a normal function and T a texture coordinate function. Note that the second and third parameters can also be exchanged.

F has to be a point-valued function. The resultant (multi-)vectors may be from any space but must have a point representation in Euclidean space.

C has to be a color-valued function. It gives the color at each point of the surface.

N also has to be point-valued. However, here the point is interpreted as the direction of a normal. These directions need not be normalized, since this is done internally. If no normal function is given, the surface normals are evaluated from the function itself. The normals are used for correct lighting of the surface, as well as drawing the normals if parameter S is given.

T also has to be a point valued function, whereby currently only the first two components of the vectors are used. See Texture Mapping for more details on texture coordinates. The texture coordinate function always has to be the fourth element in the list A. Otherwise it could not be distinguished from the normal function. If you do not to want to specify a normal or color function but you do want to specify a texture function, the color and normal function have to be represented by 0 in the list A. For an example see section Arbitrary Surfaces of Texture Mapping.

The lists L1 and L2 must contain their respective free variable, minimum value, maximum value and number of partitions into which the given range is split.

If the parameter S is given, it sets the length of normals drawn on top of the surface. Negative values are also allowed, in which case the normals are drawn on the back of the surface. If this parameter is not given or set to zero, no normals are drawn.

See section Plotting Vector Functions for more details.

For example,

        
    :Plot([VecE3(y, x*x*y*y, x),                        // Function
            Color(x*x, y*y, 1-x*x*y*y),                 // Color
            *(VecE3(0,2*x*y*y, 1)^VecE3(1, 2*x*x*y, 0)) // Normal
           ],
           [x, -1, 1, 20], 
           [y, -1, 1, 20], 
           0.1);

produces the visualization

PlotEx3.jpg

vertexlist Plot list  A,
list  L
 

Draw a point-, circle- or line-valued 1D-function with varying colors.

Parameters:
A A list containing as first element a vector valued function and as second element a color-valued function.
L A list containing free the variable and the plot range.
Returns:
This function returns a vertex list containing the evaluated points of the function.
Since:
v2.1
A has to consist of two elements, a first element F and a second element C. F has to be a point-, circle- or line-valued function. The resultant (multi-)vectors may be from any space but must have a representation in Euclidean space. If F is point-valued, Plot() draws a curve in space. If it is circle-valued (e.g. 3-blades in conformal space), then surface spanned by the circles is drawn (see 'CanalSurf1.clu' for an example). Similarly, if F is line-valued (e.g. 2-blades in projective space or 3-blades in conformal space), then the surface spanned by the lines is shown.

The second element C has to be a color valued function. It gives the color for each parameter value.

The list L must contain the free variable, the minimum value, the maximum value and the number of partitions into which the given range is split. If the number of partitions is n then Plot() evaluates the functions F and C, n+1 times. See section Plotting Vector Functions for more details.

For example,

        
    _2dView = 1;

    :Plot([VecE3(x, x*x, 0), Color(x*x, 0, 1-x*x)],
            [x, -1, 1, 20]);

produces the visualization

PlotEx1.jpg

vertexlist Plot multivector  F,
list  L1,
list  L2,
scalar  S
 

Draw a point-valued 2D-function, i.e. a surface.

Parameters:
F A point-valued function.
L1 A list containing the first free variable and its range.
L2 A list containing the second free variable and its range.
S (optional) Length of normals.
Returns:
This function returns a vertex list containing the evaluated points of the function.
Since:
v2.1
F has to be a point-valued function. The resultant (multi-)vectors may be from any space but must have a point representation in Euclidean space.

The lists L1 and L2 must contain their respective free variable, minimum value, maximum value and number of partitions into which the given range is split.

If the parameter S is given, it sets the length of normals drawn on top of the surface. Negative values are also allowed, in which case the normals are drawn on the back of the surface. If this parameter is not given or set to zero, no normals are drawn.

See section Plotting Vector Functions for more details.

For example,

        
    :Plot(VecE3(y, x*x*y*y, x),
            [x, -1, 1, 20], 
            [y, -1, 1, 20], 0.1);

produces the visualization

PlotEx2.jpg

vertexlist Plot multivector  F,
list  L
 

Draw a point-, circle- or line-valued 1D-function.

Parameters:
F A vector valued function.
L A list containing free the variable and the plot range.
Returns:
This function returns a vertex list containing the evaluated points of the function.
Since:
v1.0
F has to be a point-, circle- or line-valued function. The resultant (multi-)vectors may be from any space but must have a representation in Euclidean space. If F is point-valued, Plot() draws a curve in space. If it is circle-valued (e.g. 3-blades in conformal space), then surface spanned by the circles is drawn (see 'CanalSurf1.clu' for an example). Similarly, if F is line-valued (e.g. 2-blades in projective space or 3-blades in conformal space), then the surface spanned by the lines is shown. The circle and line surface functionality is available since version 2.1.

The list L must contain the free variable, the minimum value, the maximum value and the number of partitions into which the given range is split. If the number of partitions is n then Plot evaluates the function F n+1 times. See section Plotting Vector Functions for more details.

For example,

        
    DefVarsE3();
    
    SQ = Plot(x*e1 + x*x*e2, [x, 0, 1, 4]);
    ?SQ;
    :SQ :Red;

produces the output

    
    SQ = ((0, 0, 0), (0.25, 0.0625, 0), (0.5, 0.25, 0), 
          (0.75, 0.5625, 0), (1, 1, 0))

void PopFrame void   ) 
 

Restore saved projection matrix from the stack.

Returns:
Nothing
Since:
v2.0
This function calls the openGL command glPopMatrix. All parameters corresponding to the frame will be restored. In case of extensive drawing operations it is often more convenient to change the frame and perform the drawings relative to the new origin instead of adjusting all parameters in all drawing functions. Here's an example,
    
    PushFrame();  // save frame
    TranslateFrame(-2,0,0);
    DrawCone( VecE3( 0,0,0), VecE3( 0,1,0), 1 ); // Draw cone at current (translated) origin.
    // more draw operations ....
    PopFrame();   // restore frame
    :e0:Red; // Visualize origin.
The code will produce the subsequent image.

Frame_img1.jpg

void PushFrame void   ) 
 

Save current projection matrix to a stack.

Returns:
Nothing
Since:
v2.0
This function calls the openGL command glPushMatrix. The matrix that contains the actual settings concerning the frame will be pushed to the stack. To restore the matrix and thus the frame use PopFrame.

void RotateFrame multivector  R  ) 
 

Rotates the drawing frame.

Parameters:
R An euclidian rotor giving the rotation of the frame.
Returns:
Nothing
Since:
v1.4
All drawing operations after a call to this functions are drawn rotated by the given rotor. While the function SetFrameRotor() sets the global frame orientation and should only be called once within a script, this function may be called any number of times and only rotated a local frame.

void RotateView multivector  R  ) 
 

Rotates the projectview matrix of OpenGl.

Parameters:
R An euclidian rotor giving the rotation of the modelview.
Returns:
Nothing
Since:
v2.0
In contrast to the function RotateFrame, the openGL camera coordinate system is rotatad, instead of rotating the object coordinate system. Note that only consecutive drawing commands will relate to the new view of the scene.

void SetArrowShape scalar  dLength,
scalar  dAngle
 

Sets the shape in which arrows are drawn.

Parameters:
dLength The length of the arrow tip.
dAngle The opening angle of the arrow tip in degrees.
Returns:
Nothing.
Since:
v2.2
The initial values are 0.15 for the length and 15 for the angle.

void SetFogColor color  colFog  ) 
 

Sets the color of fog.

Parameters:
colFog The fog color.
Returns:
Nothing.
Since:
v2.2
You need to enable fog with EnableFog() before this has any effect.

void SetFogDensity scalar  dDensity  ) 
 

Set the density of fog.

Parameters:
dDensity The density. Has to be > 0.
Returns:
Nothing.
Since:
v2.2
You need to enable fog with EnableFog() before this has any effect.

void SetFrameOrigin scalar  x,
scalar  y,
scalar  z
 

Sets the origin of the drawing frame.

Parameters:
x New x-coordinate of frame origin.
x New y-coordinate of frame origin.
x New z-coordinate of frame origin.
Returns:
Nothing
Since:
v1.4
This allows you to set the origin of the basis frame into which all entities are drawn.

void SetFrameRotor multivector  R  ) 
 

Sets the rotation of the drawing frame.

Parameters:
R A rotor giving the rotation of the frame.
Returns:
Nothing
Since:
v1.4
This allows you to set the orientation of the basis frame into which all entities are drawn.

void SetLineWidth scalar  Width  ) 
 

Sets the width of lines in pixel.

Parameters:
Width The width of lines in pixels.
Returns:
Nothing
Since:
v1.4
The line width set here affects all drawing operations that draw lines. This is, for example, also the case for circles and function plotting.

void SetMode counter  mode  ) 
 

Sets one or a number of drawing modes.

Parameters:
mode The drawing mode.
Returns:
Nothing
Since:
v1.0
The modes that are set with this function, influence the visualization of of multivectors. See the predefined variable reference for the set of values that can be used with this function.

void SetPlotMode counter  mode  ) 
 

Sets the plot mode for the function Plot().

Parameters:
mode The drawing mode.
Returns:
Nothing
Since:
v1.0
The modes that are set with this function, influence the way a function is plotted with the function Plot(). See the predefined variable reference for the set of values that can be used with this function.

void SetPointSize scalar  Size  ) 
 

Sets the size of points in pixel.

Parameters:
Size The size of points in pixel.
Returns:
Nothing
Since:
v1.4
The point size affects all drawing operations where points are plotted.

void SetTextSize counter  Size  ) 
 

Sets the size of text drawn with DrawText().

Parameters:
Size The size of the text.
Returns:
Nothing
Since:
v2.1
The size variable Size has to be a value between 1 and 7.

void SetTexture image  Img  ) 
 

Sets the texture for texture mapping, or disables texture mapping.

Parameters:
Img (optional) The image to be used for texture mapping.
Returns:
Nothing.
Since:
v2.2
See Texture Mapping for a detailed description.

void SetTextureRepeat scalar  dFac  ) 
 

Sets the texture repetition factor.

Parameters:
dFac The repetition factor.
Returns:
Nothing.
Since:
v2.2
See Texture Mapping for a detailed description.

void SetViewAngle scalar  a  ) 
 

Set the perspective angle which affects the modelview.

Parameters:
a A scalar specifying an aperture angle.
Returns:
Nothing
Since:
v2.0
This function defines the size of the aperture angle. The value of a must lie between 1 and 179. The default is 70. It can also be regarded as changing the focal length of the (virtual) viewing camera that is used by openGL.

void SetVisWinSize counter  iWidth,
counter  iHeight
 

Set the size of the visualization window.

Parameters:
iWidth The new width.
iHeight The new height.
Returns:
Nothing.
Since:
v2.2
This function sets the width and height of the OpenGL visualization window. This allows you to do screen shots of the visualization of a specific size.

void StartOverlay void   ) 
 

Starts an overlay block.

Returns:
Nothing
Since:
v1.4
This function defines a temporary orthographic projection matrix and a new coordinate system. You can return to the standard coordinate system with the function EndOverlay(). The new coordinate system has its origin at the top left of the visualization window. The coordinate at the bottom right is (100, 100). That is, these coordinates can be interpreted as percent of the visualization window. The idea of such an overlay coordinate system is, that it is not changed when the user rotates or translates the standard coordinate system with the mouse. Hence, elements drawn in the overlay appear as if they overlay the standard visualization. This forms the basis for presentations with CLUScript.

Note that the orthographic projection is along the z-axis. This means, that even though an element at different z-depths appears the same, the z-coordinate allows you to define a z-order in which elements are drawn.

Here is an example.

    
    StartOverlay();

    :Red;
    DrawLine(0,0,0, 50,50,0);

    :Green;
    DrawLine(100,0,0, 50,50,0);

    :Blue;
    DrawLine(50,50,0, 50,100,0);

    EndOverlay();

This produces the following visualization.

OverlayTest1_img1.jpg

This shows that independent of how the standard visualization basis frame is rotated, the lines in the overlay block are drawn in the same way.

void StartView scalar  x,
scalar  y,
scalar  w,
scalar  h
 

Start a new view.

Parameters:
x A scalar defining the x-coordinate of the bottom left corner.
y A scalar defining the y-coordinate of the bottom left corner.
w A scalar defining the width of the view.
h A scalar defining the height of the view.
Returns:
Nothing
Since:
v2.0
The two points defined by the four parameters specify a rectangular region within the visualization window. If the values for width and height are in the range [0,1], then they are regarded as percentage values with respect to the size of the whole visualization window. If they are larger than 1, they are regarded as pixel values. The newly created view will then be projected into the defined region. Note that the standard user interaction (mouse mode 0) is restricted to the normal view. But it is possible to adopt the mouse interaction by using other mouse modes. This function starts an environment that has to be ended by the function EndView(). Observe that the former view doesn't have any influence on the new view. Here is the example script ExampleScripts/StartView1.clu.

    // Start a view with its bottom-left corner
    // at the bottom-left corner of the visualization
    // window, and having half its width and height.
    StartView(0,0, 0.5, 0.5);

    // Start an overlay
    StartOverlay();

    // Draw a rectangle along the 
    // outer border of the view.
    SetLineWidth(4);
    :Red;
    DrawLine(VecE3(0,0), VecE3(100,0));
    DrawLine(VecE3(100,0), VecE3(100,100));
    DrawLine(VecE3(100,100), VecE3(0,100));
    DrawLine(VecE3(0,100), VecE3(0,0));
    SetLineWidth(2);

    // End the overlay
    EndOverlay();

    // Now draw a sphere in the view
    :Blue;
    DrawSphere(VecE3(0,0,0), 1);

    // End the view
    EndView();

    // Draw the same sphere in the main view
    :Green;
    DrawSphere(VecE3(0,0,0), 1);    

Output:

StartView1_1.png

void TranslateFrame multivector  T  ) 
 

Translates the drawing frame.

Parameters:
T A multivector representing a vector.
Returns:
Nothing
Since:
v2.0
All drawing operations after a call to this functions are drawn translated by the given amount. While the function SetFrameOrigin() sets the global frame origin and should only be called once within a script, this function may be called any number of times and only translates a local frame.

void TranslateFrame scalar  x,
scalar  y,
scalar  z
 

Translates the drawing frame.

Parameters:
x The translation in x-direction.
y The translation in y-direction.
z The translation in z-direction.
Returns:
Nothing
Since:
v1.4
All drawing operations after a call to this functions are drawn translated by the given amount. While the function SetFrameOrigin() sets the global frame origin and should only be called once within a script, this function may be called any number of times and only translates a local frame.

void TranslateView multivector  T  ) 
 

Translate the projectview matrix of OpenGl.

Parameters:
T A multivector representing a vector.
Returns:
Nothing
Since:
v2.0
Instead of translating the object coordinate system, the camera is moved. Note that only consecutive drawing commands will relate to the new view of the scene.

void TranslateView scalar  x,
scalar  y,
scalar  z
 

Translate the projectview matrix of OpenGl.

Parameters:
x The translation in x-direction.
y The translation in y-direction.
z The translation in z-direction.
Returns:
Nothing
Since:
v2.0
Instead of translating the object coordinate system, the camera is moved. Note that only consecutive drawing commands will relate to the new view of the scene.