#!/usr/bin/perl use strict; use warnings; use PDL; use PDL::Graphics::TriD; my $size = 25; # compute coordinates of the surface 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; # coordinates determ color my $r=$x; my $g=$y; my $b=$z; # create 3d-plot imag3d [$x,$y,$z]; hold3d(); # ... colored surface above imag3d_ns [$x,$y,$z], [$r,$g,$b]; # ... colored lattice below lattice3d [$x,$y,$z-1], [$r,$g,$b];