mikolalysenko / isosurface

Isosurface polygonizer algorithms
MIT License
187 stars 31 forks source link

'scale' is not correct #3

Open stla opened 5 years ago

stla commented 5 years ago

Hello,

scale should be (bounds[1][i] - bounds[0][i]) / (dims[i]-1); instead of (bounds[1][i] - bounds[0][i]) / dims[i];

Try for instance

var mesh = isosurface.surfaceNets([64,64,64], function(x,y,z) {
  return x*x + y*y + z*z - 1
}, [[-1,-1,-1], [1,1,1]])

This gives a truncated ball. Whereas the ball is perfect with dims[i]-1.

stla commented 5 years ago

Another remark: n is not used in surfacenets.js.