Closed sktt closed 8 years ago
var pibp = require('point-in-big-polygon') var loop = [ [[-10,0], [10,0], [0, 10]], [[-5,2], [5,2], [0,7], [-5,2]] ] var classifyPoint = pibp(loop) //Render polygon test in ASCII to console var img = [] for(var y=-12; y<=12; y+=1) { var row = [] for(var x=-12; x<=12; x+=0.5) { var v = classifyPoint([x, y]) if(v < 0) { row.push('-') } else if(v === 0) { row.push('o') } else { row.push('+') } } img.push(row.join('')) } console.log(img.join('\n'))
2.0.0 Outputs:
++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++-----------------------------------------++++ ++++ooooooooooooooooooooooooooooooooooooooooo++++ ++++++o+++++++--------------------++++++++o++++++ ++++++++o+++++oooooooooooooooooooo++++++o++++++++ ++++++++++o+++++o+++++++++++++++o+++++o++++++++++ ++++++++++++o+++++o+++++++++++o+++++o++++++++++++ ++++++++++++++o+++++o+++++++o+++++o++++++++++++++ ++++++++++++++++o+++++o+++o+++++o++++++++++++++++ ++++++++++++++++++o+++++o+++++o++++++++++++++++++ ++++++++++++++++++++o+++++++o++++++++++++++++++++ ++++++++++++++++++++++o+++o++++++++++++++++++++++ ++++++++++++++++++++++++o++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++
1.0.0 outputs
++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++++++++++++++++++++++++++++++++++++++++++-++++ ++++ooooooooooooooooooooooooooooooooooooooooo++++ ++++++o-------++++++++++++++++++++--------o++++++ ++++++++o-----ooooooooooooooooooooo-----o++++++++ ++++++++++o-----o---------------o-----o++++++++++ ++++++++++++o-----o-----------o-----o++++++++++++ ++++++++++++++o-----o-------o-----o++++++++++++++ ++++++++++++++++o-----o---o-----o++++++++++++++++ ++++++++++++++++++o-----o-----o++++++++++++++++++ ++++++++++++++++++++o-------o++++++++++++++++++++ ++++++++++++++++++++++o---o++++++++++++++++++++++ ++++++++++++++++++++++++o++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++
Whats going on? :s Am I just doing it wrong?
2.0.0 Outputs:
1.0.0 outputs
Whats going on? :s Am I just doing it wrong?