fauxgl icon indicating copy to clipboard operation
fauxgl copied to clipboard

How feasible is Mesh => []Voxel conversion?

Open gmlewis opened this issue 9 years ago • 3 comments

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.

gmlewis avatar May 05 '17 06:05 gmlewis

I think I have some code elsewhere in another codebase that does that already, I'll have to dig it up.

fogleman avatar May 05 '17 14:05 fogleman

Haven't had time yet, but the code is here:

https://github.com/fogleman/ln/blob/master/ln/mesh.go#L85-L107

fogleman avatar May 07 '17 01:05 fogleman

Thank you, @fogleman!

gmlewis avatar May 07 '17 02:05 gmlewis