# Get the camera transformation matrix (Camera pose, not view matrix)

Let's say that I have an object and a camera (its representation) in a 3D world coordinate system. I have the camera pose to see the object (rotation matrix and translation (eye position)). If I apply a transform matrix to the object (a certain scaling/translation/rotation), what do I need to find the correct transform matrix that'll move my camera pose in order that what the camera sees remain unchanged (like it was before the transform was applied on the object)? I can't just apply the same transform as the object (it'll work for a translation, but rotation will cause to lose its target...). Also, a restriction that I have is that I can't apply transforms directly on the world, only on the object itself and on the camera itself (rotation/scaling/translation about the world coordinate system center).

Thanks to anyone that will takes time to help me! (Sorry for grammar errors, I speak French)

Marc-Antoine

• Should I apply the object's transform to the target point and to a given vector between the camera eye point and target point, then I'll get my new target and my new camera eye point (which is the end of my new vector)? Will that be enough information to setup the camera pose properly? – whippet Jul 3 '15 at 16:48
• If your rotation is about the center of the object, then applying this rotation to the camera (rotating the camera about the center of the object) will not change what the camera sees. It seems to me that if your object is at the origin, and the transformation is applied with rotation/reflection first, then translation, the same transformation may be applied to the camera as well. – pjs36 Jul 3 '15 at 16:58

I'm on the right track now, I did as I've suggest earlier :

Should I apply the object's transform to the target point and to a given vector between the camera eye point and target point, then I'll get my new target and my new camera eye point (which is the end of my new vector)? Will that be enough information to setup the camera pose properly?

but I've also applied the transform to the up-vector of the camera to get it right. Result: for any kind of translation/rotation applied to the object the camera move properly (Yeah!). The only problem that remains is when I scale the object. If I shrink it, it gets smaller in the camera view after the transform is applied (and vice-versa).

• Nice! If your object's size changes by a factor of $k$, so must the distance between your object and the camera, in order to maintain the camera's perception of the object. e.g., if your object shrinks by a factor of $2$, your camera needs to get twice as close; translate it towards the object half of the original distance. – pjs36 Jul 4 '15 at 17:47

I suspect your issue is that you're really thinking of rotating both the object and camera about their respective centers - this is not applying the same rotation, hence transformation, to each. If you do apply the same rotation (in the same plane, about the same point) and translation to each, this is an affine transformation, which

preserves points, straight lines and planes [...].

In particular, it will preserve the straight line connecting the camera to the object.

Take, for example, the wheel of a bicycle as it moves. A point on the rim is always 'facing' (and at a constant distance from) the axle, while constantly being subjected to rotations (about the axle) and translations (as the bicycle moves forward). In the camera setting, this reflects the fact that the same rotation about the object can be applied to both object and camera, while preserving the camera's view of the object.

The same can be said of the two endpoints of a spoke: the same linear transformation is applied to each endpoint, and the same spoke (line of sight) connects both endpoints, as the entire wheel is transformed. This rotation is not about either endpoint of the spoke, and still the same transformation applied to both preserves the spoke. This corresponds to a rotation about a point that is neither the camera nor object, along with a translation. Still the line of sight (spoke) is preserved.

• Okay, but I have to precise a little my problem. I'm in a restricted environment that only allows me to set rotation/translation/scaling for the object and the camera pose separately about their respective centers (position is about the world coordinate system center, but not rotation/scaling). How can I proceed to get the equivalent transform to apply on the camera? – whippet Jul 3 '15 at 17:46
• I see, let me think about that then. You may want to edit that into your original post, as it's an important restriction. – pjs36 Jul 3 '15 at 18:00
• Yes, good idea. – whippet Jul 3 '15 at 18:01
• I made a mistake : they are rotating/scaling/moving about the world coordinate center, (but I still only can apply transforms to these two elements separately) – whippet Jul 3 '15 at 18:55