note 79607 deleted from function.acos by googleguy

From: Date: Tue, 22 Oct 2013 06:47:39 +0000
Subject: note 79607 deleted from function.acos by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196644@lists.php.net to get a copy of this message
Note Submitter: anthony at interiorgoodsdirect dot com ---- To calculate an angle from a triangle's sides. Use the 'law of cosines' : <?php // a²+b²-c² // cosC = -------- // 2ab function calculateAngle($c,$a,$b) { $angleInRadians=acos((pow($a,2) + pow($b,2) - pow($c,2)) / (2 * $a * $b)); return rad2deg($angleInRadians); } ?> $a, $b, $c are the triangle sides. The function returns the angle opposite side c, in degrees.

« previous php.notes (#196644) next »