Talk:Lateral Velocity

From Robowiki
Revision as of 15:45, 21 March 2010 by Rednaxela (talk | contribs) (Answer)
Jump to navigation Jump to search

I don't understand how the equation works.. Could anyone explain this to me in terms of triangles? What does e.getHeadingRadians() - enemyAbsBearing give? How can you explain it?

---- urgood2 04:25, 21 March 2010 (UTC)

Well, e.getHeadingRadians() is the enemy's heading relative to the battle field - 0 is pointing up, Math.PI / 2 (90 degrees) is right, Math.PI (180 degrees) is down. The enemyAbsBearing variable is the angle from your bot to the enemy bot. So the difference is the enemy's heading relative to yours - 0 is facing directly away from you, Math.PI / 2 is exactly perpendicular to you (clockwise), etc. Having trouble thinking of some triangles that would demonstrate the formula, probably because it's late on a Saturday night... But hopefully that helps. --Voidious 04:33, 21 March 2010 (UTC)

Nat-lateral-velocity-explaination.jpg

Let's say: red box are our robot; green box are our enemy, CE is extended CB, and BF and CG always point to the north (0 degrees). The lateral velocity is DB. Enemy velocity is AB. We know AB, and we need to know either angle ABD or angle BAD. We know angle GCB (the enemyAbsBearing) and FBA (e.getHeadingRadians()), so how to get either BAD or ABD? Since BAD + ABD = 90 and ABD + ABE = 90, therefore BAD = ABE. So far CG // BF, since both point at north, so GCB = FBE. FBE - FBA = ABE, thus enemyAbsBearing - e.getHeadingRadians() = ABE. ABE = BAD, so we get what we want.

Hope you understand, I don't know how to express my math in proper English =) --Nat Pavasant 05:49, 21 March 2010 (UTC)


Is enemyAbsBearing - e.getHeadingRadians() the same as e.getHeadingRadians() - enemyAbsBearing? The lateral velocity formula on this page uses the second. ---- urgood2 06:39, 21 March 2010 (UTC)

I'm not sure, but I think the sin() make them the same, but I may be wrong. Waiting for some maths wizard to help me (Rednaxela, I'm looking at you =)) --Nat Pavasant 10:08, 21 March 2010 (UTC)

Looking at me? Haha. No, it wouldn't have the same result. It would flip the sign of the resulting lateral velocity. Doesn't really matter so long as it matches what any other code using it expects (i.e. whether 1 is clockwise or -1 is clockwise). --Rednaxela 14:45, 21 March 2010 (UTC)

You cannot post new threads to this discussion page because it has been protected from new threads, or you do not currently have permission to edit.

There are no threads on this page yet.