AngleFromSlopeYou can convert a slope value to an angle value using the
FUNCTION AngleFromSlope (slope: Fixed): Integer;
- The slope, defined as Dx/Dy, which is the horizontal change divided by the vertical change between any two points on a line with the slope.
AngleFromSlopefunction returns the angle corresponding to the slope specified in the
MOD180. Angles are defined in clockwise degrees from 12 o'clock. The negative y-axis is defined as being at 12 o'clock, and the positive y-axis at 6 o'clock. The x-axis is defined as usual, with the positive side defined as being at 3 o'clock.
AngleFromSlopefunction is most useful when you require speed more than accuracy in performing the calculation. The integer result is within 1 degree of the correct answer, but not necessarily within half a degree.
SEE ALSOFor an example of the use of the
AngleFromSlopefunction, see Figure 3-7 on page 3-13.