Difference between revisions of "Advancing Velocity"
Jump to navigation
Jump to search
m (add link to lateral velocity) |
m (syntax highlight, tweak code snippet) |
||
Line 3: | Line 3: | ||
== Calculation == | == Calculation == | ||
A simple formula for advancing velocity is: | A simple formula for advancing velocity is: | ||
− | < | + | <syntaxhighlight> |
− | + | double advancingVelocity = -Math.cos(e.getHeadingRadians() - | |
− | </ | + | (e.getBearingRadians() + getHeadingRadians())) * e.getVelocity(); |
− | Where | + | </syntaxhighlight > |
+ | Where <code>e</code> is a [[ScannedRobotEvent]]. | ||
== See Also == | == See Also == |
Revision as of 04:57, 17 April 2011
Advancing Velocity is the speed at which your opponent is moving toward you (perpendicular to Lateral Velocity). When you stay still, RamFire usually has an Advancing Velocity of 8 and MyFirstRobot usually has an Advancing Velocity of 0. A robot moving straight away from you would have an Advancing Velocity of -8.
Calculation
A simple formula for advancing velocity is:
double advancingVelocity = -Math.cos(e.getHeadingRadians() -
(e.getBearingRadians() + getHeadingRadians())) * e.getVelocity();
Where e
is a ScannedRobotEvent.