Inverse in Chipmunk

Official forum for the Chipmunk2D Physics Library.
Post Reply
KMagic
Posts: 1
Joined: Mon Sep 01, 2014 12:43 am
Contact:

Inverse in Chipmunk

Post by KMagic »

I am new to game programming as well as Chipmunk. I have a simple question:
What do m_inv ( inverse of mass) and i_inv (inverse of moment of inertia) mean? 8-)
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Inverse in Chipmunk

Post by slembcke »

On most older CPUs, floating point division is very expensive compared to multiplication. So for a something like mass where you almost always use it as var/mass, it's better to precalculate m_inv = 1/mass so you can do var*m_inv instead.

It's quite possible that in the last 8 (!) years that it's no longer a relevant optimization though. Haven't bothered to check in a long time.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests