6 Replies Latest reply on Jan 18, 2010 8:44 PM by unique_screenname_here

# 3d Rotation around an Arbitary Point?

Hello,

I want to rotate an image around an arbitary point (presumably the center) in 3d. Even though, I couldn't figure out the 3d matrix so that the final pixel is sampled based on it's 2d location to a point in the source image. Any help is highly appreciated. Thank you!

• ###### 1. Re: 3d Rotation around an Arbitary Point?

Use 4d matrix:

................................................

float4x4 transformMatrix;

...............................................

float3 newCoord = (transformMatrix * float4(coord.x, coord.y, coord.z, 1.0)).xyz;

see rotation matrices in three dimensions

http://en.wikipedia.org/wiki/Rotation_matrix

• ###### 2. Re: 3d Rotation around an Arbitary Point?

Hello,

Thank you for replying.

Yes, I have no problem in getting the transformed 3d point, but how do I make it sample a pixel from the source image?

• ###### 3. Re: 3d Rotation around an Arbitary Point?

Then it is necessary to use a camera transformations matrix.

• ###### 4. Re: 3d Rotation around an Arbitary Point?

I tried using it, but I couldn't figure out properly. Could you please attach a sample kernel?

Thank you!

• ###### 5. Re: 3d Rotation around an Arbitary Point?

If there would be....

Look examples for OpenGL on the Internet

• ###### 6. Re: 3d Rotation around an Arbitary Point?

Take a look at the following Pixel Bender filters, written by Tom Beddard, for examples of how to do this.

Mandelbulb ray tracer