I'd be curious whether the triangles evince some relevant property, like (maybe): no XY coordinate is contained within any such triangle, or the XY plane is fully covered without overlap by the set of triangles

The triangles are a non-overlapping mesh (Delaunay or complient Delaunay Trangulation); the data is from a Finite Element Modeling program.

And yes; I'm also pretty sure the triangles are the key. Having played a little with my stratification idea; it is clear that it is going no where -- producing a tangled web of string rather than nice flowing contours.

This is what I now think I need to do:

Starting with a simple triangular mesh of points, with the heights at the nodes:

/4\ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ 3--------------------6.5--------------------5 /|\ | /| +\ / | \ | / | + \ / | \ | / | + \ / | \ | / | + \ / | \ | / | + \ / | \ | / | + \ / | \ | / | + \ / | \ | . / | + \ / | \ | / | + \ / | \ | / . | + \ / | \|/ | + \ 2--------------------5.5--------------------9--------------------7.5 +---------------------6 \ | /|\ | + / \ | / | \ | + / \ | / | \ | + / \ | / | . \ | + / \ | / | \ | + / \ | / | \ | + / \ | / | \ | + / \ | / | \ | + / \ | / | \ | + / \ | / | \ | + / \|/ | \| +/ 3--------------------6.5--------------------6 \ | / \ | / \ | / \ | / \ | / \ | / \ | / \ | / \ | / \ | / \4/

I pick my contour values -- integers 3 to 8 are convenient for this examples -- and process the edges of the triangles linearly (being careful not to process edges twice where they are part of two triangles), and interpolate the positions on those edges where any of my chosen contour values will cross.

Eg. On the edge between value 2 and 5.5, I find the positions are which 3, 4, 5 cross that edge; and store those coordinates in separate arrays for each value. I end up with something as below:

/4\ / | \ / | \ / | \ / | \ / 5 \ / | \ / | \ / | \ / 6 \ / | \ 3-----4------5-----6-6.5-----6--------------5 /|\ | /| +\ / | 4 | / | + \ / | \ 7 6 | + \ / | 5 | / | + \ / 4 \ | / 6 + \ / | 6 | 7 | + \ / | \ 8 / | + \ / | 7 | . / | + \ / 5 \ | 8 | + \ / | 8 | / . 7 + \ / | \|/ | + \ 2-----3------4----5 -5.5--6-----7-----8-----9-------------8------7.5 +------7--------------6 \ | /|\ | + / \ | 8 | \ | + / \ 5 / | \ | + / \ | 7 | . \ 7 + / \ | / 8 8 | + / \ | 6 | \ | + / \ 4 / | \ | + / \ | 5 | \ | + / \ | / 7 7 | + / \ | 4 | \ | + / \|/ | \| +/ 3-----4------5-----6-6.5--------------------6 \ | / \ | / \ 6 / \ | / \ | / \ | 5 \ 5 / \ | / \ | / \ | / \4/

Then it just a case of ordering those arrays of points to produce the polylines that make up the contours something like this:

/4\ / *| \ / * | \ / * | \ / * | \ / * 5 \ / * * | * \ / * * | * \ / * * | * \ / * * 6* * \ / * * * | * * \ 3-----4------5-----6-6.5-----6--------------5 /|\ * * * | * /|\ / *| 4 * * | * / | + \ / * | * \ * * *7 * * 6 | + \ / * |* 5 * * | * / ** | + \ / * 4 * \ * * | * / 6 + \ / * *| * 6 * | 7* | + * \ / * * | * * \ * 8 / * | + * \ / * * |* * 7 *| * . / * | + * \ / * * 5 * * \ * | 8 * | + * \ / * * * | * * 8 | / * . 7 +* * \ / * * * | * * * \|/ * | + * * \ 2-----3------4----5 -5.5--6-----7-----8-----9-------------8------7.5 +------7--------------6 \ * * * | * * * /|\ * | + * * \ * * * | * * 8 | \ * | + * * \ * * 5 * * / * | \ * | +* * \ * * |* * 7 *| . \ * 7 + * \ * * | * * / * 8********8 *| + * \ * *| * *6 * | \ * | + * \ * 4 * / * * | \ * | + * \ * |* 5 * * | \ * | + * \ * | * / * * 7****************7 | + * \ *| 4 * * | \ | + * \|/ * * * | \|* + 3-----4------5-----6-6.5--------6.25--------6 \ * * * | *** / \ * * *| *** / \ * * 6 *** / \ * * | / \ * * | / \ * *| * *5 \ * 5 * * / \ * | / \ * | / \ *| / \4/

I don't have a full handle on the ordering process; but I've a few ideas to try. (Actually, I don't need to order them to do the intersections with the boundaries; though it might be nice to draw the contours to see that they are correct before going on.)

Then all I have to do :) is work out which of those contours intersect the polylines that form the boundaries and work out where and at what angle they intersect.

And then I can start on trying to collate the results in a way that is meaningful...the driving force behind the whole problem.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^2: Contour mapping? by BrowserUk
in thread Contour mapping? by BrowserUk

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.