Keys →
Functions ↓
function howFarBetween ( $a, $b, $c ) {#-k math#- find how far $b is between $a to $c#- $a starting point#- $b somewhere between#- $c ending point#- returns $pc*100 - the % distance of $b from $a to $c (0 <= $pc <= 1)#- or 0 if outside the endpoints#- This is the inverse of goPartWayBetween#-d 2/3/21 - Added#-s See also: goPartWayBetween $pc = 0; if ($a <> $c) { if (($a <= $b) && ($b <= $c)) { $pc = ($b-$a)/($c-$a); } if (($a >= $b) && ($b >= $c)) { $pc = ($a-$b)/($a-$c); } } return $pc; }?>