Department of Computer Science | Institute of Theoretical Computer Science | CADMO
Prof. Emo Welzl and Prof. Bernd Gärtner
This is a short description of Libturtle, a small turtle graphic library based on Libwindow. If you want to use the library in your program, do not forget the following include directive.
#include <IFM/turtle>
Imagine a turtle walking on the Euclidean plane and leaving a trace behind it. At any time, the turtle has a certain position and a view direction. Initially, it is looking to the right. You can influence these parameters using the following functions.
|
|
|
|
|
|
When the drawing is complete, i.e., at the end of the program, it is shown in a window of pixels, appropriately scaled to use the space available. A mouseclick then destroys the window and ends the program.
#include <IFM/turtle> int main() { for (unsigned int i = 0; i < 5; ++i) { ifm::forward(); ifm::left(72); } return 0; }