Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What the x,y,z coordinates locations denotes (mid point of voxel or anything else)? #10

Closed
ashishgupta2598 opened this issue Nov 16, 2019 · 5 comments

Comments

@ashishgupta2598
Copy link

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.

@jingnanshi
Copy link

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.

@jingnanshi
Copy link

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 ...

@ashishgupta2598
Copy link
Author

ashishgupta2598 commented Nov 18, 2019 via email

@jingnanshi
Copy link

This might also help you: https://www.patrickmin.com/binvox/binvox.html I'm glad I can help.

@ashishgupta2598
Copy link
Author

ashishgupta2598 commented Nov 18, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants