note 26423 added to function.hypot
| From: | juancri at rack1 dot php dot net | Date: | Wed, 30 Oct 2002 13:38:00 +0000 |
| Subject: | note 26423 added to function.hypot | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38748@lists.php.net to get a copy of this message | ||
This function could be used to get the size of a vector. Suppose you have 2 coordinates:
(x1, y1) and (x2, y2)
(2,2) and (5,6)
The scalar value of the vector is:
hypot (y2-y1, x2-x1)
hypot (6-2, 5-2)
Use the trigonometrical functions to get the angle:
atan ((y2-y1)/(x2-x1)) // radians
rad2deg (atan ((y2-y1)/(x2-x1))) // degrees
=)
--
http://www.php.net/manual/en/function.hypot.php
http://master.php.net/manage/user-notes.php?action=edit+26423
http://master.php.net/manage/user-notes.php?action=delete+26423
http://master.php.net/manage/user-notes.php?action=reject+26423