May I ask why you did not use Tk?
Recently for amusement I was looking for a simple way to plot geometrical shapes (polygons, regular solids, pyramids) in the form of a bzflag world map using perl. The thought experiment took me far and wide through various incantations of mesa, openGL/Perl, Glut, Perl SDL, and more. In the end I kept trying options and finding errors and horrible bugs eventually coming full circle (pun intended) back to Perl/Tk.
You may find some examples of interest using Tk:
Some code (corrected from non-working code found in Advanced Perl Programming) always makes a nice point:
#!/usr/bin/perl -w use Tk; $top = MainWindow->new(); $canvas = $top->Canvas(width => 600, height => 490)->pack(); # Draw a set of circles along an archimedean spiral # The centers of these circles move along the spiral # (radius of spiral = constant * theta)
$origin_x = 110; $origin_y = 70; # origin of the spiral $PI = 3.1415926535; $circle_radius = 5; # radius of the first circl +e $path_radius = 0; for ($angle = 0; $angle <= 180; $path_radius += 7, $circle_radius += 3, $angle += 4) { # offset of path coordinates: r.cos() and r.sin() # sin() and cos() like their angles in radians (degrees*/90) $path_x = $origin_x + $path_radius * cos ($angle * $PI / 90); $path_y = $origin_y - $path_radius * sin ($angle * $PI / 90); # path_x and path_y are the coordinates of the center of the new # circle. Canvas::create likes top-left and bottom-right corners $canvas->createOval ( $path_x - $circle_radius, $path_y - $circle_radius, $path_x + $circle_radius, $path_y + $circle_radius, -fill => 'yellow' ); $canvas->createLine ( $origin_x, $origin_y, $path_x, $path_y, -fill => 'slategray'); } MainLoop();
In reply to Re^2: GD vs. gnuplot
by SciDude
in thread GD vs. gnuplot
by johnnywang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |