### Pseudo

- anim
- flip
- field
  - How to use Field Object
  - How to write a Field object
- Deformation Graph
  - Creating a deformation graph

These[?] object types are not true objects, because generaly you cannot render it, but they are used to model other object or for special purpose.

#### anim

Animation object. It can animate an object by translating it. You can create a anim object using a curve (translation path) and an object which you can render.

#### flip (OBSOLETE!)

Try to render inside a shere or a box. You should see a darker image that you render outside the same object. Thi is the standard behaviour, but if you want you can invert the "inside" of an object with the "outside". You must create a flip object, which inverts all the surface normals of an object. You may use on any object that you can render.

1) Execute command "Edit|Object|Create"

2) Choose "flip"

3) Choose the object that you want to flip.

You cannot modify a flipped object.

#### field

##### How to use Field Object

Field object are used to deform brep objects. You should not try to render it. Field objects are completely programmable, you can write you own field.

A field is a vector field. It exists only inside a volume. In the editor you will se a solid object ( like a box ) and inside two curves, each of a different color. One is the curve before to apply the field on it, the other the same curve after to apply it.

You can move a field object like any other object, you can translate, rotate, scale it. To apply it, select a brep object ( click on it with left button of the mouse ) the press `f' key. You must choose which field object apply ( you may have more that one in your layer).

Field will be applied only to control points that are inside the field volume, so you can change only a portion of an object.

It is better that you use brep object with inline models.

In directory "Library\field" you can find some predefinite fields:

hammer

lhammer

bend

taper

Every field can be customized with same specific parameters ( different from field to field ), which modify its behaviour. You can change them with Edit|Object|Modify command.

If you want to modify a field variable, choose it in the listbox, then click the "update" button to see the value of the variable and the range (from,to). To change a variable value use "change" button.

##### 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

##### Creating a deformation graph

A deformation graph is used for a general sweep operation, to deform the shape of the sweep.

You can work only in the Top view and only in the range 0 <= x <= 1. Draw a curve in the range like in the picture.

This curve start from point (0,1) to point (1,0). You can see it like a function f(x). The 1-value means an unmodified shape, greater than 1 a bigger shape and smaller than 1 a reduced shape. When the program creates the sweep , it divides the interval from 0 to 1 in as many parts as the times it uses the shape.

To create a deformation graph from this curve use command Edit|Object|Create and choose deformgraph.

A deformation graph can be in any layer, when you create a general sweep you can select it also if in a different layer.