1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
BEGIN {
$PDL::Graphics::TriD::device = "VRML";
print "====================================\n";
print " VRML not available...stopping demo \n";
print "====================================\n";
exit;
}
BEGIN{
PDL::Graphics::VRMLNode->import();
PDL::Graphics::VRMLProto->import();
}
use PDL::Graphics::TriD;
use PDL::LiteF;
use Carp;
$SIG{__DIE__} = sub {print Carp::longmess(@_); die;};
$set = tridsettings();
$set->browser_com('netscape/unix');
#$set->set(Compress => 1);
$nx = 20;
$t = (xvals zeroes $nx+1,$nx+1)/$nx;
$u = (yvals zeroes $nx+1,$nx+1)/$nx;
$x = sin($u*15 + $t * 3)/2+0.5 + 5*($t-0.5)**2;
$cx = PDL->zeroes(3,$nx+1,$nx+1);
random($cx->inplace);
$pdl = PDL->zeroes(3,20);
$pdl->inplace->random;
$cols = PDL->zeroes(3,20);
$cols->inplace->random;
$g = PDL::Graphics::TriD::get_new_graph;
$name = $g->add_dataseries(PDL::Graphics::TriD::Points->new($pdl,$cols));
$g->bind_default($name);
$name = $g->add_dataseries(PDL::Graphics::TriD::Lattice->new([SURF2D,$x]));
$g->bind_default($name);
$name = $g->add_dataseries(PDL::Graphics::TriD::SLattice_S->new([SURF2D,$x+1],$cx,
{Smooth=>1,Lines=>0}));
$g->bind_default($name);
$g->scalethings();
$win = PDL::Graphics::TriD::get_current_window();
require PDL::Graphics::VRML::Protos;
PDL::Graphics::VRML::Protos->import();
#$win->{VRMLTop}->register_proto(PDL::Graphics::VRML::Protos::PDLBlockText10());
#$win->{VRMLTop}->uses('PDLBlockText10');
#$win->current_viewport()->add_object(PDL::Graphics::TriD::VRMLObject->new(
# vrn(Transform,
# translation => '0 0 -1',
# children =>
# [PDL::Graphics::VRMLNode->new('PDLBlockText10')
# ]
# )
# ));
$win->display('netscape');
exit;
|