Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Polygon Filling algorithm in Perl

by hossman (Prior)
on Sep 28, 2002 at 08:55 UTC ( #201429=note: print w/ replies, xml ) Need Help??


in reply to Polygon Filling algorithm in Perl

totally random thought...

I notice you defined all of your y coords based on the height .. but you used subtraction, so you're still making an assumption about the minimum height. Any time you can define some constraint on a value given another value, you should consider doing so in your code. That way if someone says "Hey this is cool, but it's a little big so i'll change the size to 50x60" your code can deal with the change flawlessly...

my $A = new Vector2D( int($width * 0.3125), int($height * 0.65) ); my $B = new Vector2D( int($width * 0.46875), int($height * 0.75) ); my $C = new Vector2D( int($width * 0.65625), int($height * 0.55) ); my $D = new Vector2D( int($width * 0.65625), int($height * 0.25) ); my $E = new Vector2D( int($width * 0.46875), int($height * 0.45) ); my $F = new Vector2D( int($width * 0.3125), int($height * 0.35) );


Comment on Re: Polygon Filling algorithm in Perl
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://201429]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-11-28 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (199 votes), past polls