Nice One. I am very pleased to find this implementation, it will help me a lot... ...But, have you ever heard of code conventions? :D Plus, some klugdes (e.g: sg = ~(arr)) won't even compile on netBeans. But, hey, great to have some computer-hero stuff. Thank you.
Excellent meshing algorithm. perfect replacement for marching cubes