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];
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.