• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Calculating layer's CATransform3D transformations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calculating layer's CATransform3D transformations


  • Subject: Calculating layer's CATransform3D transformations
  • From: Kirill Kormiltsev <email@hidden>
  • Date: Wed, 09 May 2012 16:04:09 +0300

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 (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: Re: First Responder
  • Next by Date: architectures that prevent freezing
  • Previous by thread: Re: First Responder
  • Next by thread: architectures that prevent freezing
  • Index(es):
    • Date
    • Thread