Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Ultimately this will be used in a web page (for shapes representing towns in different counties)

Interesting. Many years ago, I developed Acme::EyeDrops -- which similarly had to solve the problem of how to represent arbitrary shapes for use in ascii art. If you look at Acme::EyeDrops Shape Reference, you'll see it defines two kinds of shapes:

  • Built-in shapes. An algorithm is used to generate these types of shapes, for example a Sierpinski triangle. (Note that A::E has precious few built-in shapes; ideas for new built-in shapes welcome).
  • ".eye file" shapes. These shapes are defined by a (simply formatted) .eye file, for example, a map of italy.

Two simple examples to give you a feel for how this works.

Running this program:

use Acme::EyeDrops qw(sightly); print sightly({ Text => 1, TextFiller => '/\\', Shape => 'siertri', # For 'siertri' built-in shape, Width=>5 means: # height is 2**5 lines # width is 2 * 2**5 characters Width => 5 });
displays:
/\ /\/\ /\ /\ /\/\/\/\ /\ /\ /\/\ /\/\ /\ /\ /\ /\ /\/\/\/\/\/\/\/\ /\ /\ /\/\ /\/\ /\ /\ /\ /\ /\/\/\/\ /\/\/\/\ /\ /\ /\ /\ /\/\ /\/\ /\/\ /\/\ /\ /\ /\ /\ /\ /\ /\ /\ /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ /\ /\ /\/\ /\/\ /\ /\ /\ /\ /\/\/\/\ /\/\/\/\ /\ /\ /\ /\ /\/\ /\/\ /\/\ /\/\ /\ /\ /\ /\ /\ /\ /\ /\ /\/\/\/\/\/\/\/\ /\/\/\/\/\/\/\/\ /\ /\ /\ /\ /\/\ /\/\ /\/\ /\/\ /\ /\ /\ /\ /\ /\ /\ /\ /\/\/\/\ /\/\/\/\ /\/\/\/\ /\/\/\/\ /\ /\ /\ /\ /\ /\ /\ /\ /\/\ /\/\ /\/\ /\/\ /\/\ /\/\ /\/\ /\/\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Running this program:

use Acme::EyeDrops qw(sightly); print sightly({ Text => 1, TextFiller => 'Azzurri', Shape => 'map_italy' });
displays:
Azzurr iAzzurriAzz urriAzzurriAzzurr iA zzurriAzzurriAzzurriAzz urriAzzurriAzzurriAzzurriAzzur riAzzurriAzzurriAzzurriAzzurriAzz urriAzzurriAzzurriAzzurriAzzur riAzzurriAzzurriAzzurriAzzurr iAzzurriAzzurriAzzurriAzzurriA zzurriAzzurriAzzurriAzzurriAzzu rriAzzurriAzzurriAzzurriAzzurr iAzzurr iAzzurriAzzurri Azzu rriAzzurriAzzu rr iAzzurriAzzurri AzzurriAzzurriAzz urriAzzurriAzzurr iAzzurriAzzurriAzz u rriAzzurriAzzurriA zzur riAzzurriAzzurriA zzurr iAzzurriAzzurriAz zurri AzzurriAzzurriAzz urriA zzurriAzzurriAzzurriA zzu rriAzzurriAzzurriA zzurriAzzurriAzzur ri AzzurriAzzurriAzz urriAzzu rriAzzurriAzzurriA zzurriAz zurriAzzurriAzzurri Azzurri AzzurriAzzu rriAz zurriAz zurriAzz urr iAzzurr iAzz ur riAzzur riA zzurriA zzurr iAzz ur riAzz ur riAzz urri Azzu r ri Azzur riAzzurriAzzurri Az zurriAzzurriAzz urriAzzurri AzzurriA zzurr iAz

The primary purpose of Acme::EyeDrops is to auto-generate obfuscated, working Perl code ... so its shape pouring capabilities are fairly primitive. I'm just bringing it to your attention in case it gives you ideas for your current project, or in case it generates ideas for enhancing the shape pouring capabilities of Acme::EyeDrops.


In reply to Re: Polygon Creation -- Request for Algorithm Suggestions by eyepopslikeamosquito
in thread Polygon Creation -- Request for Algorithm Suggestions by golux

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-25 12:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found