TheTruePhoenix has asked for the wisdom of the Perl Monks concerning the following question:

I've been looking through CPAN for something that would do the following (figured it would be best to cut to the chase) and haven't had any luck so far (but I'm not good and finding stuff sometimes so it's most likely there).

Use X/Y/Z coordinates fed to it from the main program, for numerous items, place them on a 3D Graph as a coloured dot, based on their type.

Every 2 minutes the program will rerun and move the objects to new X/Y/Z locations, including some being removed and some being added.

After the code has completed (a series of 2 minute runs, usually up to 30 in total) have a play-back function to show the objects moving, smoothly if possible, from their locations, etc.

Any help would be great....
TTP

Replies are listed 'Best First'.
Re: 3D Dot "Graph" with motion
by moklevat (Priest) on Mar 19, 2008 at 13:45 UTC
    Lu's suggestion to use PDL is what I would do if you want to run the visualization "live". I would go with moritz's approach if you want to store the visualization as an animation for later playback. Here is a brief example of a 3D visualization of points using PDL adapted from one of the examples from the docs. The nokeeptwiddling3d() function is what allows the changes in position to be plotted while the iteration happens. If you remove that then you can step through each change in position by pressing the "q" key.

    #!/usr/bin/perl -w use strict; use PDL; use PDL::Graphics::TriD; my $size = 25; my $x = (xvals zeroes $size+1,$size+1) / $size; my $y = (yvals zeroes $size+1,$size+1) / $size; my $z = 0.5 + 0.5 * (sin($x*6.3) * sin($y*6.3)) ** 3; # Bumps my $r = $x; my $g = $y; my $b = $z; nokeeptwiddling3d(); for (1..50){ points3d [$x,$y,$z], [$r,$g,$b]; # Draw several colored dots $x+=$y*$z; } keeptwiddling3d(); points3d [$x,$y,$z], [$r,$g,$b];
Re: 3D Dot "Graph" with motion
by Lu. (Hermit) on Mar 19, 2008 at 09:46 UTC
    Don't know if you aleady checked it, but PDL::Graphics::TriD seems like a good starting point.

    Lu.
Re: 3D Dot "Graph" with motion
by moritz (Cardinal) on Mar 19, 2008 at 10:40 UTC
    Your best bet is to first generate the images one by one and store them, and after that render them into a video (for example mencoder can do that).

    If the objects move too far between two images, you have to generate more images inbetween.

    The second choice that comes to my mind is SDL or OpenGL, but I don't know if there are 3D plotting modules for them.

Re: 3D Dot "Graph" with motion
by apl (Monsignor) on Mar 19, 2008 at 09:52 UTC
    I've never used it, but might GD-Graph3d-0.63 help?

    points to a lot of Graphics modules. It's a good place to start your quest.