[an error occurred while processing this directive]

Functions

Arithmetic operators and functions

+
-
*
div (division)
mod
sqrt (square root)
log
exp
trunc (convert real to integer)
float (convert an integer to real)
rand (random number generator)
- int rand(int) or real rand(real)
if the argument is an integer, say 10, rand(10) returns a random number ranged from 0 to 9 inclusive;
if the argument is a real, say 1.0, rand(1.0) returns a random number ranged from 0.0 to 1.0 inclusive.

Trigonometric functions

sin
cos
tan
asin
acos
atan
- accept only real arguments

Relational operators

&& (and)
|| (or)
! (not)
<
<=
== (equal)
>
>=

Geometric functions

point midpoint(line)
- mid-point of a line
point intersect(line, line)
- intersection point of two lines
line perpend(point, line)
- the perpendicular line intersecting the point
real dist(point, point)
- distance between two points
bool intersects(line, line)
- whether the lines intersect
bool separates(line, point, point)
- whether the line separates the two points
bool includes(circle, point)
- whether the point is inside the circle
bool incident(line, point)
bool incident(circle, point)
- whether the point coincides with the path
bool pt_betwn_pts(point, point, point)
- whether the 2nd point is within the box bounding the 1st and the 3rd point
bool colinear(point, point, point)
- whether the points are colinear
bool distlarger(point, point, value)
bool distlarger(line, point, value)
bool distsmaller(point, point, value)
bool distsmaller(line, point, value)
- whether the distance from the point to the point/line is larger than or smaller than the specified value

Shape transformations

trans(shape, x, y)
- translate a shape (or openshape)
scale(shape, ratio)
- scale a shape (or openshape) wrt the origin of the coordinate system; would not change the font size or the image size of labels
rot(shape, point, angle)
- rotate a shape round a point by a certain angle

String functions

//
string concatenation
itos(int)
- integer to string conversion
rtos(real, format-string)
- real to string conversion. format-string would be as required by the C function fprintf().

Image functions

Example:
%donald
real xscale, yscale
xscale, yscale = 0.8, 0.8

image zoom, source
source = I!ImageScale(I!ImageFile("gif", "logo.gif"), xscale, yscale)
zoom = I!ImageScale(I!ImageCut(source, 20, 0, 200 * xscale, 200 * yscale), 
	xscale, yscale)

label imgzoom, imgsrc
imgzoom = label(zoom, {500, 200})
imgsrc = label(source, {500, 700})
The images are centred at the specified position (same for string labels). I!functionName denotes a function returning an image. This function is translated to an Eden function named as functionName. The arguments are not fully type-checked, so may sometimes cause a problem. Since this kind of function does not need to be declared beforehand, DoNaLD can easily be extended to make use of image filters chosen by the user. (See examples in $PUBLIC/lib/tkeden/scout.init.e for examples of image filters.)

Other functions

circle(center, radius)
ellipse(center, extreme_point1, extreme_point2)
rectangle(corner1, corner2)
label(string, position)
if boolean_expression then expr else expr
.1, .2
- 1st and 2nd points of a line or 1st and 2nd coordinate of a point, for example:
line l
l = [{0,0}, {100,100}]
point p
p = l.2		# i.e. {100,100}
real x
x = p.1		# i.e. 100
.x, .y
- the projection of a point onto the x- and y- axies, e.g.:
point p, q
p = {100, 200}
q = p.x		# i.e. {100, 0}
[an error occurred while processing this directive]