note 87461 deleted from function.pi by hholzgra

From: Date: Thu, 02 Aug 2012 15:35:40 +0000
Subject: note 87461 deleted from function.pi by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189875@lists.php.net to get a copy of this message
Note Submitter: gmail user robkohr ---- <?php /* Returns angle of line segment in degrees. Angle will be a positive value between 0 and 360. 0 will be north, 90 east, 180 south, 270 west Author: Robert Kohr */ function get_angle($x1, $y1, $x2, $y2, $negative_y_is_up=0){ //differences in x and y $x = $x2 - $x1; $y = $y2 - $y1; //y will need to be negated for where + y is down if($negative_y_is_up){ //useful in some applications $y = -$y; } return (rad2deg(atan2($x, $y))+360)%360; } ?>

« previous php.notes (#189875) next »