Find angle in php when we know base perpendicular and hypotenuse ?
I am making a project in PHP and need me some calculations but i am unable to imagine how to find out the angle when know base perpendicular and hypotenuse
Here is:
AB = 3000 = BASE
BC = 1000 = PERPENDICULAR
AC = find by me in php script as below
But here is i need the find out angle among the AB to AC or A°
Script for find HYPOTENUSE in PHP as below
<?php
if(isset($_GET['f']) and ($_GET['t'])){
$fr = $_GET['f'];
$to = $_GET['t'];
$xf = explode(', ',$fr);
$xt = explode(', ',$to);
$ans1 = $xf[0]-$xt[0];
$ans2 = $xf[1]-$xt[1];
$ans3 = $ans1*$ans1;
$ans4 = $ans2*$ans2;
$ans5 = (sqrt($ans3+$ans4))*111.2;
} else {
$fr = $to = $ans5 = "";
}
?>
<form action="" method="GET">
From:<br>
<input type="text" name="f" value="<?php echo $fr; ?>"></input>
<p></p>
To:<br>
<input type="text" name="t" value="<?php echo $to; ?>"></input>
<p></p>
<button type="submit">CALCULATE</button>
</form>
<hr>
<div>
<?php
echo 'Distance: <strong>'.round($ans5*1000, 2).'</strong> meter(s)';
echo ' or <strong>'.round(($ans5), 3).'</strong> kilometer(s)<br>';
echo 'Distance: <strong>'.round(($ans5*0.621371), 3).'</strong> Mile(s)<br>';
echo 'Distance: <strong>'.round(($ans5*1000*3.28084), 2).'</strong> Foot';?>
</div>
<hr>