I was working on a GD based module, when i came up with a functional fix (so, it's not pretty, but mostly just to prove it works).
#!/usr/bin/perl use GD; my $image = new GD::Image(110,110); my $red = $image->colorAllocate(255,0,0); my $blue = $image->colorAllocate(0,0,255); my $white = $image->colorAllocate(255,255,255); $image->fill(0,0,$white); my $poly = new GD::Polygon; $poly->addPt(50,0); ### add your points $poly->addPt(99,99); $poly->addPt(0,99); $image->polygon($poly); ### do the work my $base_point = [109,109]; # known outside my $test_point = [50,50]; # unknown $image->fill($test_point->[0],$test_point->[1],$red); my $clrindex = $image->getPixel($base_point->[0],$base_point->[1]); if ($clrindex == $red) { warn "Point is outside of polygon."; exit 0; } else { warn "Point is inside of polygon."; exit 1; }
so, if it is the answer you seek, i like this way ... if it is the mathmatics of it (which it probably is), this is not use.
can't sleep clowns will eat me
-- MZSanford

In reply to Re: Points, Lines. Polygons OO my by MZSanford
in thread Points, Lines. Polygons OO my by mitd

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.