/* Variablendeklaration */ var x, y; // kartesische Koord. var xi, yi; // internes Koordinatensystem var M = 100; // fester Maßstab 100 Pixel = 1 m ... function setup() { ... xi0 = 0.5*width; // int. Nullpunkt für kart. Koordinatensystem rel. zum internen K. yi0 = 0.5*height; ... } function draw() { ... x = 0.20; // obere linke Ecke y = 0.40; ... // ohne Koordinatentransformation fill(0,255,0); // Füllfarbe grün rect(x*M, y*M, b*M, h*M); fill(255); ... // Mit Koordinatentransformation fill(0,255,0); // Füllfarbe grün rect(kXi(x*M),kYi(y*M),b*M,h*M); // mit Koordinatentransf. ... // Mauskoordinaten intern -> kartesisch -> intern fill(255); // weiße Ellipse zeigt Mauskoord. in int. Koord. ellipse(mouseX, mouseY, 15, 15); x = iXk(mouseX)/M; // maßstabsrichtige Rücktransf. bezügl. Koord. ursprung y = iYk(mouseY)/M; fill(0); // schwarze Ellipse zeigt Mauskoord. in kart. K. ellipse(kXi(x*M), kYi(y*M), 5, 5); // maßstabsrichtig! ... }