fauxgl
fauxgl copied to clipboard
How feasible is Mesh => []Voxel conversion?
Have you considered providing a func (m *Mesh) ToVoxels(box Box, nx, ny, nz int) []Voxel
where nx, ny, and nz are the number of voxels in the X, Y, and Z directions (enclosed by the provided bounding box)?
That way, a mesh could be voxelized at any desired resolution by subdividing the conversion into smaller boxes and recombining them later.
I think I have some code elsewhere in another codebase that does that already, I'll have to dig it up.
Haven't had time yet, but the code is here:
https://github.com/fogleman/ln/blob/master/ln/mesh.go#L85-L107
Thank you, @fogleman!