John,

You're rotating layer around Y axis by 2.12041 which is greater than PI/2. So after rotation you're looking at the "back side" of the layer, that's why X and Z get close to PI (i.e. flipped).

- Dmitri

On Jul 14, 2008, at 8:57 PM, John Clayton wrote:

Hi All,

I'm setting the rotation values of a CALayer, and notice that when setting the Y component of rotation of a CATransform3D structure via the :
        [layer setValue:someValue forKeyPath:@"transform.rotation.y"]

call, that in certain cases of 'someValue' (the y rotation), the X and Z rotation values are modified as well.

I set the value of the transform.rotation.Y using the standard setValue:forKeyPath: method, and logged the resulting X, Y and Z rotation values. Here's the code and logging results:

- (void) awakeFromNib {
        CALayer* testLayer = [CALayer new];
        NSLog(@"before: x, y, x = %@ / %@ / %@",
                  [testLayer valueForKeyPath:@"transform.rotation.x"],
                  [testLayer valueForKeyPath:@"transform.rotation.y"],
                  [testLayer valueForKeyPath:@"transform.rotation.z"]);

        // but this breaks the X and Z, how come?
[testLayer setValue:[NSNumber numberWithDouble:2.12041] forKeyPath:@"transform.rotation.y"];
        NSLog(@"after: x, y, x = %@ / %@ / %@",
                  [testLayer valueForKeyPath:@"transform.rotation.x"],
                  [testLayer valueForKeyPath:@"transform.rotation.y"],
                  [testLayer valueForKeyPath:@"transform.rotation.z"]);

        [testLayer release];
}

2008-07-14 17:48:23.555 Annotate[42997:10b] before: x, y, x = 0 / -0 / 0 2008-07-14 17:48:23.562 Annotate[42997:10b] after: x, y, x = 3.141593 / 1.021183 / 3.141593

Huh?

Question 1: Why do X and Z get very close to PI?
Question 2: Why does Y end up being 1.02 when I set it to 2.12041?

Does anyone know what's going on here? I'm a little stumped by this one.

Thanks
--
John Clayton
Skype: johncclayton


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to