<html>
<head>
<title>The Australian Rules Visual Change Drop Punt Analysis Game - RJM Programming - May 2014</title>

<script type='text/javascript'>

var didea = [0, 50, 20, 40, 40];
var hidea = [0, 2, 2, 3, 0];
var woo = null;

var score = 0;
var outof = 0;

var ua = navigator.userAgent;
var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /Andrxoid/i.test(ua) || /iPhone OS 3_2_2/i.test(ua);
var prevvisualpart = "";
var thelook = "top=200,left=700,width=720,height=600";

function onion(thisone) {
var newone = thisone;
if (prevvisualpart != "") {
var newwords = thisone.split("%20");
var oldwords = prevvisualpart.split("%20");
var olddata = prevvisualpart.split("data=");
newone = newone.replace("scatter_chart.php", "scatter_chart_diff.php");
newone = newone.replace("Trajectory", "Comparison%20of%20trajectories");
newone = newone.replace("Punt", "Punts");
newone = newone.replace("height", "heights");
newone = newone.replace("angle", "angles");
newone = newone.replace("is%20kick", "are%20kicks");
newone = newone.replace(newwords[2] + "%20m%20Drop", newwords[2] + "%20m%20and%20" + oldwords[2] + "%20m%20Drop");
newone = newone.replace(newwords[9] + "%20m%20(", newwords[9] + "%20m%20and%20" + oldwords[9] + "%20m%20(");
newone = newone.replace(newwords[16] + "%20seconds", newwords[16] + "%20seconds%20and%20" + oldwords[16] + "%20seconds");
newone = newone.replace(newwords[21] + "%20m/s", newwords[21] + "%20m/s%20and%20" + oldwords[21] + "%20m/s");
newone = newone.replace(newwords[26] + "%20degrees", newwords[26] + "%20degrees%20and%20" + oldwords[26] + "%20degrees");
newone = newone.replace("data=", "data0=" + olddata[1] + "&data=");
thelook = "top=180,left=350,width=1070,height=640";
}
prevvisualpart = thisone;
return newone;
}


function clrit() {
document.getElementById("myh4").style.display = "block";
document.getElementById("velocity").value = "";
document.getElementById("angle").value = "";
if (!isiPad) {
document.getElementById("results").style.background = 'url("./droppunt.jpg")';
document.getElementById("results").style.backgroundRepeat = "no-repeat"
document.getElementById("results").style.backgroundPosition = "right"
}
}

