Coder Social home page Coder Social logo

conrec.js's Introduction

This is a JavaScript implementation of the CONREC contouring algorithm, which operates on a grid of z-values.

If no contour-drawing function is specified, it builds a list of contour vectors that can be accessed via .contourList().

Example:

var data = [[0, 1, 0], [1, 2, 1], [0, 1, 0]];
var c = new Conrec;
c.contour(data, 0, 2, 0, 2, [1, 2, 3], [1, 2, 3], 3, [0, 1, 2]);
// c.contours will now contain vectors in the form of doubly-linked lists.
// c.contourList() will return an array of vectors in the form of arrays.

conrec.js's People

Contributors

jasondavies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

conrec.js's Issues

paths not closing properly when close to the edge

I have tried to use conrec.js with d3, but for some reason the paths don't seem to close properly when they are close to the edge. The result looks like this:
contour

The code I used is:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    <script type="text/javascript" src="d3.js"></script>
    <script type="text/javascript" src="conrec.js"></script>

  </head>
  <body>
    <div id="test"></div>
    <script type="text/javascript">

    var c = new Conrec();

    var testS = d3.select("#test").
        append("svg:svg").
        attr("width", 1500).
        attr("height", 800);


    d3.json("aaa.json",function(values){

        var maxX = -100;
        var minX = 100;
        var maxY = -200;
        var minY = 200;
        values.forEach(function(val){
            maxX=maxX>val[0]?maxX:val[0];
            minX=minX<val[0]?minX:val[0];
            maxY=maxY>val[1]?maxY:val[1];
            minY=minY<val[1]?minY:val[1];
        });

        console.log("Mx = "+maxX+"  mx = "+minX+"  My = "+maxY+"  my = "+minY + " => " +(maxX-minX)/2.5+":"+(maxY-minY)/2.5);
        var grid=new Array((maxX-minX)/2.5+1);
        for (var i=0;i<grid.length;i++)
            grid[i] = Array((maxY-minY)/2.5+1);

        console.log("x="+((values[1][0]-25)/2.5)+"  y="+((values[0][1]+40)/2.5)+"\n"+grid[0]);

        values.forEach(function(val){grid[(val[0]-25)/2.5][(val[1]+40)/2.5]=val[2];});
        console.log(grid);

    var colours = ['#000099','#0000FF','#3399FF','#00CCFF','#00CC00','#66FF00','#FFFF00','#CC0000','#FF6633'],
        xs = d3.range(0, grid.length),
        ys = d3.range(0, grid[0].length),
        zs = [-0.1, 20.0, 50.0, 75.0, 90.0, 95.0, 98.0, 99.0, 99.9, 100.1],
        w = 1500,
        h = 800,
        x = d3.scale.linear().range([0, w]).domain([0, grid[0].length]),
        y = d3.scale.linear().range([h, 0]).domain([0, grid.length]);

    c.contour(grid, 0, xs.length-1, 0, ys.length-1, xs, ys, zs.length, zs);

    testS.selectAll("path").data(c.contourList())
       .enter().append("svg:path")
       .style("fill",function(d) { 
       return colours[zs.indexOf(d.level)-1];
       })
       .style("stroke","black")
       .attr("d",d3.svg.line()
       .x(function(d) { return x(d.x); })
       .y(function(d) { return y(d.y); })
         );
} );

    </script>
  </body>
</html>

The data from aaa.json is:

