Hello,

the questions are:
1. What equations are used to transform CALayers in 3D space and project their 
2d point {x, y, z} to the 2D surface {x, y} ?

All equations that I've found to project 3D points onto 2D space aren't the 
same with what CALayers use.
My solve is to get one coordinate {x, y} where -1 < x < 1 and -1 < y < 1   and, 
using 3D affine transforms, apply layer's transforms to point and then make it 
2D:
CGFloat pointX = transformPCM.m11 * point.m1 + transformPCM.m12 * point.m2 + 
transformPCM.m13 * point.m3 + transformPCM.m14 * point.m4;
CGFloat pointY = transformPCM.m21 * point.m1 + transformPCM.m22 * point.m2 + 
transformPCM.m23 * point.m3 + transformPCM.m24 * point.m4;
CGFloat pointZ = transformPCM.m31 * point.m1 + transformPCM.m32 * point.m2 + 
transformPCM.m33 * point.m3 + transformPCM.m34 * point.m4;

CGFloat newX = (pointX) / (pointZ);
CGFloat newY = (pointY) / (pointZ);

2. What is m34 parameter of CATransform3D struct? I understood that it is for 
translating point by z axis just like m24 for y axis and m14 for x axis, 
BUT!...  in equations from above it doesn't make any sense, whereas CALayer's 
transformation is being changed according to zDistance (m34 = 1 / (-zDistance) 
as Apple Core Animation documentation says)

Any advice would be helpful)

Thank you,
Kirill
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to