function havealook(ina, inv) {
var stopexaggerating = "";
var g = 9.81;
var scenario = document.getElementById("scenario").value;
var ok = -1;
var suffix = "";
if (isiPad) suffix = "<td id='tdgraph' rowspan=26></td>";
if (scenario != "0") ok = 1;
var andgoes = "";
if (ina != "" && inv != "") {
var iv = document.getElementById("velocity").value;
var an = document.getElementById("angle").value;
var radan = eval((Math.PI * an) / 180.0);
var ivx = eval(Math.cos(radan) * iv);
var ivy = eval(Math.sin(radan) * iv);
var totaltime = eval(2.0 * ivy / g);
var bitsoftime = eval(totaltime / 17.0); // was 25.0
var mytimeelapsed = bitsoftime;
var prevh = 0.0, nexth = 0.0;
var k = 1, hbit = 0;
var midbit1 = "";
var midbit2 = "";
var midbit3 = "";
var ois = document.getElementById("tr1");
var wtitle = "Trajectory%20of%20Drop%20Punt%20of%20" + iv + "%20m/s%20at%20angle%20of%20" + an + "%20degrees";
var visualpart = "http://www.rjmprogramming.com.au/PHP/ScatterChart/scatter_chart.php?title=Trajectory%20of%20Drop%20Punt%20of%20" + iv + "%20m/s%20at%20angle%20of%20" + an + "%20degrees&task=Distance%20(metres)" + stopexaggerating + "&desc=Height%20(metres)" + stopexaggerating + "&data=,%20[0,0]%20";
if (woo) {
woo.close();
}
while (totaltime > mytimeelapsed) {
midbit1 = "";
midbit2 = "";
midbit3 = "";
ois = document.getElementById("tr" + k);
hbit = eval(ivy * mytimeelapsed - 0.5 * g * mytimeelapsed * mytimeelapsed);
nexth = eval(ivy * (mytimeelapsed + bitsoftime) - 0.5 * g * (mytimeelapsed + bitsoftime) * (mytimeelapsed + bitsoftime));
if (hbit >= nexth && hbit >= prevh) {
midbit1 = " style='background-color:lightblue;' ";
midbit2 = " style='background-color:lightgreen;' ";
midbit3 = " style='background-color:pink;' ";
if (andgoes == "") {
andgoes = " and reaches height of " + Math.round(hbit * 1000.0) / 1000.0 + " metres";
if (document.getElementById("exaggeratingokay").value == "N" && stopexaggerating == "" && eval((Math.round(hbit * 1000.0) / 1000.0) - (Math.round(eval(ivx * mytimeelapsed) * 1000.0) / 1000.0)) <= 0.0) {
stopexaggerating = "%27%2c%20minValue%3a0%2cmaxValue%3a" + Math.floor(((Math.round(eval(ivx * 2.0 * mytimeelapsed) * 1000.0) / 1000.0) + 5.0) / 5.0) * 5;
visualpart = visualpart.replace("%20(metres)", "%20(%20metres%20)" + stopexaggerating);
visualpart = visualpart.replace("%20(metres)", "%20(%20metres%20)" + stopexaggerating);
} else if (document.getElementById("exaggeratingokay").value == "N" && stopexaggerating == "") {
stopexaggerating = "%27%2c%20minValue%3a0%2cmaxValue%3a" + Math.floor((((Math.round(hbit * 1000.0) / 1000.0) / 1000.0) + 5.0) / 5.0) * 5;
visualpart = visualpart.replace("%20(metres)", "%20(%20metres%20)" + stopexaggerating);
visualpart = visualpart.replace("%20(metres)", "%20(%20metres%20)" + stopexaggerating);
}
visualpart = visualpart.replace("Drop%20Punt%20of", "Drop%20Punt%20reaching%20height%20of%20" + Math.round(hbit * 1000.0) / 1000.0 + "%20m%20(goal%20posts%206%20m%2b)%20at%20" + Math.round(mytimeelapsed * 1000.0) / 1000.0 + "%20seconds%20is%20kick%20of");
}
}
if (eval(hbit - 0.01) < 0.0) {
ois.innerHTML = "<td>" + Math.round(mytimeelapsed * 1000.0) / 1000.0 + "</td><td style='background-color:yellow;'>" + Math.round(eval(ivx * mytimeelapsed) * 1000.0) / 1000.0 + "</td><td>0</td>";
visualpart = visualpart + ",%20[" + Math.round(eval(ivx * mytimeelapsed) * 1000.0) / 1000.0 + "," + "0" + "]%20";
visualpart = visualpart.replace("of%20Drop", "of%20" + Math.round(eval(ivx * mytimeelapsed) * 1000.0) / 1000.0 + "%20m%20Drop");
if (ok == 1 && eval((Math.round(eval(ivx * mytimeelapsed) * 1000.0) / 1000.0) - didea[scenario]) < 0) ok = 0;
} else {
ois.innerHTML = "<td" + midbit1 + ">" + Math.round(mytimeelapsed * 1000.0) / 1000.0 + "</td><td" + midbit2 + ">" + Math.round(eval(ivx * mytimeelapsed) * 1000.0) / 1000.0 + "</td><td" + midbit3 + ">" + Math.round(hbit * 1000.0) / 1000.0 + "</td>" + suffix;
suffix = "";
visualpart = visualpart + ",%20[" + Math.round(eval(ivx * mytimeelapsed) * 1000.0) / 1000.0 + "," + Math.round(hbit * 1000.0) / 1000.0 + "]%20";
if (ok == 1 && hidea[scenario] != 0 && eval((Math.round(hbit * 1000.0) / 1000.0) - hidea[scenario]) < 0) ok = 0;
}
prevh = hbit;
mytimeelapsed = eval(mytimeelapsed + bitsoftime);
k = eval(k + 1);
}
if (ois.innerHTML.indexOf("<td>0</td>") == -1) {
ois = document.getElementById("tr" + k);
ois.innerHTML = "<td>" + Math.round(totaltime * 1000.0) / 1000.0 + "</td><td style='background-color:yellow;'>" + Math.round(eval(ivx * totaltime) * 1000.0) / 1000.0 + "</td><td>0.0</td>";
visualpart = visualpart + ",%20[" + Math.round(eval(ivx * totaltime) * 1000.0) / 1000.0 + "," + "0" + "]%20";
visualpart = visualpart.replace("of%20Drop", "of%20" + Math.round(eval(ivx * totaltime) * 1000.0) / 1000.0 + "%20m%20Drop");
if (ok == 1 && eval((Math.round(eval(ivx * totaltime) * 1000.0) / 1000.0) - didea[scenario]) < 0) ok = 0;
}
andgoes = andgoes + " and distance of " + Math.round(eval(ivx * totaltime) * 1000.0) / 1000.0 + " metres";
document.getElementById("myh4").innerHTML = "Initial Velocity of 'your fantasy (always straight)' drop punt kick is " + document.getElementById("velocity").value + " metres/second at an angle of " + document.getElementById("angle").value + " degrees" + andgoes + ". Want to <a target=_blank title='Analysis' href='http://vuir.vu.edu.au/2026/1/millar.pdf'>improve</a>?";
document.getElementById("results").style.display = "block";
if (ok == 0) {
if (outof == 0) {
outof = outof + 1;
document.getElementById("score").innerHTML = document.getElementById("score").innerHTML.replace(" ... ", " ... Score: " + score + " out of " + outof);
} else {
document.getElementById("score").innerHTML = document.getElementById("score").innerHTML.replace(" ... Score: " + score + " out of " + outof, " ... Score: " + score + " out of " + eval(outof + 1));
outof = outof + 1;
}
} else if (ok == 1) {
if (outof == 0) {
score = score + 1;
outof = outof + 1;
document.getElementById("score").innerHTML = document.getElementById("score").innerHTML.replace(" ... ", " ... Score: " + score + " out of " + outof);
} else {
document.getElementById("score").innerHTML = document.getElementById("score").innerHTML.replace(" ... Score: " + score + " out of " + outof, " ... Score: " + eval(score + 1) + " out of " + eval(outof + 1));
score = score + 1;
outof = outof + 1;
}
}
if (isiPad) {
document.getElementById("tdgraph").innerHTML = "<iframe src='" + onion(visualpart) + "' title='Google Scatter Chart'></iframe>";
document.getElementById("results").border = 0;
} else {
woo = window.open(onion(visualpart), "_blank", thelook);
}
setTimeout(clrit, 5000);
}
}

