FROM : Bill Dudney
DATE : Thu Feb 07 13:18:25 2008
Hi Devon,
It is typical for the vector that is rotated about to be a 'unit
vector', not necessary but typical. The matrix you create here rotates
about the vector from the origin to the point {20, 2.5, 1}, given the
scale its more or less along the x axis that the rotation is
happening. (normalize the vector with {x, y, z} / sqrt(x^2 + y^2 +
z^2) => {20, 2.5, 1} / sqrt(400 + 6.25 + 1) => {0.991, 0.309, 0.050})
The red book on OpenGL is a great resource. You can find a version of
it here;
http://www.opengl.org/documentation/red_book/
I'm not sure how much of the free online version pertains to OpenGL
2.1 but the concepts of the 3D transformations have not changed since
before there was an OpenGL.
Also, it would be most helpful to the rest of the people getting
started if you were to file a bug against the docs WRT the
transformation stuff;
http://bugreporter.apple.com
And provide some specific suggestions that would make the docs better
for you and others getting started. Or hit the 'It was not helpful'
link at the bottom of the doc and file the bug there.
Good luck and Hope this helps.
TTFN,
-bd-
http://bill.dudney.net/roller/objc
On Feb 7, 2008, at 12:44 AM, Mac Man wrote:
> I've been working on a perspective transform to get a rectangular
> image to
> look like the Dock in Leopard (3D perspective look), and I've got the
> following code working to at least change the angle of the rectangle:
>
> NSView *contentView = [mainWindow contentView];
>
> CALayer *myLayer = [CALayer layer];
>
> myLayer.contents = [NSImage imageNamed:@"test.png"];
>
> myLayer.transform = CATransform3DMakeRotation(-.75,20,2.5,1);
>
> [contentView setLayer:myLayer];
>
> [contentView setWantsLayer:YES];
>
>
> The above code has the appropriate connections in Interface Builder,
> of
> course. The values I entered for CATransform3DMakeRotation are
> arbitrary, I
> just don't understand enough of the math behind it to make any
> sense. I've
> googled perspective transformation matrices as suggested in a
> different
> thread, but the values presented there didn't help at all. Am I
> missing
> something really simple with regards to CATransform3DMakeRotation?
> The
> Apple documentation for the CATransform family in general is really
> lacking,
> especially for people like me who don't have a background in graphics
> programing and heavier math!
>
>
> Any help anyone can provide in clearing things up for me would be
> greatly
> appreciated!
>
>
> Devon
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>
DATE : Thu Feb 07 13:18:25 2008
Hi Devon,
It is typical for the vector that is rotated about to be a 'unit
vector', not necessary but typical. The matrix you create here rotates
about the vector from the origin to the point {20, 2.5, 1}, given the
scale its more or less along the x axis that the rotation is
happening. (normalize the vector with {x, y, z} / sqrt(x^2 + y^2 +
z^2) => {20, 2.5, 1} / sqrt(400 + 6.25 + 1) => {0.991, 0.309, 0.050})
The red book on OpenGL is a great resource. You can find a version of
it here;
http://www.opengl.org/documentation/red_book/
I'm not sure how much of the free online version pertains to OpenGL
2.1 but the concepts of the 3D transformations have not changed since
before there was an OpenGL.
Also, it would be most helpful to the rest of the people getting
started if you were to file a bug against the docs WRT the
transformation stuff;
http://bugreporter.apple.com
And provide some specific suggestions that would make the docs better
for you and others getting started. Or hit the 'It was not helpful'
link at the bottom of the doc and file the bug there.
Good luck and Hope this helps.
TTFN,
-bd-
http://bill.dudney.net/roller/objc
On Feb 7, 2008, at 12:44 AM, Mac Man wrote:
> I've been working on a perspective transform to get a rectangular
> image to
> look like the Dock in Leopard (3D perspective look), and I've got the
> following code working to at least change the angle of the rectangle:
>
> NSView *contentView = [mainWindow contentView];
>
> CALayer *myLayer = [CALayer layer];
>
> myLayer.contents = [NSImage imageNamed:@"test.png"];
>
> myLayer.transform = CATransform3DMakeRotation(-.75,20,2.5,1);
>
> [contentView setLayer:myLayer];
>
> [contentView setWantsLayer:YES];
>
>
> The above code has the appropriate connections in Interface Builder,
> of
> course. The values I entered for CATransform3DMakeRotation are
> arbitrary, I
> just don't understand enough of the math behind it to make any
> sense. I've
> googled perspective transformation matrices as suggested in a
> different
> thread, but the values presented there didn't help at all. Am I
> missing
> something really simple with regards to CATransform3DMakeRotation?
> The
> Apple documentation for the CATransform family in general is really
> lacking,
> especially for people like me who don't have a background in graphics
> programing and heavier math!
>
>
> Any help anyone can provide in clearing things up for me would be
> greatly
> appreciated!
>
>
> Devon
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Mac Man | Feb 7, 08:44 | |
| Bill Dudney | Feb 7, 13:18 |






Cocoa mail archive

