Zuletzt geändert: Do, 11.01.2007

«K12/K13» plotter.pl «PDF», «POD»



Download
#!/usr/bin/perl

use warnings;
use strict;

use Math::Trig;

sub f { sin($_[0] * $ARGV[0]) * sin($_[1] * $ARGV[1]) * sin($_[2] * $ARGV[2]) }

my $dots    = 50;
my $iters   = 1;
my $tresh   = 0.6;
my $epsilon = 0.05;

my @range = map { $_ * pi/($dots-1) } 0..($dots-1);

for my $x (@range) {
  for my $y (@range) {
    for my $z (@range) {
#      for(1..$iters) {
#        my $prob = f($x,$y,$z);
#
#        print "$x $y $z\n" if $prob > rand;
#      }

      print "$x $y $z\n" if abs(f($x,$y,$z)**2 - $tresh) <= $epsilon;
    }
  }
}

# set view 47,342
# set xrange [ 0 : pi ]
# set yrange [ 0 : pi ]
# set zrange [ 0 : pi ]