Which Haskell library for computer graphics geometry?

ε祈祈猫儿з 提交于 2020-01-01 04:35:06

问题


I would like to do some experiments in computer graphics in Haskell. This will include doing some geometry calculations and ultimately writing a ray tracer. Which library should I pick for easy handling of vectors, matrices and relevant operations on them?

There are few on Hackage including nice looking ones like vect and AC-Vector, but it's easy to miss a good candidate among so many different libraries.


回答1:


For vectors and matrices that are used for transformations, vect probably is your best bet. It is optimized for fast, lower-precision (as in Double precision as opposed to Ratio precision) transformations like you described, and its role as the matrix stack in lambdacube (as an example of an application where performance is key) shows that it is fast enough for most applications.

For data matrices - that are used for images, for example - you'd probably want to use repa, especially when doing data-parallel computations such as ray tracing.




回答2:


There is an interesting library called vector-space by Conal Eliott which allows you to lazily compute Taylor series of many analytic functions. See also here. Not sure about performance, though.



来源:https://stackoverflow.com/questions/9472385/which-haskell-library-for-computer-graphics-geometry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!