title: How to assemble an array(s) of continuous points for a contour line using Conrec
body: <p>I have a Conrec nightmare.  I am trying to implement contour lines in ActionScript using Conrec.  I have looked at both the java and javascript implementation and am still stuck.  These are found here: <a href="http://paulbourke.net/papers/conrec/" rel="nofollow">http://paulbourke.net/papers/conrec/</a></p>
  
  <p>Conrec will take grid data and assemble continuous contour lines.  The problem is that it does not necessarily draw those lines in a continuous fashion.  For example, it will draw A->B and then C->B and then C->D instead of A, B, C, D, etc.</p>
  
  <p>The javascript implementation seems to be accounting for this and serializing the instructions into an array of draw points.  Which is what I too want to accomplish in the end.  That is it takes the instructions from the core Conrec logic (eg: A->B, C->B, C->D, etc) and organizes it into an A, B, C, D series.  I <em>think</em> it will also return the series as a multi-dimensional array to accommodate broken lines (eg: [[A, B, C, D], [E, F, G]]).  This last functionality is what I need to do in Actionscript.</p>
  
  <p>This last part is where I am stuck.  Ignore Conrec for now (I have given up on finding an Actionscript implementation), how can I organize these instructions into a collection of serial points?  When Conrec gives me "draw point from X->Y" how can I first check if X or Y are already in a series and append either X or Y (whichever is not in the series) into the series?  AND if neither are in the series, start a NEW series with X, Y as the starting set.  Then check subsequent instructions against all existing series and connect series if they now start and stop on the same point?  Also, I need to be able to allow for a series to close itself (eg: A, B, C, A) -- a loop (is that even possible?!).</p>
  
  <p>I hope this makes sense.  I'm not sure if there is a technical term for what I want to do beyond "concatenation".  I also hope someone out there has done this with Conrec and can give me some pointers.</p>
  
  <p>In the meantime, I am going to continue to plug away at this and see if I can come up with something but I am not confident in my abilities.  I would really be thankful for some veteran or professional advice.</p>
  
  <p>PS:
  If you know another way to draw contour lines from grid data, I am open to alternatives.  But I have to be able to implement it in Actionscript.</p>