Android 3d math library (vector, matrix, etc.) sim

2020-07-14 09:51发布

New to Android here.

Is there an Android 2.2 3D math library in the SDK? I couldn't find one and I was hoping there would be one. I am not able to use javax.* packages for some reason in Eclipse.

The thing I really need is rotation about an arbitrary axis of an arbitrary angle.

I don't really want to use the NDK unless I am forced to. If there is a freely available Java 3d math library, I would love to know. It should work with Android.

It should ideally have basic 3d math like cross(), dot(), etc. along with arbitrary rotation and scaling.

Thanks,

2条回答
家丑人穷心不美
2楼-- · 2020-07-14 10:28

The best I could find was the math package of jMonkeyEngine. It required some modification to work in separation from the rest of the engine. Specifically you only want to keep Matrix*f, Vector*f, Quaternion, and FastMath classes, and remove any methods that depend on classes from other packages. Luckily the BSD license makes this possible for any purpose.

查看更多
forever°为你锁心
3楼-- · 2020-07-14 10:32

I just dropped the vecmath source in to my project and it seems to compile and work fine apart from Color* classes (which is no great loss).

查看更多
登录 后发表回答