------ DoNaLD (Definitive Notation for Line Drawing) QUICK REFERENCE ------

Warning: this documentation isn't quite finished yet...


-- SYNTAX -----------------------------------------------------------------

No semi-colons: line feeds are terminators
Line continuation: use \ at the end of a line to continue to the next

# UNIX shell style one-line comments

Variables must be declared before use (except when using the ! operator)
Redeclaration of type is not possible

Name space: append ! to an identifier to reference an Eden variable: eg
  eq!(a, b)

Escaping to Eden: ? is a one-line escape to Eden (remember to terminate
  with a semi-colon)


-- DATA TYPES -------------------------------------------------------------

int: 34
real: 10.0
char: "abc"
boolean: true, false

point: {50, 100}
point: {modulo @ angle} ie distance and angle (radians) from the origin

line: [{10, 10}, {80, 90}]
arc: [point1, point2, r]

circle: circle(centre, radius), circle({500, 500}, 400)
ellipse: ellipse(centre, major, minor)
rectangle: rectangle(point1, point2)
label: label(string, point)

image: I!ImageFile("gif", "hill.gif")
openshape: openshape cross
           within cross {
            line l1, l2
            l1 = [{10, -10}, {-10, 10}]
            l2 = [{10, 10}, {-10, -10}]
           }
shape: shape S
       S = trans(cross, 100, 200)
graph: (see other documentation)


-- FUNCTIONS --------------------------------------------------------------

Arithmetic: + - * div mod sqrt log exp trunc float rand
Trigonometric: sin cos tan asin acos atan
Relational: && || ! < <= == > >=

Geometric:
point midpoint(line)
point intersect(line, line)
line perpend(point, line)
real dist(point, point)
bool intersects(line, line)
bool separates(line, point, point)
bool includes(circle, point)
bool incident(line, point)
bool incident(circle, point)
bool pt_betwn_pts(point, point, point)
bool colinear(point, point, point)
bool distlarger(point, point, value)
bool distlarger(line, point, value)
bool distsmaller(point, point, value)
bool distsmaller(line, point, value)

Shape transformations:
trans(shape, x, y)
scale(shape, ratio)
rot(shape, point, angle)
reflect(shape, line)

String functions:
// (string concatenation)
itos(int)
rtos(real, fprintf-format-string)

Image functions:
I!functionName denotes a function returning an image


-- REFERENCES -------------------------------------------------------------

x: variable x in the immediate context

~/x: variable x in the context one level up

/x: variable x in the root (topmost) context

x!: the Eden variable x

.1, .2: first and second points of a line or first and second coordinates
        of a point

.x, .y: projection of a point onto the x- and y- axes


-- PRE-DEFINED VARIABLES --------------------------------------------------

pi: ratio of circle circumference to diameter (note upper case PI in Eden)


-- ATTRIBUTES -------------------------------------------------------------

To give an attribute to the DoNaLD variable Obj/line1, use the Eden escape:
  ?A_Obj_line1 = "attribute1=value1,attribute2=value2...";

color
outlinecolor
linewidth
linestyle: dotted, dashed or solid
arrow: first, last, both or none
locus: true, false
fill: solid or hollow
font: a string: "{family size style}"...
  family = times, courier or helvetica,
  size = in points (1/72th inch)
  style = normal, bold, roman, italic, underline, overstrike
    (multiple styles are possible: "{times 12 {bold italic}}")


-- VIEWPORTS --------------------------------------------------------------

viewport VIEW1

The default viewport is DoNaLD.


-- MORE INFORMATION ----------------------------------------------------------

See http://www.dcs.warwick.ac.uk/modelling/ for more detail.
