Page 1 of 1

Using BEPU with OpenTK

Posted: Thu Jan 29, 2015 7:09 pm
by aeroflyluby
Hello everybody.

I used BulletSharp which has really nice feature - it can be compiled with OpenTK math classes instead of using its own. It allows for really good integration because it makes unnecessary casting and explict converstions just disappear.
However, I haven't found similar option in BEPU physics, as it seems to use its own math classes from BEPUutilities. Those classes differ a bit from that which OpenTK use, so replacing won't work here.

My question is: Is it possible, or maybe someone managed to do it, to compile BEPU against OpenTK so it can share math classes?

Thank you, best regards.

Re: Using BEPU with OpenTK

Posted: Thu Jan 29, 2015 8:34 pm
by Norbo
There's no automatic way to do it, unfortunately. I used to maintain some forks for different math libraries, but it becomes an enormous hassle when there isn't a perfect mapping.

One of the easier approaches to ease the transition is to use implicit conversions, like the OpenTK fork does. You could do something similar, but based on the more recent development version.

You still end up paying the small performance tax for doing the conversion, but it can get rid of a lot of the developmental annoyances.

Notably, there's a good chance BEPUphysics will eventually move to the SIMD types once they get solidified. My guess is a lot of other libraries will do the same, so this issue will be mitigated somewhat.

Re: Using BEPU with OpenTK

Posted: Thu Jan 29, 2015 10:22 pm
by aeroflyluby
Norbo wrote:There's no automatic way to do it, unfortunately. I used to maintain some forks for different math libraries, but it becomes an enormous hassle when there isn't a perfect mapping.

One of the easier approaches to ease the transition is to use implicit conversions, like the OpenTK fork does. You could do something similar, but based on the more recent development version.

You still end up paying the small performance tax for doing the conversion, but it can get rid of a lot of the developmental annoyances.

Notably, there's a good chance BEPUphysics will eventually move to the SIMD types once they get solidified. My guess is a lot of other libraries will do the same, so this issue will be mitigated somewhat.
I actually switched from BulletSharp to BEPU original in less than 2 hours today and it works great! I added some implict conversion operators for Vectors, Quaternion and Matrix and this library is great.
It's far more straightforward to use than bullet too :)

Re: Using BEPU with OpenTK

Posted: Thu Jan 29, 2015 11:11 pm
by Norbo
Glad it's working for you! :)