Monday, July 18, 2005

Conversion to voxel coordinates

The dimensions of the volume is 512*512*361

The cast_ray_for_one_pixel() in vr.cpp has commands to convert a point to the voxel coordinates.

C_FPosition point, local;
int voxel_x,voxel_y,voxel_z;

local.x=point.x*scale.x();
local.y=point.y*scale.y();
local.z=point.z*scale.z();

voxel_x = int(local.x);
voxel_y = int(local.y);
voxel_z = int (local.z);

voxel_x, voxel_y and voxel_z are presumably the voxel coordinates.

scale.x() = 1.422
scale.y() = 1.422
scale.z() = 1.0

So for the four points we have

ll2.x=ll.x*scale.x(); ll2.y=ll.y*scale.y();ll2.z=ll.z*scale.z();
vll.x=int(ll2.x);vll.y=int(ll2.y);vll.z=int(ll2.z);

ul2.x=ul.x*scale.x(); ul2.y=ul.y*scale.y();ul2.z=ul.z*scale.z();
vul.x=int(ul2.x);vul.y=int(ul2.y);vul.z=int(ul2.z);

ur2.x=ur.x*scale.x(); ur2.y=ur.y*scale.y();ur2.z=ur.z*scale.z();
vur.x=int(ur2.x);vur.y=int(ur2.y);vur.z=int(ur2.z);

lr2.x=lr.x*scale.x(); lr2.y=lr.y*scale.y();lr2.z=lr.z*scale.z();
vlr.x=int(lr2.x);vlr.y=int(lr2.y);vlr.z=int(lr2.z);

0 Comments:

Post a Comment

<< Home