VARKON Version 1.18 2006-3-16

> ## csys_1p - Geometric procedure

> Creates a coordinate system
> Description
> Creates a local coordinate system using one position and three optional angles of rotation.
> Syntax
> csys_1p(id, name, p, rotx, roty, rotz:attributes);

> REF | id;
> STRING | name*10;
> VECTOR | p;
> FLOAT | rotx;
> FLOAT | roty;
> FLOAT | rotz;

> Principal parameters

> id | - Local identity
> name | - User defined name
> p | - Position of origin

> Optional parameters

> rotx | - Rotation around X-axis, default = 0
> roty | - Rotation around Y-axis, default = 0
> rotz | - Rotation around Z-axis, default = 0

> Attributes

> PEN | - Pen or colour number
> LEVEL | - Level number
> BLANK | - Visible(0) or invisible(1)

> Example-1

>     csys_1p(#1,"Origin",vec(0,0), , ,30);

> Creates a coordinate system rotated 30 degrees around the active Z-axis.
> Example-2

>     BASIC GEOMETRY MODULE coor_sys();
>     BEGINMODULE
>      csys_1p(#1,"BASIC", vec(0, 0, 0), 0.0, 0.0, 0.0);
>      csys_1p(#2,"ROTATED", vec(1, 0, 0), 0.0, 0.0, 0.0);
>      mode_local(#2);
>     ENDMODULE

> This module creates two coordinate systems, the first as a Basic "Reference" coordinate system with Origin at point (0,0,0) without any rotation around the Axes , The second is a Local coordinate system with Origin at point (1,0,0), also without any rotation as in figure 1.
> To illustrate how the coordinate system works, we will use the second coordinate system with diferent orientations in following examples.
> Figure 1
> In figure 1 the two coordinate systems had the same orientation for all Axes.
> To rotate the second coordinate system 90 degrees around X-axis, use the module listed below. The result is shown in figure 2.

>     BASIC GEOMETRY MODULE coor_sys();

>     BEGINMODULE

>      csys_1p(#1,"BASIC", vec(0, 0, 0), 0.0, 0.0, 0.0);
>      csys_1p(#2,"ROTATED", vec(1, 0, 0), 90.0, 0.0, 0.0);
>      mode_local(#2);

>     ENDMODULE

> Figure 2
> To therafter rotate the local coordinate system 90 degrees around Y-axis, use the module listed below. The result is shown in figure 3.

>     BASIC GEOMETRY MODULE coor_sys();

>     BEGINMODULE

>       csys_1p(#1,"BASIC", vec(0, 0, 0), 0.0, 0.0, 0.0);
>       mode_local(#1);
>       csys_1p(#2,"ROTATED", vec(1, 0, 0), 90, 0, 0:BLANK=1);
>       mode_local(#2);
>       csys_1p(#3,"ROTATED", vec(0, 0, 0), 0, 90, 0:BLANK=0);
>       mode_local(#3);

>     ENDMODULE

> Figure 3
> Finally to rotate the local coordinate system also 90 degrees around Z-axis, use the module listed below .The result is shown in fingure 4.

>     BASIC GEOMETRY MODULE coor_sys();

>     BEGINMODULE

>       csys_1p(#1,"BASIC", vec(0, 0, 0), 0.0, 0.0, 0.0);
>       mode_local(#1);
>       csys_1p(#2,"ROTATED", vec(1, 0, 0), 90, 0, 0:BLANK=1);
>       mode_local(#2);
>       csys_1p(#3,"ROTATED", vec(0, 0, 0), 0, 90, 0:BLANK=1);
>       mode_local(#3);
>       csys_1p(#4,"ROTATED", vec(0, 0, 0), 0, 0, 90:BLANK=0);
>       mode_local(#4);

>     ENDMODULE

> Figure 4
> Comments
> In the last three active modules and figures specified rotation is done in three steps around local coordinate system , the first around the X-axis ,Then around Y-axis, the last around Z-axis.
> When all three angles are specified in one csys_1p-instruction, varkon calculates the rotaion in order X,Y,Z. To confirm this investigate the module listed below . The result is shown in figure 5.

>     BASIC GEOMETRY MODULE coor_sys();

>     BEGINMODULE

>       csys_1p(#1,"BASIC", vec(0, 0, 0), 0.0, 0.0, 0.0);
>       mode_local(#1);
>       csys_1p(#2,"ROTATED", vec(1, 0, 0), 90, 90, 90);
>       mode_local(#2);

>     ENDMODULE

> Figure 5

VARKON Homepage | Index