Reputation: 2493
I know that the CATransform3D is defined as
struct CATransform3D
{
CGFloat m11, m12, m13, m14;
CGFloat m21, m22, m23, m24;
CGFloat m31, m32, m33, m34;
CGFloat m41, m42, m43, m44;
};
and the Apple document says that
CATransform3DTranslate
Translate 't' by '(tx, ty, tz)' and return the result: t' = translate(tx, ty, tz) * t.
I want to implement my CATransform3DTranslate method, but I don't know exactly how to calculate the t', i.e. I have the transform like self.layer.transform
, and tx = 10, ty=tz=0, how to calculate get the t'?
Upvotes: 1
Views: 2516
Reputation: 3699
You don't have to. You just use CATransform3dMakeTranslation method on a layer, you set the input values and game! CATransform3dMakeTranslation (like CATransform3DMakeRotation) will do all the math tho have a rototranslation matrix of coordinate change. You don't have to worry about the matrix itself if all you want is to translate/rotate/rototranslate a layer in the 3d space.
Upvotes: 4