Important: The information in this document is obsolete and should not be used for new development.
MagnitudeYou can use the
Magnitudefunction to obtain the magnitude of a vector, the length of a line, or the distance between two points.
unsigned long Magnitude (long deltaX, long deltaY);
- The difference in the x-coordinates of the vector's end points.
- The difference in the y-coordinates of the vector's end points.
- function result
- The magnitude of the vector.
Magnitudefunction returns (
deltaY2)1/2, the Euclidean distance between two points whose x-coordinates are separated by
deltaXand whose y-coordinates are separated by
The fixed-point format of the result is the same as the fixed-point format for both of the parameters. Make sure that the two parameters use the same format.