Forceflow / cuda_voxelizer

CUDA Voxelizer to convert polygon meshes into annotated voxel grids
MIT License
583 stars 97 forks source link

Wrong axis order for Equation 2 for ZX plane (d_xz_ei) in voxelize.cu #62

Closed Gornhoth closed 2 years ago

Gornhoth commented 2 years ago

I think I noticed something I think is slightly off in the implementation of equation 2 (second part where one calculates d) inside voxelize.cu in lines 131 - 133. For each edge projection into the ZX plane there is written: float d_xz_ei = (-1.0f * glm::dot(n_zx_ei, glm::vec2(v0.z, v0.x))) + glm::max(0.0f, info.unit.x*n_zx_ei[0]) + glm::max(0.0f,info.unit.z*n_zx_ei[1]); but shouldnt the supplied axis to each max function actually be the same order as the previous two plane projections? For example XY where the first call to max has the first axis X like info.unit.x * n_xy_ei[0] and the second call to max has the second axis Y like info.unit.y * n_xy_ei[1]. For the ZX axis this would look like: float d_xz_ei = (-1.0f * glm::dot(n_zx_ei, glm::vec2(v0.z, v0.x))) + glm::max(0.0f, info.unit.z*n_zx_ei[0]) + glm::max(0.0f,info.unit.x*n_zx_ei[1]); I think for the end product it does not matter currently as info.unit.x/y/z are the same at the moment (gridSize in main.cpp) but technically it is still wrong, or am i missing something here?

conceptclear commented 2 years ago

您好,您的邮件我已收到并会尽快回复,祝好

Forceflow commented 2 years ago

@Gornhoth I think you might be on to something. Need to re-read the Schwarz & Seidel paper for this, but what you say seems logical. This has probably gone unspotted since non-cubical grids have indeed not been officially supported :)

Forceflow commented 2 years ago

I've fixed this in dev branch. Will make new release later.

Forceflow commented 2 years ago

Fixed in latest release.