Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

namanhams

macrumors regular
Original poster
Jun 3, 2009
153
0
Let say i have 2 CALayer objects with same parent layer, same frame value. Each of them has their own 'transform' value. So basically we have 2 3D spaces.
Let say i hava point, with coordinate (x, y, z) in first space.
How do i find out its coordinate in the second space ?

Thanks.
 
1. Apply inverse transform of first space.
2. Apply transform of second space.

If you understand what a transform is and what it does, you'll understand why this works. If you don't, you won't, and you should study transforms more.
 
1. Apply inverse transform of first space.
2. Apply transform of second space.

If you understand what a transform is and what it does, you'll understand why this works. If you don't, you won't, and you should study transforms more.


Can you be more specific ? Eg, what's the transform that is applied to 2nd space ?
 
Can you be more specific ? Eg, what's the transform that is applied to 2nd space ?

It's exactly what I wrote: the transform of the second space. You said each space has a transform. So the transform of the second space is the transform that belongs to (is used by) the second space. I don't know how to make it any plainer or more specific.

Again, if you don't understand how transforms work, that is, what transforms actually do, then you should study them more. Sit down with a good book on 2D or 3D graphics, learn how simply transforms like translation work, make some drawings on graph paper, and learn the basic mathematics. If you don't understand how transforms work, how do you expect to use them effectively? You can't expect to understand what strings are (sequences of characters) without knowing what characters are.
 
It's exactly what I wrote: the transform of the second space. You said each space has a transform. So the transform of the second space is the transform that belongs to (is used by) the second space. I don't know how to make it any plainer or more specific.

Again, if you don't understand how transforms work, that is, what transforms actually do, then you should study them more. Sit down with a good book on 2D or 3D graphics, learn how simply transforms like translation work, make some drawings on graph paper, and learn the basic mathematics. If you don't understand how transforms work, how do you expect to use them effectively? You can't expect to understand what strings are (sequences of characters) without knowing what characters are.

Uhm. I'm not sure i know what you mean.

So for the first layer, if we apply an inverse transform, it's equivalent to setting the transform of the first layer to identity transform. Am i right ?

"So the transform of the second space is the transform that belongs to (is used by) the second space"

Of course it is. Then what do you mean by applying this transform to 2nd layer ? It's already the transform of the 2nd layer, rite ?


It would be helpful if you can give some hint regarding my question : how to convert the coordinate of a 3D point between 2 space ?
 
It would be helpful if you can give some hint regarding my question : how to convert the coordinate of a 3D point between 2 space ?

Learn the mathematics of transforms. If you understand that, you can answer the question yourself, simply by working through the inverse transform and the 2nd transform manually. If you don't understand the mathematics at a practical level, nothing I can say is going to help you understand them better than studying them. You may think there's an easy answer, but there isn't. Understanding the mathematics of transforms is essential to understanding transforms.

There's only one simplification I know of: if you understand 2D transforms at a practical level, then 3D transforms are easy to grasp. Since 2D transforms are simpler (fewer elements in a transform) and easier to draw on graph paper, start by learning exactly how 2D transforms work. After mastering them, move on to 3D transforms.
 
Last edited:
Learn the mathematics of transforms. If you understand that, you can answer the question yourself, simply by working through the inverse transform and the 2nd transform manually. If you don't understand the mathematics at a practical level, nothing I can say is going to help you understand them better than studying them. You may think there's an easy answer, but there isn't. Understanding the mathematics of transforms is essential to understanding transforms.

There's only one simplification I know of: if you understand 2D transforms at a practical level, then 3D transforms are easy to grasp. Since 2D transforms are simpler (fewer elements in a transform) and easier to draw on graph paper, start by learning exactly how 2D transforms work. After mastering them, move on to 3D transforms.

Ok i know mathematics and i know what transform and transformation matrix is.
What you say is right, but i need some hint to this question.
 
I think chown33 has given you more than just hints, he's given you pseudo-code. It's now up to you to convert that pseudo-code into real code.

Actually i have found a way, but not that straight forward.
It's because we need to take into account the anchorPoint and anchorPointZ of the CALayer also.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.