# how to represent infinite inertia tensor ?

This topic is 3480 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i have 2 variables ,inverse mass and inverse inertia tensor, to represent mass and inertia tensor. for mass , it is easy to represent infinite mass. -infinite mass = FLT_MAX , invese infinite mass = 0 but for inertia tensor , how to represent it ? | FLT_MAX FLT_MAX FLT_MAX | | FLT_MAX FLT_MAX FLT_MAX | == infinite inertia tensor ?? | FLT_MAX FLT_MAX FLT_MAX | | 0 0 0 | | 0 0 0 | == inverse inifinite inertia tensor ?? | 0 0 0 |

##### Share on other sites
why would you want infinite mass and infinite inertia tensor? I mean, why bother with these things in the physics calculations? It doesn't really make sense. I mean are you even going to allow for objects to have an infinite mass to "move"? What happens, do they just bowl everything over in their path?

##### Share on other sites
using inverse mass make it easy to code physics caculations.
( i am making small ny physics engine )
and i saw 3 open physics library. all of them use inverse mass.

if u make not-moving object like ground,
u should add new state variale like 'bool isMove' to object class.
and caculate acceleration by using 'f=ma'
u code like following
if( isMove == true ) a=f*1.0/m;
else a = 0;

but if u use inveremass,
u code like following
a = f*inverseMass;
(if inverseMass = 0; then a = 0.)

##### Share on other sites
How many places in your code do you actually use the inertia tensor (as opposed to the inverse)? I'm betting it's few to none; most common tasks only require the inverse. If this is the case for you it might not even be worth storing the straight inertia tensor, which would solve your problem nicely without resorting to hacks like using FLT_MAX to represent infinity.

If you do have a few places where the inertia tensor is used you could instead just have a flag indicating that your object is non-rotatable and perform the appropriate action at that point.

##### Share on other sites
inertia tensor is used only for user interface.
for caculation it does not need.

class RigidBody
{
// public user interface
public:
setMass(float m);
setInertiaTensor(Matrix3 I);

private:
setInverseMass(float invm);
setInverseInertiaTensor(Matirx3 invI);
}

setMass(float m)
{
if( m == FLT_MAX )
{
setInverseMass(0);
}
else
{
setInverseMass( 1.0 / m);
}

}

setInertiaTensor(Matrix3 I);
{
if( I == INFINITE_INERTIA_TENSOR )
{
setInertiaTensor( Matrix3::ZERO );
}
else
{
setInverseInertiaTensor( I.getInverse );
}
}

i think that it is odd to set the 'setInverseMass' as a user interface.
and users seldom dont know 'inertia tensor' terms. (so i made InertiaTensor class)
moreover , users dont know 'the inverse matrix of inertia tensor'.
so i set only setMass function as a public.

my question comes back origin.
how can i represent 'INFINITE_INERTIA_TENSOR' ?

##### Share on other sites
As was asked before: why infinite?

The universe contains a finite amount of energy (and thus, inertia). This is why a material object can never reach the speed of light -- it would take an infinite amount of input energy, and an infinite amount of energy does not exist.

##### Share on other sites
infinite value need for only mass.

inverse mass = 1 / mass
if mass = infinite ,then inverse mass = 0.
inverse mass =0 => the object is non-movable.

f = ma => a = f/m => a = f * inverse mass
if inverse mass is 0, m = infinite , a = 0.
so object never move.

box2d,WM4(geometrictools.com), cyclone engine( the source code of the book , game physics engine development )
all use inverse mass.
all use infinite mass to represent non-movable object.

##### Share on other sites
I think that you should represent the infinite mass or inertia as a flag and the appropriate physics algorithm applied in each case. Ignoring that, I'd say just use 0 and FMAX but computers dont like to play with those numbers :( And the simulator under the hood may have to check for it anyway.

p.s.
I've used infinite inertia with havok for much luls.

##### Share on other sites
I think that you should represent the infinite mass or inertia as a flag and the appropriate physics algorithm applied in each case. Ignoring that, I'd say just use 0 and FMAX but computers dont like to play with those numbers :( And the simulator under the hood may have to check for it anyway.

p.s.
I've used infinite inertia with havok for much luls.

##### Share on other sites
Code first for functionality. When it is working as intended, then AND ONLY THEN profile and optimise. Implement a test for inverseMass==0 and return linear and angular acceleration as appropriate. Once your engine is complete, THEN you can profile it to find its performance hotspots. IF that turns out to be this function, then consider optimising away the mass test.

1. 1
2. 2
3. 3
Rutin
14
4. 4
5. 5

• 12
• 12
• 9
• 14
• 10
• ### Forum Statistics

• Total Topics
632654
• Total Posts
3007669
• ### Who's Online (See full list)

There are no registered users currently online

×