### Pseudo

- anim
- flip
- field
  - How to write a Field object
- Deformation Graph

#### anim

#### flip

#### field

##### How to write a Field object

You can write your own field. You must write your own .rt file using a text editor.

Look at this example ( equal to "library\field\lhammer.rt" ) :

{ material

name _field1;

model { phong

Ks 0.2;

Kt 0;

ni 1;

Ka 0.2;

Kd 0.6;

n 10;

Od (0,0,1);

Os (0.5,0.5,0.5);

}

}

{ material

name _field2;

model { phong

Ks 0.2;

Kt 0;

ni 1;

Ka 0.2;

Kd 0.6;

n 10;

Od (1,0,0);

Os (0.5,0.5,0.5);

}

}

{ object

name lhammer;

model { field

{ object

name obj000001;

material standard;

model { box

xmin -2;

xmax 2;

ymin -1;

ymax 1;

zmin -1;

zmax 1;

}

}

decoration { object

name decoration;

material _field1;

model { polyline

open 1;

p ( 0 , 0 , -0.45 );

p ( 0 , 0 , -0.4 );

p ( 0 , 0 , -0.35 );

p ( 0 , 0 , -0.3 );

p ( 0 , 0 , -0.25 );

p ( 0 , 0 , -0.2 );

p ( 0 , 0 , -0.15 );

p ( 0 , 0 , -0.1 );

p ( 0 , 0 , -0.05 );

p ( 0 , 0 , 0 );

p ( 0 , 0 , 0.05 );

p ( 0 , 0 , 0.1 );

p ( 0 , 0 , 0.15 );

p ( 0 , 0 , 0.2 );

p ( 0 , 0 , 0.25 );

p ( 0 , 0 , 0.3 );

p ( 0 , 0 , 0.35 );

p ( 0 , 0 , 0.4 );

p ( 0 , 0 , 0.45 );

}

}

dfmat _field2;

param {

strenght value 1 from 0 to 5;

}

mat {

strenght "1;";

rx "strenght - abs(z) ;";

ry "0;";

rz "0;";

}

}

}

.

The definition of the two material are outside the field object declaration, but them are used to define the color of the two curve which describe the field behavior.

The first object is the volume field. It can be any raytracing object, but it must be closed ( like a box, a sphere or a cylinder ).

The decoration must be a curve, it is the curve before apply the field.

dfmat is the material for the transformated curve.

param section list all the variables that you can modify from editor ( using Edit|Object|Modify ). A variable in param section can be any identifier different from "x","y","z","rx","ry","rz". The definition follow the form :

variable value defvalue from minvalue to maxvalue;

where variable is the variable name, defvalue if the default value, minvalue and maxvalue the mininum and maximum value for the variable. You must also define the variable in the next mat section at the default value.

mat section describes the field in all the space. You must write a list of variable definitions, using mathematic expressions. Some variables are special :

x,y,z are predefefinite variables. They are a point in the space in the form P(x,y,z).

rx,ry,rz are the return variables. You must always define them. They are the three components of the field vector at point P(x,y,z).

In mat section you may use x,y,z and any variable defined in mat section before the first use. You can define new variables following this expression:

var "vardef;";

var is the name of the new variable ( case sensitive ).

vardef is an expression.

In expression you can use `(` and `)' ( for precedence in evalutation) and the following functions:

+, - , * , /

abs

sqrt

exp,log

sin, cos, tan

asin,acos,atan

zero

zero is usefull if you must write expression like x/y. Sometimes y can be equal to 0 and you will get an error computing x/0. You can rewrite the expression like x/(y+zero(y)).

#### Deformation Graph