</script>

</head>
<body>
<span><h1 id="score">The Australian Rules Visual Change Drop Punt Analysis Game ...  <select id='exaggeratingokay'><option value='Y'>H exaggerated</option><option value='N'>H and D to scale</option></select> <select id='scenario'><option value="0">Optional scenarios to kick for below ...</option><option value="1">Kick for goal 50m out</option><option value="2">Pass to teammate under pressure 20m away</option><option value="3">Pass to teammate in the clear 40m away</option><option value="4">Bomb it long to the goal square and you are 70m from goal</option></select> <select onchange=" var trs, jtrs, itrs, its=['tr','h1'], wis=window.getComputedStyle(document.getElementsByTagName('table')[1], null).getPropertyValue('width'); if (wis.indexOf('px') == -1 || 1 == 1) { wis='100%'; } for (jtrs=0; jtrs<its.length; jtrs++) { trs=document.getElementsByTagName(its[jtrs]); for (itrs=0; itrs<trs.length; itrs++) { trs[itrs].style.width=wis; trs[itrs].style.display='flex'; trs[itrs].style.flexDirection=this.value; } wis='100%'; document.getElementById('oflex' + jtrs).innerHTML=document.getElementById('oflex' + jtrs).innerHTML.replace('t view','t flex view'); } " id='sflex'><option value='row' id='oflex0'>Left to Right view</option><option value='row-reverse' id='oflex1'>Right to Left flex view</option></select></h1></span>
<h4 id='myh4' style='display:none;'></h4>
<table border=1 cellpadding=5><tr><td>
<select id='angle' style='background-color:orange;' onchange=' document.getElementById("results").style.display = "none"; document.getElementById("myh4").style.display = "none"; var ois = document.getElementById("tr1"); for (var ii=1; ii<=26; ii++) { ois = document.getElementById("tr" + ii); ois.innerHTML = "<td></td><td></td><td></td>"; } havealook(this.value, document.getElementById("velocity").value); '>
<option value="">Angle (degrees) of your drop punt kick</option>
<option value="1">1</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
<option value="25">25</option>
<option value="30">30</option>
<option value="35">35</option>
<option value="40">40</option>
<option value="45">45</option>
<option value="50">50</option>
<option value="55">55</option>
<option value="60">60</option>
<option value="65">65</option>
<option value="70">70</option>
<option value="75">75</option>
<option value="80">80</option>
<option value="85">85</option>
<option value="89">89</option>
</select></td><td>
<select id='velocity' style='background-color:lightgray;' onchange=' document.getElementById("results").style.display = "none"; document.getElementById("myh4").style.display = "none"; var ois = document.getElementById("tr1"); for (var ii=1; ii<=26; ii++) { ois = document.getElementById("tr" + ii); ois.innerHTML = "<td></td><td></td><td></td>"; } havealook(document.getElementById("angle").value, this.value); '>
<option value="">Initial Velocity (metres/second) of your drop punt kick</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="14">14</option>
<option value="16">16</option>
<option value="18">18</option>
<option value="20">20</option>
<option value="22">22</option>
<option value="24">24</option>
<option value="26">26</option>
<option value="28">28</option>
<option value="30">30</option>
<option value="35">35</option>
<option value="40">40</option>
<option value="45">45</option>
<option value="50">50</option>
<option value="55">55</option>
<option value="60">60</option>
<option value="70">70</option>
<option value="80">80</option>
<option value="90">90</option>
<option value="100">100</option>
<option value="110">110</option>
<option value="120">120</option>
<option value="130">130</option>
<option value="140">140</option>
<option value="150">150</option>
<option value="160">160</option>
<option value="170">170</option>
<option value="180">180</option>
<option value="190">190</option>
<option value="200">200</option>
</select></td><td>Thanks to <a target=_blank href='http://www.dsr.wa.gov.au/australianrulesdimensions' title='Dimensions for Football – Australian Rules'>Dimensions for Football - Australian Rules</a></td><td><td>Thanks to <a target=_blank href='http://sportsnscience.utah.edu/science-of-the-punt/' title="Sports 'n Science » Science of the Punt">Sports 'n Science » Science of the Punt</a></td></tr></table>
<table border=1 id="results" style="display:none;width:45%;" cellpadding=5><tr>
<th>Seconds</th><th>Distance (m) (range)</th><th>Height (m)</th>
<tr id='tr1'><td></td><td></td><td></td><td id='tdgraph' rowspan=26></td></tr>
<tr id='tr2'><td></td><td></td><td></td></tr>
<tr id='tr3'><td></td><td></td><td></td></tr>
<tr id='tr4'><td></td><td></td><td></td></tr>
<tr id='tr5'><td></td><td></td><td></td></tr>
<tr id='tr6'><td></td><td></td><td></td></tr>
<tr id='tr7'><td></td><td></td><td></td></tr>
<tr id='tr8'><td></td><td></td><td></td></tr>
<tr id='tr9'><td></td><td></td><td></td></tr>
<tr id='tr10'><td></td><td></td><td></td></tr>
<tr id='tr11'><td></td><td></td><td></td></tr>
<tr id='tr12'><td></td><td></td><td></td></tr>
<tr id='tr13'><td></td><td></td><td></td></tr>
<tr id='tr14'><td></td><td></td><td></td></tr>
<tr id='tr15'><td></td><td></td><td></td></tr>
<tr id='tr16'><td></td><td></td><td></td></tr>
<tr id='tr17'><td></td><td></td><td></td></tr>
<tr id='tr18'><td></td><td></td><td></td></tr>
<tr id='tr19'><td></td><td></td><td></td></tr>
<tr id='tr20'><td></td><td></td><td></td></tr>
<tr id='tr21'><td></td><td></td><td></td></tr>
<tr id='tr22'><td></td><td></td><td></td></tr>
<tr id='tr23'><td></td><td></td><td></td></tr>
<tr id='tr24'><td></td><td></td><td></td></tr>
<tr id='tr25'><td></td><td></td><td></td></tr>
<tr id='tr26'><td></td><td></td><td></td></tr>
</table>
<h3>(will you get the distance? ... in the ideal "kick" world)</h3>
<img src='./droppunt.jpg' title='The Physics'></img>
</body>
</html>