ramakarl / voxelizer

Voxelization of a triangle in 3D. Pure math demo.
Other
30 stars 1 forks source link

DDA does not seem work? #2

Open aentity opened 2 years ago

aentity commented 2 years ago

@ramakarl in other issue you ask for vertices, for these:

    Vector3DF(
        0.0,
        -20.81406,
        8.171592
    ),
    Vector3DF(
        0.0,
        -14.862897,
        -13.38261
    ),
    Vector3DF(
        20.0,
        0.0,
        0.0
    )

it seems clear that d1 will be invalid, as we will divide by 0 here: https://github.com/ramakarl/voxelizer/blob/master/math_voxelizer/main_voxelizer.cpp#L237

have you tested this by rotating the triangle about the planes using quaternions on every axis?

Dimension4 commented 10 months ago

Just ran into this issue, too. Triangle coordinates are

[0]: {51.7321903761628, 6.135542782570875, -55.063580406614726}
[1]: {51.62424037616284, 6.1941068919916935, -55.09661639885565}
[2]: {51.6242403761628, 6.135542782570935, -55.06358040661471}

and space bounds are

m_vmin = {-33.56288012881984, -4.107472231053617, -193.37669756689073}
m_vmax = {149.19836501802786, 19.888678754569305, 24.251550699393917}
m_vres = {367, 49, 437}