BrowserUk:

Sorry, I should've been more clear. I wasn't referring to the vertices, but the input points to the algorithm. So the diagonal line going through two of the points are the bisector for the other two corners. I put this case into the algorithm (just a few minutes ago):

my @points = ( [0,0], [2, 0], [0, 2], [2, 2] );

Yields the following lines:

[ [1, 0, 1, 0, 1], # X=1 for points 0, 1 [0, 1, 1, 0, 2], # Y=1 for points 0, 2 [0, 1, 1, 1, 3], # Y=1 for points 1, 3 [1, 1, 2, 0, 3], # X+Y=2 for points 0, 3 [1, 0, 1, 2, 3], # X=1 for points 2, 3 ]

That fourth entry is the diagonal I was talking about. It's clearly the bisector for points 0 and 3, but since it intersects at the same point as the first two, it's irrelevant. Looking at the edge list:

[ [3, 1, 0], # Edge from (1,1) to (1,1) [1, -1, 1], [4, -1, 1], [2, 0, -1], [0, 0, -1] ]

Other than the first edge, the rest are as you'd expect to see. I'm suspecting some odd comparison (or roundoff) in the C code to be generating that 0-length segment.

Just for completeness, here's the list of vertices:

[ [1, 1], [1, 1] ]

Looking at the results, I'm struck by a couple items:

...roboticus

Update: I just tried the cross that you suggested, and the data showed *absolutely no* anomalies....odd!

Update: Fixed HTML (missed closer for UL).


In reply to Re^4: Better maps with Math::Geometry::Voronoi, and a Challenge for Math Monks by roboticus
in thread Better maps with Math::Geometry::Voronoi, and a Challenge for Math Monks by samtregar

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.