       Advanced Search           Log In | Not a Member? Contact ADC    Inside Macintosh: Operating System Utilities /
Chapter 3 - Mathematical and Logical Utilities / Mathematical and Logical Utilities Reference
Routines / Converting Between Angle and Slope Values

### AngleFromSlope

You can convert a slope value to an angle value using the `AngleFromSlope` function.

```FUNCTION AngleFromSlope (slope: Fixed): Integer;
```
`slope`
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.
##### DESCRIPTION
The `AngleFromSlope` function returns the angle corresponding to the slope specified in the `slope` parameter treated `MOD` 180. 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.

##### SPECIAL CONSIDERATIONS
The `AngleFromSlope` function 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.

For an example of the use of the `AngleFromSlope` function, see Figure 3-7 on page 3-13.         Get information on Apple products. Visit the Apple Store online or at retail locations. 1-800-MY-APPLE Copyright © 2004 Apple Computer, Inc. All rights reserved. | Terms of use | Privacy Notice