badmoon 122 Report post Posted September 30, 2004 Ok, I've implemented code to calculate the inertia tensor. I've also got collision detection and response implemented for my physics engine I'm working on at the moment. However, I have a few questions: 1. I'm using a left handed coordinate system and measuring my angular velocities counterclockwise rather than clockwise. I've found the latter has meant that I should calculate the torque of a force as follows: Torque = F x R rather than Torque = R x F where F is the force vector and R is a vector from the bodies centre of mass to the point at which the force is applied Does this mean that my collision impulse should be calculated differenty? The collision impulse j between a point of body A and face with normal n of B is normally given as: -(1+e)[V_{A} - V_{B}] . n ----------------------------- n.n( 1/M_{A} + 1/M_{B} ) + [X_{A} + X_{B}].n where X_{A} is (I^{-1}_{A} ( R_{A} x n )) x R_{A} and similarly for X_{B}. e is the coefficient of restitution. R_{i} is the vector from the body's centre of mass to the collision point 2. Normally to convert the inertia tensor I from body space to world space you do the following: I_{world} = A I_{body} A^{T} where A is the rotation matrix Does this change in anyway if using a left-handed coordinate system or measuring angles counterclockwise? 4. Should the above change if my rotation matrix transforms a vector by multiplying on the right rather than on the left. i.e. in my engine the transformed point P_{new} using the rotation matrix A is given by: P_{new} = P_{old} A NOT P_{new} = A P_{old} Should this change how I calculate the impulse? 5. Should the inertia tensor in body space be calculated differently when using a left handed coordinate system or measuring angles counterclockwise? If someone could answer any of these questions, that would be a great help 0 Share this post Link to post Share on other sites
grekster 640 Report post Posted September 30, 2004 ** Realised I was very wrong. Sorry :) **[Edited by - grekster on September 30, 2004 10:52:24 AM] 0 Share this post Link to post Share on other sites
uavfun 744 Report post Posted September 30, 2004 The scalar (dot) product of two vectors does the same thing, A dot B = B dot A. However, the vector (cross) product does NOT come out the same, in fact it is the opposite: A x B = - (B x A).As far as the inertia tensor stuff - sorry, I have no idea, it looks nasty ;) 0 Share this post Link to post Share on other sites
Motorherp 613 Report post Posted September 30, 2004 This all stems from whether you define your vector and matrix multiplication to be row or column dominant. For example most maths text books teach vector cross products like this:AxB = (ay.bz - by.az)x + (az.bx - bz.ax)y + (ax.by - bx.ay)zhowever you could define it like this:AxB = (az.by - bz.ay)x + (ax.bz - bx.az)y + (ay.bx - by.ax)zIts an arbitrary choice but will effect the signs of your results and also the order which vector matrix multiplication should be done. Unfortunately no books or papers seem to specify what type they are using so you just need to plug in some numbers to find out. It confused the hell out of me when I started working for a company whos math library did it all the second way around. For a long time all my maths and physics came out very strange indeed :). If any one knows if theres some advantage to the second way I'd like to here it though. Personally I can't see why anyone would want to go against the generally accepted way for something so fundamental. Its a real brain **** !!PS: Whats even worse is that you'll find a lot of books combine the two haphazardly because they've pulled all their info from other resources without really understanding whats going on. 0 Share this post Link to post Share on other sites
oliii 2196 Report post Posted September 30, 2004 right handed rule every time. The fact that raster display adds to the confusion (defines a left-handed system), and watches (why oh why, after pytagoras they had to make the clocks to 'clockwise'). is a pain in the ass, but never ever use a left-handed coordinate system, it's asking for trouble. It's good to know out to differenciate between them and to detect them, but I absolutely hate it when I see some physics code using a left-handed system, especially in tutorials and in 3D packages. And I'm a left-handed, so it's not like I'm 'racist' or anything. :)simple rules (rules of thumb, coincidently) for right handed systems. Trigonimetric circle goes right handed. imagine your right hand, thumb up, your fingers will curl anti-clockwise, so that's good.take right thumb as 'X', right index as 'Y', puth them at right angle. put the major at right angle from the two other fingers. that would be the direction of the 'Z' axis in a right handed coordinate system, where Z = X x Y. from the display, X goes right, Y goes Up, and Z should point TOWARDS you. Can be counter intuitive, hence some people use a left handed system, to force Z to point forward, which is STILL A BAD IDEA. An anecdote, I am forced to use a right handed coordinate system, where X points right, but Y points down so Z will then point forward to still keep the right-handed rule intact :) Sometimes, you know... 0 Share this post Link to post Share on other sites
Dmytry 1151 Report post Posted October 1, 2004 i had problems with left/right hand right with physics. How i solved: i just remember that X^ cross Y^ = Z^ indifferently to hand. (also, it's arbitrary decision), where X^ it's unit-length vector along X axis, and so-on. It replaces hand rules for me.And i remember formule for cross product. And don't care about clockwise/counterclockwise (also clockwise or counterclockwise depends to from what side i'm looking), it just have to have correct signs.If i handle things correctly them should not depend to handness of system because you can't differenciate left hand and right hand (unless you simulate weak interaction[sp?] of elementary particles), if you replace "right hand rule" with "left hand rule" and vice-versa anywhere, results will be correct anyway. At worst you'll have wrong sign, and it's relatively easy to find. 0 Share this post Link to post Share on other sites