我需要一个用于 Java 或 Scala 的(简单)、不可变的 2D 向量库
我已经找了一整天了我尝试过 Simplex3D Scala 库。但它的记录很少,我什至在下载旧版本后无法获得向量标准化,因为当前版本无法运行。
javax.vecmath 不是不可变的,因此在 Scala 中使用不太好。
commons-math 更倾向于科学数学方向,不方便 2D(或 3D)使用。
I've been searching for a whole day. I've tried Simplex3D Scala library. But it's poorly documented and I don't even manage to get a vector normalized after downloading an older release because the current one doesn't run.
javax.vecmath is not immutable so it not nice to use in Scala.
commons-math is more into the scientific math direction with no convenience for 2D (or 3D) use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当我需要的时候却找不到。所以我构建了一个,并且一直打算发布它。我现在太忙了,无法对它做任何事情,但如果没有更好的答案,我可能会在下周提供它。
I couldn't find one when I needed one. So I built one, and I've always been intending to release it. I'm too busy to do anything with it now, but I could probably make it available next week if a better answer is not forthcoming.
我刚刚做了一些更多的研究。 Slick2D 似乎包含一个具有不可变方法的 Vector2f 类。虽然这不是很多,并且可以在大约一个小时内手工完成。
I've just done some more research. Slick2D seems to contain a Vector2f class that has immutable methods. Though that's not very much and can be done by hand in maybe an hour.
这是我为一些简单的游戏而制作的。
它并不完美,也不是完全一成不变的。我想要一些代码片段的运算符的非不变版本。最初它也包装了 JBox2D 的 Vector2 类,该类缺少运算符重载和一堆其他东西。
Here's the one I made for some simple game stuff.
It hardly perfect and it's not entirely immutable. I wanted non-immutable versions of the operators for some pieces of code. Originally it wrapped the Vector2 class of JBox2D as well, which lacked operator overloads and a bunch of other stuff.
Simplex3d Math 非常紧密地遵循 GLSL,因此任何有关 GLSL 的手册都可以使用。
您可以按如下方式规范化向量“v”:normalize(v)
Simplex3d Math是一个库,不附带可运行的类,所以我不确定“新版本不运行”是什么意思。请加入邮件列表并提供更多详细信息,我将非常乐意为您提供帮助:http ://groups.google.com/group/simplex3d-dev
文档将在下一版本中得到改进。
Simplex3d Math follows GLSL very closely, so any manual on GLSL will work as well.
You can normalize vector 'v' as follows: normalize(v)
Simplex3d Math is a library and does not come with runnable classes, so I am not sure what you mean by "the new release does not run." Please join the mailing list and give more details, I'll be more than happy to assist you there: http://groups.google.com/group/simplex3d-dev
Documentation will be improved for the next release.