Closed ashishgupta2598 closed 4 years ago
See pull request #11 . If you are using python 3, you need to fix the division to the correct integer division operator. The coordinates returned by read_as_coord_array
should be the indices of each vox in 3D.
I'll reply your question here. The indices are just integer indices of the voxels. So for a 32 by 32 by 32 model, the indices i,j,k will be from 0 to 31. They just represent the indices of each voxel in the model.
To find all 8 vertices of a voxel, you can do something like this:
# lower left corner
x_n = i/dims[0]
y_n = j/dims[1]
z_n = k/dims[2]
x = scale*x_n + translate[0]
y = scale*y_n + translate[1]
z = scale*z_n + translate[2]
# upper right corner
x_n = (i+1)/dims[0]
y_n = (j+1)/dims[1]
z_n = (k+1)/dims[2]
x = scale*x_n + translate[0]
y = scale*y_n + translate[1]
z = scale*z_n + translate[2]
# and do something similar for the other 6 ...
Got it. Thanks a lot. You literally save my work.
On Mon, 18 Nov 2019, 11:54 p.m. Jingnan Shi <notifications@github.com wrote:
I'll reply your question here. The indices are just integer indices of the voxels. So for a 32 by 32 by 32 model, the indices i,j,k will be from 0 to
- They just represent the indices of each voxel in the model.
To find all 8 vertices of a voxel, you can do something like this:
lower left corner
x_n = i/dims[0] y_n = j/dims[1] z_n = k/dims[2] x = scalex_n + translate[0] y = scaley_n + translate[1] z = scale*z_n + translate[2]
upper right corner
x_n = (i+1)/dims[0] y_n = (j+1)/dims[1] z_n = (k+1)/dims[2] x = scalex_n + translate[0] y = scaley_n + translate[1] z = scale*z_n + translate[2]
and do something similar for the other 6 ...
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dimatura/binvox-rw-py/issues/10?email_source=notifications&email_token=AJVES2WYKG7LFY3C47W4WZDQULMWPA5CNFSM4JODVBQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEELNOMQ#issuecomment-555145010, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJVES2URDQQP4M623CB7DSTQULMWPANCNFSM4JODVBQQ .
This might also help you: https://www.patrickmin.com/binvox/binvox.html I'm glad I can help.
Thanks a lot for this also.
On Mon, 18 Nov 2019, 11:59 p.m. Jingnan Shi <notifications@github.com wrote:
This might also help you: https://www.patrickmin.com/binvox/binvox.html I'm glad I can help.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dimatura/binvox-rw-py/issues/10?email_source=notifications&email_token=AJVES2QZWNJ4EUXLF3KB3CDQULNJXA5CNFSM4JODVBQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEELN7NI#issuecomment-555147189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJVES2X3IV3ZOGRTA2CEQALQULNJXANCNFSM4JODVBQQ .
What are these x,y,z coordinates locations, outputting by
binvox_rw.read_as_coord_array(f)
function. Are they mid point of any voxel or any vertices of a particular voxel. I want to find all the 8 vertices of a voxel. So please let me know the conversion formulas.