index

Varkon MBS Programmers manual

# csys_usrdef - Geometric procedure

## Description

Low level routine to create a user defined coordinate system by specifying 16 values orderd in a 4 by 4 matrix. The coordinate system created is based on (relative to) the currently active coordinate system.

The matrix supplied is inverted and multiplied with the matrix of the currently active coordinate system before it is stored in the database. This means that the matrix that is returned if you fetch the coordinate system from the database is not the same as the matrix you initially supplied. See the figure below.

Transformation matrices order from BASIC to LOCAL and vice versa

The coordinate system represented by 4x4 matrix like:

Xx | Xy | Xz | Ox
Yx | Yy | Yz | Oy
Zx | Zy | Zz | OZ
0 | 0 | 0 | 1

Where:

Xx, Yx, Zx | => | X-axis direction vector
Xy, Yy, Zy | => | Y-axis direction vector
Xz, Yz, Zz | => | Z-axis direction vector
Ox, Oy, Oz | => | Origin position

## Syntax

    csys_usrdef(id, name,tmat:attributes);

REF | id;
STRING | name*10;
FLOAT | tmat(4,4);

## Principal parameters

id | - Local identity
name | - User defined name
tmat | - 4 by 4 transformation matrix

## Optional parameters

None.

## Attributes

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

## Example

    tmat(1,1):=1.0; tmat(1,2):=0.0; tmat(1,3):=0.0; tmat(1,4):=0.0;
    tmat(2,1):=0.0; tmat(2,2):=1.0; tmat(2,3):=0.0; tmat(2,4):=0.0;
    tmat(3,1):=0.0; tmat(3,2):=0.0; tmat(3,3):=1.0; tmat(3,4):=0.0;
    tmat(4,1):=0.0; tmat(4,2):=0.0; tmat(4,3):=0.0; tmat(4,4):=1.0;

    csys_usrdef(#1,"Origin",tmat);

Creates a coordinate system equal to the basic coordinate system.

## Comments

Directions of axes are represented by the three direction vectors in the matrix, therefore they should be perpendicular to each other, otherwise an error message will be generated.

## See also

csys_1p() and csys_3p()

Varkon version 1.19C svn# 120