Another option is the VRML (virtual reality modeling language) module. The docs for this module are a little sketchy, and it helps to study the structure of wrl files you find on the web before you really "get it". The following example script (vrml_test.pl) draws a red cube:
use strict; use VRML; my $vrml = new VRML(2); $vrml->Group->Shape( sub{$vrml->IndexedFaceSet( sub{$vrml->Coordinate('0 0 0', '0 0 1', '0 1 0', '0 1 1', '1 0 + 0', '1 0 1', '1 1 0', '1 1 1', )->insert('solid FALSE')}, ['0 1 3 2', '0 1 5 4', '0 4 6 2', '4 5 7 6', '2 3 7 6', '1 3 7 + 5'] )}, sub{$vrml->Appearance( sub{$vrml->Material( ambientIntensity => .5, diffuseColor => '1 0 0', emissiveColor => '.25 0 0' )} )} )->back; $vrml->print; $vrml->save; exec 'vrmlview /home/phil/usr/vrml_test.wrl'; #Substitute your own vie +wer and path info here.
You need a VRML viewer to see your work. This particular app runs on Linux and uses vrmlview, available free from Systems in Motion. Windows users have a lot of choices. Just type "windows vrml-viewer" into Google to find them.

Aside from allowing you to see complex shapes that are hard to visualize otherwise, the effects of grabbing an object with your mouse and rotating it in multiple axes can be downright intoxicating! Try it because it's fun, if for no other reason!


In reply to Re: drawing 3D rectangle in Perl/Tk by Dr. Mu
in thread drawing 3D rectangle in Perl/Tk by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.