| point2line index |
|
| Name | squareMagnitude ( ) |
| Description | Returns the square magnitude (square length) of the vector. The square root function which is used when calling magnitude() is horrendously slow, so try to avoid calculating vector lengths whenever you can. A common problem in computer graphics is to find the shortest vector in a list, in this case you only need to calculate the square magnitude (x*x + y*y) for each of them and find the smallest value from that (since the vector with the shortest length will also have the smallest squared length). |
| Syntax | squareMagnitude(); |
| Returns | square magnitude of this vector (float) |
| Usage | Web & Application |
| Related | magnitude ( ) setMagnitude ( ) |
| Examples | |