开发者

How to do matrix and vector math in Objective-C?

I need to do开发者_JAVA技巧 matrix and vector math in Objective-C. Are there tutorials which show how this works? Are there math libraries that come in handy?


Since iOS 4.0, the SDK includes Apple's Accelerate framework, which contains a number of C matrix and vector functions that are especially optimized to run on iOS hardware.

The function names and documentation is kind of cryptic, but if performance is particularly important, it might be your best choice.


I did not see it mentioned but GLKit provides vector / matrix functions for math types commonly used in computer graphics.


In addition to the Accelerate framework that Ole points out for accelerated matrix math, both the CGAffineTransform and CATransform3D structures are matrices (3x3 and 4x4, respectively). Apple provides helper functions for manipulating these using rotation, scaling, etc., which can be useful if you want to do these kind of transformations.

In particular, Apple has a section of the Quartz 2D Programming Guide where they explain some of the matrix math.


YCMatrix provides a convenient wrapper for many of the Accelerate Framework's functions (BLAS, LAPACK and vDSP), both on OS X and iOS.

(disclaimer: I am the developer of that library)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