Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > OpenGL 3D API > Re: Voxel rotat...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 4809 of 5017
Post > Topic >>

Re: Voxel rotations

by Paul Geisler <paul.geisler@[EMAIL PROTECTED] > Jun 27, 2008 at 01:56 AM

Jeremy schrieb:
> I am looking for an algorithm to rotate a set of voxels in 3d.

Just get three base vectors (the upper 3x3 of the transform matrix).
Then you can iterate through your original data

pseudocode,

given:
3d array  voxel[x,y,z],
Vector3f base_x,
Vector3f base_y,
Vector3f base_z

returns:
3d array  voxel_new[x,y,z]



Vector3f pos_x=0,0,0
	 pos_xy, pos_xyz

for x=0 to x_max
{	
	pos_x=pos_x+base_x
	pos_xy=pos_x

	for y=0 to y_max
	{
		pos_xy=pos_xy+base_y
		pos_xyz=pos_xy

		for z=0 to z_max
		{
			pos_xyz=pos_xyz+base_z
			
			voxel_new[x,y,z] := voxel[pos_xyz.x, pos_xyz.y, pos_xyz.z]
		}
	}
}



maybe its an good idea to do this in GLSL to use GPU power for this. but
you can try plain c first.


hope it helps a litte

paul
 




 2 Posts in Topic:
Voxel rotations
Jeremy <jmabie21@[EMAI  2008-06-26 15:09:35 
Re: Voxel rotations
Paul Geisler <paul.gei  2008-06-27 01:56:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 5:53:44 CST 2008.