note 75631 added to function.atan2

From: Date: Fri, 08 Jun 2007 18:35:04 +0000
Subject: note 75631 added to function.atan2
Groups: php.notes 
Request: Send a blank email to php-notes+get-127331@lists.php.net to get a copy of this message
Here is a function that will return a new point [Rotate around non-origin pivot point] (x,y) is current point (cx,cy) is pivot point to rotate =a= is angle in degrees $_rotation = 1; # -1 = counter, 1 = clockwise $_precision = 2; # two decimal places function returnRotatedPoint($x,$y,$cx,$cy,$a) { # http://mathforum.org/library/drmath/view/63184.html global $_rotation; # -1 = counter, 1 = clockwise global $_precision; # two decimal places // radius using distance formula $r = sqrt(pow(($x-$cx),2)+pow(($y-$cy),2)); // initial angle in relation to center $iA = $_rotation * rad2deg(atan2(($y-$cy),($x-$cx))); $nx = number_format($r * cos(deg2rad($_rotation * $a + $iA)),$_precision); $ny = number_format($r * sin(deg2rad($_rotation * $a + $iA)),$_precision); return array("x"=>$cx+$nx,"y"=>$cy+$ny); } ---- Server IP: 64.71.164.2 Probable Submitter: 69.145.110.229 ---- Manual Page -- http://www.php.net/manual/en/function.atan2.php Edit -- https://master.php.net/note/edit/75631 Del: integrated -- https://master.php.net/note/delete/75631/integrated Del: useless -- https://master.php.net/note/delete/75631/useless Del: bad code -- https://master.php.net/note/delete/75631/bad+code Del: spam -- https://master.php.net/note/delete/75631/spam Del: non-english -- https://master.php.net/note/delete/75631/non-english Del: in docs -- https://master.php.net/note/delete/75631/in+docs Del: other reasons-- https://master.php.net/note/delete/75631 Reject -- https://master.php.net/note/reject/75631 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127331) next »