id() | S |
Identical motion. |
scale(k) | S |
Contraction to the point of origin with coefficient k. |
scale(kx,ky,kz) | A |
Contraction to the point of origin with coefficients kx,ky,kz along according axes. |
rotate(x,y,z,angle) | S |
Rotation by the angle around an axis passing through the point of origin and point (x,y,z). |
rotate(x,y,z,angle,along,across) | A |
The same rotation as the previous, but additionally with contraction
along the axis by coefficient along and in the plane orthogonal to the axis by coefficient across. |
rotate(angle) | S |
Rotation by the angle around an axis (0,0,1). |
translate(x,y,z) | S |
Translation by vector (x,y,z). |
translate(x,y) | S |
Translation by vector (x,y,0). |
reflect(x,y,z) | S |
Plane reflection with the plane passing through the point of origin an with normal vector (x,y,z). |
matrix(ax,ay,az,bx,by,bz,cx,cy,cz) | A |
Linear transformation by 3x3 matrix:
|
affine2d(ax,ay,bx,by,tx,ty) | A |
Composition of maps translate(tx,ty,0) matrix(ax,ay,0,bx,by,0,0,0,0).
It's useful to determinate 2-dimensional self-affine fractals. |
stretch(x,y,z,k) | M |
Mebius map transforming a ball with unit radius and with the center at the point of origin into the same ball
and also transferring the point of origin along vector (x,y,z) by the distance k. |
inverse(x,y,z,r) | M |
Inversion with respect to sphere with radius r and center (x,y,z).
This Mebius map changes orientation. |
bound(x,y,z,r) | M |
It's not a map, but operator to label the Set, tha it's bound by a ball with radius r
and center (x,y,z). All compositions of Mebius maps which act from this Set to itself must be
contractive on the specified ball. |
empty() | |
Map transforming every set into empty set. It's useful to determine random-generated fractals. |
Attribute | Default value | Description |
position(x,y,z) | required |
Point (x,y,z) defines camera (observer) location. |
direction(x,y,z) | can be selected automatically |
Vector (x,y,z) defines direction of the view. |
vertical(x,y,z) | required |
Vector (x,y,z) defines vertical direction. |
fov(angle) | 50 degree |
Number angle defines angle of the field of view in vertical plane. |
stereo(eyeDist, scrDist) | 'mono mode' |
This attribute turn on 'stereo mode' (two pictures for two eyes) with parameters:
eyeDist - distance between eyes,
scrDist - distance between viewer and the screen. |
The lighting of the scene is calculated by well known ray-tracing algorithm,
which requires light sorces and specular properties of surfaces (color, reflectivity, e.t.c.) to be defined.
Number of light sources in the scene cab be arbitrary, and they can be of any different types.
The following table explains the mining of attributes.
Attribute | Lamp | Floodlight | Sun | Description |
position (x,y,z) | R | R | N/A |
Point (x,y,z) defines light source location. |
direction (dx,dy,dz) | N/A | R | R |
Vector (x,y,z) defines direction, in which the light source shines. |
spot_angles (a1,a2) | N/A | R | N/A |
angles to define spot size for directional light source. |
attenuation (qa,la,ca) |
by default (1,0,0) | N/A |
Coefficient fo quadratic, linear and constant of source light brightness with re respect to destination. |
shadows (1 | 0) |
by default (1) |
1 - source light can be blocked up by objects, 0 - can't be blocked up. |
attachment (1 | 0) |
1 - source light is attached to object coordinate system, or 0 - to the camera coordinate system. |
diffuse (r,g,b,lum) |
One or more attribute of these shall be defined.
Default value is (0,0,0,0) |
Defines color/brightness of scattered light component of the light source. |
specular (r,g,b,lum) |
Defines color/brightness of reflecting component of the light source. |
color (r,g,b,lum) |
Defines color/brightness of the both scattered light and reflecting component of the light source. |
Note: N/A - attribute can't be specified, R - attribute is required.
3. Specular properties of surfaces.
Properties of a surface can be specified after build command.
Since the build keyword can be specified more then once,
it is possible to create objects with different colors and properties of surfaces in one scene.
Property | Note | Description |
ambient(r,g,b,lum) |
Arguments can be given in the form of (r,g,b) or (lum) |
Defines color/brightness of the ambient color component. |
diffuse(r,g,b,lum) |
Defines color/brightness of the diffuse color component. |
specular(r,g,b,lum) |
Defines color/brightness of the specular color component. |
color(r,g,b) |
for convinience |
Defines color of the ambient and diffuse components and assigns specular component to (1,1,1). |
metall(r,g,b) | |
Defines metallic surface: sets color of the diffuse and specular component. |
Substitutions
Substitutions are used to simplify Sets and Maps definition.
A substitution is analog of the #define directive in C/C++ languages and is
determined as:
<name> := <value> ;
Note: in the future we are going to get rid of such "unnatural" language construction,
so someday Sets and Maps can be assigned to common variables.
Arithmetical expressions
Arithmetical formulas utilize the same syntax as used in C++/Java/Perl/PHP languages.
Real-valued functions:
ln(x),exp(x),sqrt(x),abs(x),sign(x),sin(x),cos(x),atan(x)
atan2(y,x),arg(x,y) - these two functions returns arctg(y/x)
rnd(x) - random number in the [0,x] segment
real and logical operations:
= += -= *= /= + - * / , () ?: ++ -- == != < <= > >=
constants: PI and E.
Example: Koch Snowflake
camera position (0,0,-80) vertical(0,1,0) fov(50);
light color (0,1,0) position (1, 1,-3) shadows(0);
light color (1, 1, 0) position (3,-1,-1) shadows(0);
ambient(1,1,1,.05);
background(0,1,1,0.5);
s=sqrt(3);
f1 := translate(1/2, 1/2/s,0)*scale(1/s)*rotate(0,0,-1,150);
f2 := translate(1,0,0)*scale(1/s)*rotate(0,0,-1,-150);
f3 := translate(-1/2,s/2,0)*scale(s)*rotate(0,0,-1,30);
f4 := translate(-1/2,-s/2,0)*scale(s)*rotate(0,0,-1,-90);
f5 := translate(1,0,0)*scale(s)*rotate(0,0,-1,150);
set KochCurve = (f1+f2)KochCurve;
set Snowflake = (f3+f4+f5)KochCurve;
build Snowflake;
First, Koch Curve is defined, consisting of two own scaled down copies f1(KochCurve) and f2(KochCurve).
Then we define Koch Snowflake as set consisting of three images of the Koch Curve.
Random-generated fractals
When defining IFS (or Digraph-IFS), it's possible to set which maps shoul be selected randomly
from given finite set of maps. Here are the rules to define such random-generated IFS:
- The attractor and each its copy
(a set obtained by IFS maps from the attractor and from other copies),
has a corresponding pseudo-random number.
This number for attractor can be set by calling randState(arg) function
before a build operator, where real-valued arg belongs to the [0,1] segment.
For example: randState(rnd(1));
- The operator (...)%n (where n is an integer)
selects n maps from parenthesis, using pseudo-random number assigned
to the current copy of attractor.
- Operator (...)%n allows to assign to each map a weight (a real positive number),
by placing it into braces after the map.
Weights are used to calculate probabilities for the map selecting operator.
For each map its probability is calculated by dividing its weight
by the total maps weight in the current (...)%n operator.
If a weight was not specified for some map, then it's supposed to be a unity by default.
Example: (f1{2}+f2{3})%1
- If a copy of the atractor of IFS consist of some subcopies, then subcopies
inherit by default the pseuodo-random number from the copy.
But if f|m construction has ben found, then the random number of
the subcopy, obtained from current copy by the f map,
is changed by m-th way, i.e. it's changed by applying pseudo-random
generator which depends on the parameter m.
So, if two map have the same parameter m,
e.g. in (f1|1+f2|1) construction, then copies obtained by applying
f1,f2 maps, will obtain the same pseudo-random number,
and so will be divided by (...)%n operator in the same way.
Control statements
{ ... } - block statement
if(expr) operator; - conditional statement
for(expr; expr; expr) operator; - repetitive operator
while(condition) body; - repetitive operator
do { body; } while(condition); - repetitive operator
echo <variables and strings>; - print text and variables to console, all arguments should be delimited by spaces.
Angles measurement units
angles ( degree | radian ) - sets the angles measurement units,
this parameter affects fov,rotate,spot_angles and trigonometrical functions.
Default value: degree.
Animation
To save an animation frame, save_frame() function is used.
To save a consequence of frames, usage of repetitive operator is recommended.