Image:CocoaNav icon.png

PARMANOIR

Core Animation is right handed

Right handed ? Count to 3 on your left and right hands. Align your fingers so that each finger is perpendicular to the other two. One, two, three gives the axes : X, Y, Z. Line up your hands so that X goes left and Y goes up. Now each hand's Z goes opposite the other's. Your right hand is your Core Animation frame, same as OpenGL.

For some reason I thought CA was left handed — I had my layers set with a positive Z value. The layers showed up where I was expecting them, but visually it was a mess : the far layers were drawn on top of the near layers ! Using a negative Z value fixed the glitch.

Perspective in CA, using 3D CALayers and a perspective transform :

your eye     layers are closer (bigger) here         layers have same size as in 2D        layers are farther (smaller) here

------------------ positive Z value ------------------------- zero Z value ----------------------- negative Z value---------

Izzy
2008 05 01

Not to be a dick, but there is this thing called the "right hand rule" for 3-spaces.

Patrick Geiller
2008 05 01

Ah thanks, I didn't know the official name, just "* handed".

Anyway if you come from DirectX and code in Core Animation, hands are reversed. In a 3D engine, setting a badly signed Z value on layers would make them invisible. CA did draw them, inversely sorted.

vchahun
2008 05 04

Pour être précis, cette "règle de la main droite" signifie géométriquement qu'on choisit une base orthonormée directe de l'espace de dimension 3, alors qu'utiliser la main gauche conduirait au choix d'une base indirecte de l'espace ... ce qu'on fait moins souvent dans la pratique, pour des raisons de convention: sinon, il faudrait par exemple changer l'expression matricielle des rotations en dimension 3, etc. etc. Enfin, tant que c'est de la 2d augmentée, il faut juste savoir que l'axe des Z pointe vers le codeur et non pas l'écran !

Patrick Geiller
2008 05 04

Merci pour l'explication mathématique :)

2008 07 25Where in build phases is that file ?
2008 07 192Imagine clickable error messages
2008 07 18Succulent Stormhoek
2008 07 173Loving the for
2008 07 12(Parmanoir) Feed now validates
2008 07 108Telling classes from instances
2008 07 08Comma Trick
2008 07 06Using libffi
2008 07 04BridgeSupport's type and type64
2008 07 042Clickable Disabled MenuItems
2008 07 026Less bugs through compiler optimizations
2008 06 251CocoaNav JS, a light CocoaNav for Safari
2008 06 232NSWindow goodies : bottomCornerRounded, usesLightBottomGradient
2008 06 222Inspecting NSUndoManager's undo stack
2008 06 16Cocoa Regular Expressions via JavascriptCore
2008 06 15Crossing the WebKit bridge
2008 06 08Double and Triple Click
2008 06 05Photoshop-like compositing with Core Animation
2008 06 052One way binding to NSSlider
2008 05 30Threaded Core Animation, Part Deux
Image:rss.png
Image:rss.png

Powered by MediaWiki

Hi ! I'm learning Cocoa to (hopefully !) become an indie developer.

I've written software all my professional life, in C++, PHP, Javascript. I've designed websites and web interfaces. My last venture went into flames as clients were happy but didn't like paying very much.

I've had little luck in the B2B world, I'm hoping for a better future writing Mac applications.

Planet Cocoa