Asymptote: Olympiad Package Part 1
Sometimes, you don't want to write the coordinate (3.5,6.2) over and over and over again. Thus, the olympiad package is a lifesaver. Let's look at this simple bit of code: (Note, the import olympiad command is not needed on the forum).
import olympiad; real r=2.5, a=3.5; dot((r,a));
Or something like:
import olympiad; pair A=origin, B=(3,0), C=(3,2), D=(0,2); draw(A--B--C--D--cycle);
(Note that the origin is the point (0,0)).
Now let's go even farther:
import olympiad; pair A=origin, B=(3,0), C=(3,2), D=(0,2); path p=A--B--C--D--cycle; draw(p);
At the moment, this does nothing to shorten our code. However, in this bit:
import olympiad; pair A=origin, B=(3,0), C=(3,2), D=(0,2); path p=A--B--C--D--cycle; draw(p); draw(shift(3.5,0)*p); draw(shift(7,0)*p);
the code works nicely. Without defining the path, the code would have been much longer.