Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

've just started building a physical camera class for the depth data you get from a Kinect. I have a Vector3 array of [imageWidth, imageHeight] describing the LOCAL positions I get in from the kinect (once I project them back at the FOV of the camera lens etc). I then translate, scale and rotate the whole virtual kinect camera in space.

What I'm looking to do is to extract back again the positions of the kinect camera input but in WORLD space, not LOCAL space (i.e. it's gone through the translation, scale and rotation and gives me a Vector3 for each value of the kinect in WORLD space).

Any ideas?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

I have never worked with Kinect so I'm not aware if there are any specific details I'm missing, but have you tried creating a regular world matrix and transforming the local position with it? Something like this for example:

Matrix worldMatrix = Matrix.CreateScale(scale) * 
                     Matrix.CreateFromQuaternion(rotation) *
                     Matrix.CreateTranslation(translation);

Vector3 worldPosition = Vector3.Transform(localPosition, worldMatrix);

Notes: For the rotation matrix you can also use CreateFromYawPitchRoll or CreateFromAxisAngle depending on your needs. Also, this assumes that scaling and rotation happens around the origin of the current space.

share|improve this answer
    
That worked an absolute treat! Thank you David!! –  stuartwoodrandom Feb 2 '12 at 14:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.