[[25.0,-40.0,0],[25.0,-37.5,0],[25.0,-35.0,0.365768700838089],[25.0,-32.5,3.3441708087921143],[25.0,-30.0,8.430097579956055],[25.0,-27.5,22.805387496948242],[25.0,-25.0,59.411285400390625],[25.0,-22.5,79.77821350097656],[25.0,-20.0,90.1242446899414],[25.0,-17.5,92.36530303955078],[25.0,-15.0,92.00534057617188],[25.0,-12.5,91.14026641845703],[25.0,-10.0,84.85253143310547],[25.0,-7.5,57.04249954223633],[25.0,-5.0,45.55271530151367],[25.0,-2.5,21.353925704956055],[25.0,0.0,16.088016510009766],[25.0,2.5,13.399907112121582],[25.0,5.0,16.912446975708008],[25.0,7.5,15.426149368286133],[25.0,10.0,19.408964157104492],[25.0,12.5,22.073850631713867],[25.0,15.0,24.1929874420166],[25.0,17.5,21.45842933654785],[25.0,20.0,26.915931701660156],[25.0,22.5,30.260101318359375],[25.0,25.0,36.20529556274414],[25.0,27.5,33.83650588989258],[25.0,30.0,28.50092887878418],[25.0,32.5,15.35647964477539],[25.0,35.0,8.714584350585938],[25.0,37.5,0.9231305122375488],[25.0,40.0,0],[25.0,42.5,0],[25.0,45.0,0],[25.0,47.5,0],[25.0,50.0,0],[25.0,52.5,0],[25.0,55.0,0],[27.5,-40.0,0],[27.5,-37.5,0],[27.5,-35.0,0.841848611831665],[27.5,-32.5,6.508360385894775],[27.5,-30.0,19.310264587402344],[27.5,-27.5,51.52113342285156],[27.5,-25.0,77.28170013427734],[27.5,-22.5,92.10404205322266],[27.5,-20.0,98.7575454711914],[27.5,-17.5,99.12911987304688],[27.5,-15.0,97.9737548828125],[27.5,-12.5,98.16535186767578],[27.5,-10.0,95.33789825439453],[27.5,-7.5,93.39293670654297],[27.5,-5.0,73.67626190185547],[27.5,-2.5,60.29377746582031],[27.5,0.0,46.71969223022461],[27.5,2.5,32.81467819213867],[27.5,5.0,31.125173568725586],[27.5,7.5,36.50139236450195],[27.5,10.0,38.69020080566406],[27.5,12.5,41.0764045715332],[27.5,15.0,40.83836364746094],[27.5,17.5,45.541107177734375],[27.5,20.0,45.84881591796875],[27.5,22.5,56.0380859375],[27.5,25.0,59.09196472167969],[27.5,27.5,59.26033401489258],[27.5,30.0,49.2452392578125],[27.5,32.5,42.96330642700195],[27.5,35.0,22.996980667114258],[27.5,37.5,8.952624320983887],[27.5,40.0,2.3339526653289795],[27.5,42.5,0],[27.5,45.0,0],[27.5,47.5,0],[27.5,50.0,0],[27.5,52.5,0],[27.5,55.0,0],[30.0,-40.0,0],[30.0,-37.5,0.15095216035842896],[30.0,-35.0,3.274500608444214],[30.0,-32.5,17.55109214782715],[30.0,-30.0,46.88225555419922],[30.0,-27.5,71.7138900756836],[30.0,-25.0,94.2638168334961],[30.0,-22.5,99.91871643066406],[30.0,-20.0,99.91871643066406],[30.0,-17.5,99.91871643066406],[30.0,-15.0,99.91871643066406],[30.0,-12.5,99.91871643066406],[30.0,-10.0,99.91871643066406],[30.0,-7.5,99.6980972290039],[30.0,-5.0,99.50069427490234],[30.0,-2.5,94.3567123413086],[30.0,0.0,93.95030212402344],[30.0,2.5,93.07942199707031],[30.0,5.0,93.41035461425781],[30.0,7.5,94.4496078491211],[30.0,10.0,96.49906921386719],[30.0,12.5,96.35392761230469],[30.0,15.0,95.65721893310547],[30.0,17.5,93.81676483154297],[30.0,20.0,93.33488464355469],[30.0,22.5,95.6281967163086],[30.0,25.0,96.59196472167969],[30.0,27.5,96.51648712158203],[30.0,30.0,94.82698822021484],[30.0,32.5,90.2171401977539],[30.0,35.0,69.57733154296875],[30.0,37.5,36.62331771850586],[30.0,40.0,12.813515663146973],[30.0,42.5,0],[30.0,45.0,0],[30.0,47.5,0],[30.0,50.0,0],[30.0,52.5,0],[30.0,55.0,0],[32.5,-40.0,0.06386437267065048],[32.5,-37.5,1.7882025241851807],[32.5,-35.0,11.658151626586914],[32.5,-32.5,31.996051788330078],[32.5,-30.0,62.75545883178711],[32.5,-27.5,92.85880279541016],[32.5,-25.0,99.68648529052734],[32.5,-22.5,99.91871643066406],[32.5,-20.0,99.91871643066406],[32.5,-17.5,99.91871643066406],[32.5,-15.0,99.91871643066406],[32.5,-12.5,99.91871643066406],[32.5,-10.0,99.91871643066406],[32.5,-7.5,99.91871643066406],[32.5,-5.0,99.91871643066406],[32.5,-2.5,99.8432388305664],[32.5,0.0,99.47747039794922],[32.5,2.5,99.22201538085938],[32.5,5.0,99.34974670410156],[32.5,7.5,99.75615692138672],[32.5,10.0,99.91871643066406],[32.5,12.5,99.91871643066406],[32.5,15.0,99.91291046142578],[32.5,17.5,99.91871643066406],[32.5,20.0,98.6124038696289],[32.5,22.5,99.91871643066406],[32.5,25.0,99.79679870605469],[32.5,27.5,99.79679870605469],[32.5,30.0,99.73873901367188],[32.5,32.5,99.19298553466797],[32.5,35.0,94.33929443359375],[32.5,37.5,79.56920623779297],[32.5,40.0,34.56804275512695],[32.5,42.5,0],[32.5,45.0,0],[32.5,47.5,0],[32.5,50.0,0],[32.5,52.5,0],[32.5,55.0,0],[35.0,-40.0,0.5109149813652039],[35.0,-37.5,6.996051788330078],[35.0,-35.0,24.912912368774414],[35.0,-32.5,45.29726028442383],[35.0,-30.0,83.07594299316406],[35.0,-27.5,97.86925506591797],[35.0,-25.0,99.91871643066406],[35.0,-22.5,99.91871643066406],[35.0,-20.0,99.91871643066406],[35.0,-17.5,99.91871643066406],[35.0,-15.0,99.91871643066406],[35.0,-12.5,99.91871643066406],[35.0,-10.0,99.91871643066406],[35.0,-7.5,99.91871643066406],[35.0,-5.0,99.91871643066406],[35.0,-2.5,99.91871643066406],[35.0,0.0,99.91871643066406],[35.0,2.5,99.91871643066406],[35.0,5.0,99.91871643066406],[35.0,7.5,99.91871643066406],[35.0,10.0,99.91871643066406],[35.0,12.5,99.91871643066406],[35.0,15.0,99.91871643066406],[35.0,17.5,99.91871643066406],[35.0,20.0,99.91871643066406],[35.0,22.5,99.91871643066406],[35.0,25.0,99.91871643066406],[35.0,27.5,99.91871643066406],[35.0,30.0,99.91871643066406],[35.0,32.5,99.91871643066406],[35.0,35.0,99.53553009033203],[35.0,37.5,93.54969787597656],[35.0,40.0,66.62796020507812],[35.0,42.5,0],[35.0,45.0,0],[35.0,47.5,0],[35.0,50.0,0],[35.0,52.5,0],[35.0,55.0,0],[37.5,-40.0,2.4500696659088135],[37.5,-37.5,9.626103401184082],[37.5,-35.0,27.90873146057129],[37.5,-32.5,47.8692512512207],[37.5,-30.0,73.15373992919922],[37.5,-27.5,97.22480010986328],[37.5,-25.0,99.6980972290039],[37.5,-22.5,99.91871643066406],[37.5,-20.0,99.91871643066406],[37.5,-17.5,99.91871643066406],[37.5,-15.0,99.91871643066406],[37.5,-12.5,99.91871643066406],[37.5,-10.0,99.91871643066406],[37.5,-7.5,99.91871643066406],[37.5,-5.0,99.91871643066406],[37.5,-2.5,99.91871643066406],[37.5,0.0,99.91871643066406],[37.5,2.5,99.91871643066406],[37.5,5.0,99.91871643066406],[37.5,7.5,99.91871643066406],[37.5,10.0,99.91871643066406],[37.5,12.5,99.91871643066406],[37.5,15.0,99.91871643066406],[37.5,17.5,99.91871643066406],[37.5,20.0,99.91871643066406],[37.5,22.5,99.91871643066406],[37.5,25.0,99.91871643066406],[37.5,27.5,99.91871643066406],[37.5,30.0,99.91871643066406],[37.5,32.5,99.86646270751953],[37.5,35.0,99.6980972290039],[37.5,37.5,98.72270965576172],[37.5,40.0,80.23687744140625],[37.5,42.5,0],[37.5,45.0,0],[37.5,47.5,0],[37.5,50.0,0],[37.5,52.5,0],[37.5,55.0,0],[40.0,-40.0,1.3005108833312988],[40.0,-37.5,7.3502092361450195],[40.0,-35.0,21.168136596679688],[40.0,-32.5,42.969112396240234],[40.0,-30.0,67.83557891845703],[40.0,-27.5,88.08638763427734],[40.0,-25.0,99.6980972290039],[40.0,-22.5,99.6980972290039],[40.0,-20.0,99.91871643066406],[40.0,-17.5,99.91871643066406],[40.0,-15.0,99.91871643066406],[40.0,-12.5,99.91871643066406],[40.0,-10.0,99.91871643066406],[40.0,-7.5,99.91871643066406],[40.0,-5.0,99.91871643066406],[40.0,-2.5,99.91871643066406],[40.0,0.0,99.91871643066406],[40.0,2.5,99.91871643066406],[40.0,5.0,99.91871643066406],[40.0,7.5,99.91871643066406],[40.0,10.0,99.91871643066406],[40.0,12.5,99.91871643066406],[40.0,15.0,99.91871643066406],[40.0,17.5,99.91871643066406],[40.0,20.0,99.91871643066406],[40.0,22.5,99.91871643066406],[40.0,25.0,99.91871643066406],[40.0,27.5,99.91871643066406],[40.0,30.0,99.6980972290039],[40.0,32.5,99.6980972290039],[40.0,35.0,99.6980972290039],[40.0,37.5,98.3046875],[40.0,40.0,83.80747985839844],[40.0,42.5,0],[40.0,45.0,0],[40.0,47.5,0],[40.0,50.0,0],[40.0,52.5,0],[40.0,55.0,0],[42.5,-40.0,0.8766837120056152],[42.5,-37.5,5.532977104187012],[42.5,-35.0,10.990478515625],[42.5,-32.5,35.20088195800781],[42.5,-30.0,57.04830551147461],[42.5,-27.5,85.43891906738281],[42.5,-25.0,94.6876449584961],[42.5,-22.5,99.6980972290039],[42.5,-20.0,99.576171875],[42.5,-17.5,99.91871643066406],[42.5,-15.0,99.91871643066406],[42.5,-12.5,99.91871643066406],[42.5,-10.0,99.91871643066406],[42.5,-7.5,99.91871643066406],[42.5,-5.0,99.91871643066406],[42.5,-2.5,99.91871643066406],[42.5,0.0,99.91871643066406],[42.5,2.5,99.91871643066406],[42.5,5.0,99.91871643066406],[42.5,7.5,99.91871643066406],[42.5,10.0,99.91871643066406],[42.5,12.5,99.91871643066406],[42.5,15.0,99.91871643066406],[42.5,17.5,99.91871643066406],[42.5,20.0,99.91871643066406],[42.5,22.5,99.91871643066406],[42.5,25.0,99.91871643066406],[42.5,27.5,99.91871643066406],[42.5,30.0,99.6980972290039],[42.5,32.5,99.6980972290039],[42.5,35.0,99.47747039794922],[42.5,37.5,95.28564453125],[42.5,40.0,79.11054229736328],[42.5,42.5,0],[42.5,45.0,0],[42.5,47.5,0],[42.5,50.0,0],[42.5,52.5,0],[42.5,55.0,0],[45.0,-40.0,0.48769158124923706],[45.0,-37.5,2.984208106994629],[45.0,-35.0,5.950998783111572],[45.0,-32.5,18.37552261352539],[45.0,-30.0,46.71969223022461],[45.0,-27.5,72.3409194946289],[45.0,-25.0,90.66999816894531],[45.0,-22.5,95.45982360839844],[45.0,-20.0,99.23943328857422],[45.0,-17.5,99.77357482910156],[45.0,-15.0,99.91871643066406],[45.0,-12.5,99.91871643066406],[45.0,-10.0,99.91871643066406],[45.0,-7.5,99.91871643066406],[45.0,-5.0,99.91871643066406],[45.0,-2.5,99.91871643066406],[45.0,0.0,99.91871643066406],[45.0,2.5,99.91871643066406],[45.0,5.0,99.91871643066406],[45.0,7.5,99.91871643066406],[45.0,10.0,99.91871643066406],[45.0,12.5,99.91871643066406],[45.0,15.0,99.91871643066406],[45.0,17.5,99.91871643066406],[45.0,20.0,99.91871643066406],[45.0,22.5,99.91871643066406],[45.0,25.0,99.91871643066406],[45.0,27.5,99.7329330444336],[45.0,30.0,99.6980972290039],[45.0,32.5,99.70970916748047],[45.0,35.0,98.70529174804688],[45.0,37.5,85.90919494628906],[45.0,40.0,71.0171890258789],[45.0,42.5,0],[45.0,45.0,0],[45.0,47.5,0],[45.0,50.0,0],[45.0,52.5,0],[45.0,55.0,0],[47.5,-40.0,0.7721783518791199],[47.5,-37.5,1.1089178323745728],[47.5,-35.0,4.853692531585693],[47.5,-32.5,10.978866577148438],[47.5,-30.0,25.882490158081055],[47.5,-27.5,53.77960968017578],[47.5,-25.0,76.54435729980469],[47.5,-22.5,95.0766372680664],[47.5,-20.0,98.3046875],[47.5,-17.5,99.91871643066406],[47.5,-15.0,99.91871643066406],[47.5,-12.5,99.91871643066406],[47.5,-10.0,99.91871643066406],[47.5,-7.5,99.91871643066406],[47.5,-5.0,99.91871643066406],[47.5,-2.5,99.91871643066406],[47.5,0.0,99.91871643066406],[47.5,2.5,99.91871643066406],[47.5,5.0,99.91871643066406],[47.5,7.5,99.91871643066406],[47.5,10.0,99.91871643066406],[47.5,12.5,99.91871643066406],[47.5,15.0,99.91871643066406],[47.5,17.5,99.91871643066406],[47.5,20.0,99.91871643066406],[47.5,22.5,99.91871643066406],[47.5,25.0,99.91871643066406],[47.5,27.5,99.6980972290039],[47.5,30.0,99.6980972290039],[47.5,32.5,98.86205291748047],[47.5,35.0,95.51207733154297],[47.5,37.5,78.52415466308594],[47.5,40.0,57.34440231323242],[47.5,42.5,0],[47.5,45.0,0],[47.5,47.5,0],[47.5,50.0,0],[47.5,52.5,0],[47.5,55.0,0],[50.0,-40.0,0.9057129621505737],[50.0,-37.5,1.3875987529754639],[50.0,-35.0,4.60404109954834],[50.0,-32.5,9.138411521911621],[50.0,-30.0,18.601951599121094],[50.0,-27.5,40.46678924560547],[50.0,-25.0,70.18695068359375],[50.0,-22.5,88.26637268066406],[50.0,-20.0,97.7647476196289],[50.0,-17.5,99.44844055175781],[50.0,-15.0,99.91871643066406],[50.0,-12.5,99.91871643066406],[50.0,-10.0,99.91871643066406],[50.0,-7.5,99.91871643066406],[50.0,-5.0,99.91871643066406],[50.0,-2.5,99.91871643066406],[50.0,0.0,99.91871643066406],[50.0,2.5,99.91871643066406],[50.0,5.0,99.91871643066406],[50.0,7.5,99.91871643066406],[50.0,10.0,99.91871643066406],[50.0,12.5,99.91871643066406],[50.0,15.0,99.91871643066406],[50.0,17.5,99.91871643066406],[50.0,20.0,99.91871643066406],[50.0,22.5,99.91871643066406],[50.0,25.0,99.91871643066406],[50.0,27.5,99.70970916748047],[50.0,30.0,98.25824737548828],[50.0,32.5,97.45123291015625],[50.0,35.0,88.51021575927734],[50.0,37.5,71.06362915039062],[50.0,40.0,47.375755310058594],[50.0,42.5,0],[50.0,45.0,0],[50.0,47.5,0],[50.0,50.0,0],[50.0,52.5,0],[50.0,55.0,0],[52.5,-40.0,0.5631676912307739],[52.5,-37.5,1.480492353439331],[52.5,-35.0,4.5692057609558105],[52.5,-32.5,10.973060607910156],[52.5,-30.0,22.486066818237305],[52.5,-27.5,49.18717956542969],[52.5,-25.0,75.31351470947266],[52.5,-22.5,90.1881103515625],[52.5,-20.0,98.36274719238281],[52.5,-17.5,99.5123062133789],[52.5,-15.0,99.91871643066406],[52.5,-12.5,99.91871643066406],[52.5,-10.0,99.91871643066406],[52.5,-7.5,99.91871643066406],[52.5,-5.0,99.91871643066406],[52.5,-2.5,99.91871643066406],[52.5,0.0,99.91871643066406],[52.5,2.5,99.91871643066406],[52.5,5.0,99.91871643066406],[52.5,7.5,99.91871643066406],[52.5,10.0,99.91871643066406],[52.5,12.5,99.91871643066406],[52.5,15.0,99.91871643066406],[52.5,17.5,99.91871643066406],[52.5,20.0,99.91871643066406],[52.5,22.5,99.91871643066406],[52.5,25.0,99.6980972290039],[52.5,27.5,99.6980972290039],[52.5,30.0,99.02462005615234],[52.5,32.5,97.72991180419922],[52.5,35.0,90.19972229003906],[52.5,37.5,77.01463317871094],[52.5,40.0,55.143985748291016],[52.5,42.5,0.6676729917526245],[52.5,45.0,0],[52.5,47.5,0],[52.5,50.0,0],[52.5,52.5,0],[52.5,55.0,0],[55.0,-40.0,1.1669763326644897],[55.0,-37.5,3.942173719406128],[55.0,-35.0,9.382257461547852],[55.0,-32.5,23.92591667175293],[55.0,-30.0,47.74732971191406],[55.0,-27.5,69.82118225097656],[55.0,-25.0,82.14119720458984],[55.0,-22.5,93.55550384521484],[55.0,-20.0,99.14073181152344],[55.0,-17.5,99.5123062133789],[55.0,-15.0,99.91291046142578],[55.0,-12.5,99.91871643066406],[55.0,-10.0,99.91871643066406],[55.0,-7.5,99.91871643066406],[55.0,-5.0,99.91871643066406],[55.0,-2.5,99.91871643066406],[55.0,0.0,99.91871643066406],[55.0,2.5,99.91871643066406],[55.0,5.0,99.91871643066406],[55.0,7.5,99.91871643066406],[55.0,10.0,99.91871643066406],[55.0,12.5,99.91871643066406],[55.0,15.0,99.91871643066406],[55.0,17.5,99.91871643066406],[55.0,20.0,99.91871643066406],[55.0,22.5,99.91871643066406],[55.0,25.0,99.71551513671875],[55.0,27.5,99.6980972290039],[55.0,30.0,99.6980972290039],[55.0,32.5,99.46585845947266],[55.0,35.0,98.3685531616211],[55.0,37.5,92.1214599609375],[55.0,40.0,78.8028335571289],[55.0,42.5,0.899907112121582],[55.0,45.0,0.5631676912307739],[55.0,47.5,0],[55.0,50.0,0],[55.0,52.5,0],[55.0,55.0,0],[57.5,-40.0,6.125174045562744],[57.5,-37.5,13.417325019836426],[57.5,-35.0,27.868091583251953],[57.5,-32.5,49.761959075927734],[57.5,-30.0,67.48722839355469],[57.5,-27.5,82.98885345458984],[57.5,-25.0,91.07640838623047],[57.5,-22.5,98.81560516357422],[57.5,-20.0,99.70390319824219],[57.5,-17.5,99.91291046142578],[57.5,-15.0,99.91291046142578],[57.5,-12.5,99.91871643066406],[57.5,-10.0,99.91871643066406],[57.5,-7.5,99.91871643066406],[57.5,-5.0,99.91871643066406],[57.5,-2.5,99.91871643066406],[57.5,0.0,99.91871643066406],[57.5,2.5,99.91871643066406],[57.5,5.0,99.91871643066406],[57.5,7.5,99.91871643066406],[57.5,10.0,99.91871643066406],[57.5,12.5,99.91871643066406],[57.5,15.0,99.91871643066406],[57.5,17.5,99.91871643066406],[57.5,20.0,99.91871643066406],[57.5,22.5,99.91871643066406],[57.5,25.0,99.91871643066406],[57.5,27.5,99.8432388305664],[57.5,30.0,99.91871643066406],[57.5,32.5,99.78518676757812],[57.5,35.0,99.50650024414062],[57.5,37.5,99.30329895019531],[57.5,40.0,92.67301177978516],[57.5,42.5,1.4688806533813477],[57.5,45.0,0],[57.5,47.5,0],[57.5,50.0,0],[57.5,52.5,0],[57.5,55.0,0],[60.0,-40.0,18.387134552001953],[60.0,-37.5,27.014631271362305],[60.0,-35.0,50.725730895996094],[60.0,-32.5,70.99977111816406],[60.0,-30.0,86.67556762695312],[60.0,-27.5,95.26822662353516],[60.0,-25.0,99.14653778076172],[60.0,-22.5,99.80260467529297],[60.0,-20.0,99.86646270751953],[60.0,-17.5,99.91291046142578],[60.0,-15.0,99.91871643066406],[60.0,-12.5,99.91871643066406],[60.0,-10.0,99.91871643066406],[60.0,-7.5,99.91871643066406],[60.0,-5.0,99.91871643066406],[60.0,-2.5,99.91871643066406],[60.0,0.0,99.91871643066406],[60.0,2.5,99.91871643066406],[60.0,5.0,99.91871643066406],[60.0,7.5,99.91871643066406],[60.0,10.0,99.91871643066406],[60.0,12.5,99.91871643066406],[60.0,15.0,99.91871643066406],[60.0,17.5,99.91871643066406],[60.0,20.0,99.91871643066406],[60.0,22.5,99.91871643066406],[60.0,25.0,99.91871643066406],[60.0,27.5,99.91871643066406],[60.0,30.0,99.91871643066406],[60.0,32.5,99.91871643066406],[60.0,35.0,99.91871643066406],[60.0,37.5,98.8504409790039],[60.0,40.0,97.77055358886719],[60.0,42.5,3.9073386192321777],[60.0,45.0,0.6502554416656494],[60.0,47.5,0],[60.0,50.0,0],[60.0,52.5,0],[60.0,55.0,0],[62.5,-40.0,38.4811897277832],[62.5,-37.5,61.62912368774414],[62.5,-35.0,82.3734359741211],[62.5,-32.5,94.199951171875],[62.5,-30.0,97.77635955810547],[62.5,-27.5,98.71109771728516],[62.5,-25.0,99.91871643066406],[62.5,-22.5,99.91871643066406],[62.5,-20.0,99.91871643066406],[62.5,-17.5,99.91871643066406],[62.5,-15.0,99.91871643066406],[62.5,-12.5,99.91871643066406],[62.5,-10.0,99.91871643066406],[62.5,-7.5,99.91871643066406],[62.5,-5.0,99.91871643066406],[62.5,-2.5,99.91871643066406],[62.5,0.0,99.91871643066406],[62.5,2.5,99.91871643066406],[62.5,5.0,99.91871643066406],[62.5,7.5,99.91871643066406],[62.5,10.0,99.91871643066406],[62.5,12.5,99.91871643066406],[62.5,15.0,99.91871643066406],[62.5,17.5,99.91871643066406],[62.5,20.0,99.91871643066406],[62.5,22.5,99.91871643066406],[62.5,25.0,99.91871643066406],[62.5,27.5,99.91871643066406],[62.5,30.0,99.91871643066406],[62.5,32.5,99.91871643066406],[62.5,35.0,99.91871643066406],[62.5,37.5,99.91871643066406],[62.5,40.0,99.65745544433594],[62.5,42.5,5.596841812133789],[62.5,45.0,1.8114259243011475],[62.5,47.5,0.2786809206008911],[62.5,50.0,0],[62.5,52.5,0],[62.5,55.0,0],[65.0,-40.0,64.7004165649414],[65.0,-37.5,81.1309814453125],[65.0,-35.0,90.24036407470703],[65.0,-32.5,95.88945770263672],[65.0,-30.0,98.93753051757812],[65.0,-27.5,99.91871643066406],[65.0,-25.0,99.91871643066406],[65.0,-22.5,99.91871643066406],[65.0,-20.0,99.91871643066406],[65.0,-17.5,99.91871643066406],[65.0,-15.0,99.91871643066406],[65.0,-12.5,99.91871643066406],[65.0,-10.0,99.91871643066406],[65.0,-7.5,99.91871643066406],[65.0,-5.0,99.91871643066406],[65.0,-2.5,99.91871643066406],[65.0,0.0,99.91871643066406],[65.0,2.5,99.91871643066406],[65.0,5.0,99.91871643066406],[65.0,7.5,99.91871643066406],[65.0,10.0,99.91871643066406],[65.0,12.5,99.91871643066406],[65.0,15.0,99.91871643066406],[65.0,17.5,99.91871643066406],[65.0,20.0,99.91871643066406],[65.0,22.5,99.91871643066406],[65.0,25.0,99.91871643066406],[65.0,27.5,99.91871643066406],[65.0,30.0,99.91871643066406],[65.0,32.5,99.91871643066406],[65.0,35.0,99.91871643066406],[65.0,37.5,99.91871643066406],[65.0,40.0,99.91871643066406],[65.0,42.5,26.904319763183594],[65.0,45.0,7.5882487297058105],[65.0,47.5,0.8070134520530701],[65.0,50.0,0.12192289531230927],[65.0,52.5,0],[65.0,55.0,0],[67.5,-40.0,72.60218048095703],[67.5,-37.5,86.6233139038086],[67.5,-35.0,92.2956314086914],[67.5,-32.5,95.63400268554688],[67.5,-30.0,98.26985931396484],[67.5,-27.5,99.7909927368164],[67.5,-25.0,99.91871643066406],[67.5,-22.5,99.91871643066406],[67.5,-20.0,99.91871643066406],[67.5,-17.5,99.91871643066406],[67.5,-15.0,99.91871643066406],[67.5,-12.5,99.91871643066406],[67.5,-10.0,99.91871643066406],[67.5,-7.5,99.91871643066406],[67.5,-5.0,99.91871643066406],[67.5,-2.5,99.91871643066406],[67.5,0.0,99.91871643066406],[67.5,2.5,99.91871643066406],[67.5,5.0,99.91871643066406],[67.5,7.5,99.91871643066406],[67.5,10.0,99.91871643066406],[67.5,12.5,99.91871643066406],[67.5,15.0,99.91871643066406],[67.5,17.5,99.91871643066406],[67.5,20.0,99.91871643066406],[67.5,22.5,99.91871643066406],[67.5,25.0,99.91871643066406],[67.5,27.5,99.91871643066406],[67.5,30.0,99.91871643066406],[67.5,32.5,99.91871643066406],[67.5,35.0,99.91871643066406],[67.5,37.5,99.91871643066406],[67.5,40.0,99.91871643066406],[67.5,42.5,31.96121597290039],[67.5,45.0,19.594751358032227],[67.5,47.5,6.549001216888428],[67.5,50.0,0.16836971044540405],[67.5,52.5,0],[67.5,55.0,0],[70.0,-40.0,67.96331024169922],[70.0,-37.5,81.54900360107422],[70.0,-35.0,89.53205108642578],[70.0,-32.5,93.56130981445312],[70.0,-30.0,97.22480010986328],[70.0,-27.5,99.08267211914062],[70.0,-25.0,99.25104522705078],[70.0,-22.5,99.91871643066406],[70.0,-20.0,99.91871643066406],[70.0,-17.5,99.91871643066406],[70.0,-15.0,99.91871643066406],[70.0,-12.5,99.91871643066406],[70.0,-10.0,99.89549255371094],[70.0,-7.5,99.91871643066406],[70.0,-5.0,99.91871643066406],[70.0,-2.5,99.91871643066406],[70.0,0.0,99.91871643066406],[70.0,2.5,99.91871643066406],[70.0,5.0,99.91871643066406],[70.0,7.5,99.91871643066406],[70.0,10.0,99.91871643066406],[70.0,12.5,99.91871643066406],[70.0,15.0,99.91871643066406],[70.0,17.5,99.91871643066406],[70.0,20.0,99.91871643066406],[70.0,22.5,99.91871643066406],[70.0,25.0,99.91871643066406],[70.0,27.5,99.91871643066406],[70.0,30.0,99.91871643066406],[70.0,32.5,99.91871643066406],[70.0,35.0,99.91871643066406],[70.0,37.5,99.91871643066406],[70.0,40.0,99.91871643066406],[70.0,42.5,27.496517181396484],[70.0,45.0,18.387134552001953],[70.0,47.5,9.440316200256348],[70.0,50.0,2.757779836654663],[70.0,52.5,0.45285648107528687],[70.0,55.0,0],[72.5,-40.0,60.39828109741211],[72.5,-37.5,72.7995834350586],[72.5,-35.0,80.48072814941406],[72.5,-32.5,86.72782135009766],[72.5,-30.0,92.00534057617188],[72.5,-27.5,97.49187469482422],[72.5,-25.0,98.77496337890625],[72.5,-22.5,99.19298553466797],[72.5,-20.0,99.75035095214844],[72.5,-17.5,99.86065673828125],[72.5,-15.0,99.88968658447266],[72.5,-12.5,99.8780746459961],[72.5,-10.0,99.8780746459961],[72.5,-7.5,99.88968658447266],[72.5,-5.0,99.88968658447266],[72.5,-2.5,99.91871643066406],[72.5,0.0,99.91871643066406],[72.5,2.5,99.91871643066406],[72.5,5.0,99.91871643066406],[72.5,7.5,99.91871643066406],[72.5,10.0,99.91871643066406],[72.5,12.5,99.91871643066406],[72.5,15.0,99.91871643066406],[72.5,17.5,99.91871643066406],[72.5,20.0,99.91871643066406],[72.5,22.5,99.91871643066406],[72.5,25.0,99.91871643066406],[72.5,27.5,99.91871643066406],[72.5,30.0,99.91871643066406],[72.5,32.5,99.91871643066406],[72.5,35.0,99.91871643066406],[72.5,37.5,99.7909927368164],[72.5,40.0,99.33232879638672],[72.5,42.5,21.66744041442871],[72.5,45.0,15.606130599975586],[72.5,47.5,7.48954963684082],[72.5,50.0,2.9958198070526123],[72.5,52.5,1.2134231328964233],[72.5,55.0,0.48769158124923706],[75.0,-40.0,39.06177520751953],[75.0,-37.5,52.09010696411133],[75.0,-35.0,63.41732406616211],[75.0,-32.5,75.04644775390625],[75.0,-30.0,85.1718521118164],[75.0,-27.5,90.41453552246094],[75.0,-25.0,93.92707824707031],[75.0,-22.5,96.17394256591797],[75.0,-20.0,98.10729217529297],[75.0,-17.5,99.05364227294922],[75.0,-15.0,99.52391815185547],[75.0,-12.5,99.6690673828125],[75.0,-10.0,99.88968658447266],[75.0,-7.5,99.88968658447266],[75.0,-5.0,99.88968658447266],[75.0,-2.5,99.91871643066406],[75.0,0.0,99.91871643066406],[75.0,2.5,99.91871643066406],[75.0,5.0,99.91871643066406],[75.0,7.5,99.91871643066406],[75.0,10.0,99.91871643066406],[75.0,12.5,99.55294799804688],[75.0,15.0,99.44263458251953],[75.0,17.5,99.32652282714844],[75.0,20.0,99.21040344238281],[75.0,22.5,99.11170196533203],[75.0,25.0,99.17556762695312],[75.0,27.5,99.1813735961914],[75.0,30.0,99.1813735961914],[75.0,32.5,98.90269470214844],[75.0,35.0,98.99559020996094],[75.0,37.5,98.08406829833984],[75.0,40.0,95.71527862548828],[75.0,42.5,7.344403266906738],[75.0,45.0,5.341383934020996],[75.0,47.5,2.8913145065307617],[75.0,50.0,1.085694432258606],[75.0,52.5,0.42382723093032837],[75.0,55.0,0.11031119525432587]]

Distinguishing "mountains" from "valleys"

It appears that I seem to be not getting back "valleys" in the contourList. What I mean is that I get to polygons repeated at level 1, instead of a 1 ring and a 0 ring for a simple grid like this:

111
101
111

It is a bit difficult to explain in text, but does that make sense?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.