This morning, I made some adjustments to the voxelization. we needed to be able to support obj files that weren’t exactly to scale or centered. I had to make some changes to the obj file reading method.
First thing was to get the cuboid that our object would fit in in order to find the center of the image we had to display. The way we did that was by finding the vectors with the max and min of each coordinate and we could deduce the vector we needed to substract to every other vector in order to center the image.
Next was resizing the image. For this, we need to find the smallest cylinder that the object could fit in. We therefor need to find the furthest point from the center on the XY plane and find the height (which is easily taken from the max and min Z-axis values taken for the centering process).
With h the height of the object and H the max height displayed by LitSpin, same with r the radius : we take the maximum of h/H and r/R and divide every vector by this number.This gives us an object that is exactly the right size to be displayed.
That is the theory. When testing, we found that the highest row was never used and even worse, when it was used it was by voxels that should be displayed at the bottom. We believe that the issue comes from the voxelizing algorithm. Salomé will take a look at it soon and try to figure out what the issue is.