note 26423 deleted from function.hypot by nlopess
| From: | nlopess@php.net | Date: | Tue, 21 Sep 2004 15:34:06 +0000 |
| Subject: | note 26423 deleted from function.hypot by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77107@lists.php.net to get a copy of this message | ||
Note Submitter: juancri at tagnet dot org
----
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
=)