cuda_voxelizer
cuda_voxelizer copied to clipboard
Point Cloud generation matching between input and output files.
Hello all,
I found a workaround but I do not know if its intended to be an issue or not.
I you try to input a mesh file and generate a pointcloud, the resulting pointcloud would have the same dimensions but not the same center of the input mesh. This is because of the createMeshBBCube
function in the utils.h
file.
When you try to scale the two non-maximum dimensions to math the largest one, it creates a grid where it matches only with the largest dimension.
To do workaround, I decided to make the scaling go only on the max point of the input bounding box.
float delta = max_length - lengths[i]; // compute difference between largest length and current (X,Y or Z) length
//answer.min[i] = box.min[i] - (delta / 2.0f); // don't pad in the min direction
answer.max[i] = box.max[i] + (delta); // pad with difference behind current max
this ensures that when I use the voxelization_info.unit
vector to scale back the resulting pointcloud to original dimensions, the scaling is correct.
I do not know if this should be done pre or post voxelization, I decided to do it before.
I do not know if the double-sided sacling was preferred to preserve the center of the mesh, but by using it we can only preserve dimensions and lose center, or preserve center and lose dimensions.
So if anyone is trying to use this code to check if a point in a uniform grid is inside or outside the input mesh, this modification is necessary I think.
I also noticed instability if the input mesh has small dimensions (e-3 magnitude), but that's a different issue and I wrote about it in the solid voxelization issue thread.
Looking into this. I'm currently rewriting the project to ditch the GLM requirement, which should improve code readability and maybe reduce some numerical instabilities.
您好,您的邮件我已收到并会尽快回复,祝好