如何在 Objective-C 中进行矩阵和向量数学运算?
我需要在 Objective-C 中进行矩阵和向量数学运算。是否有教程展示其工作原理?有没有派上用场的数学库?
I need to do matrix and vector math in Objective-C. Are there tutorials which show how this works? Are there math libraries that come in handy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从 iOS 4.0 开始,SDK 包含 Apple 的加速框架,该框架包含许多专门针对在 iOS 硬件上运行而优化的 C 矩阵和向量函数。
函数名称和文档有点神秘,但如果性能特别重要,它可能是您的最佳选择。
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.
我没有看到它被提及,但是 GLKit为计算机图形学中常用的数学类型提供矢量/矩阵函数。
I did not see it mentioned but GLKit provides vector / matrix functions for math types commonly used in computer graphics.
除了 Ole 指出的用于加速矩阵数学的 Accelerate 框架之外,CGAffineTransform 和 CATransform3D 结构都是矩阵(分别为 3x3 和 4x4)。 Apple 提供了使用旋转、缩放等操作这些的辅助函数,如果您想要进行此类转换,这会很有用。
特别是,Apple 在 Quartz 2D 编程指南中有一个部分,其中 解释一些矩阵数学。
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 为许多 Accelerate Framework 的功能(BLAS、LAPACK 和 vDSP)提供了一个方便的包装器,两者都在操作系统上X 和 iOS。
(免责声明:我是该库的开发者)
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)