Important: The information in this document is obsolete and should not be used for new development.
Magnitude
You can use theMagnitude
function 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);
deltaX
- The difference in the x-coordinates of the vector's end points.
deltaY
- The difference in the y-coordinates of the vector's end points.
- function result
- The magnitude of the vector.
DESCRIPTION
TheMagnitude
function returns (deltaX2
+deltaY2
)1/2, the Euclidean distance between two points whose x-coordinates are separated bydeltaX
and whose y-coordinates are separated bydeltaY
.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.