GGAngle: CEDAR DEFINITIONS = BEGIN Normalize: PROC [anyRange: REAL] RETURNS [range180: REAL]; AsSlope: PROC [anyRange: REAL] RETURNS [pos180: REAL]; Add: PROC [position, increment: REAL] RETURNS [finalPosition: REAL]; ClockwiseAngle: PROC [fromPosition, toPosition: REAL] RETURNS [increment: REAL]; CounterClockwiseAngle: PROC [fromPosition, toPosition: REAL] RETURNS [increment: REAL]; ShortestDifference: PROC [position1, position2: REAL] RETURNS [pos1MinusPos2: REAL]; Scale: PROC [angle: REAL, scalar: REAL] RETURNS [angleTimesScalar: REAL]; ArcTan: PROC [numerator, denominator: REAL] RETURNS [degrees: REAL]; IsInCCWInterval: PROC [testPosition: REAL, fromPosition, toPosition: REAL] RETURNS [BOOL]; IsInCCWInterval2: PROC [testPosition: REAL, fromPosition, increment: REAL] RETURNS [BOOL]; AlmostParallel: PROC [pos1, pos2: REAL, epsilon: REAL] RETURNS [BOOL]; END.  File: GGAngle.mesa Last edited by Bier on June 4, 1985 6:14:56 pm PDT Author: Eric Bier on February 9, 1987 4:59:33 pm PST Contents: Gargoyle requires a precise set of angle operations defined with angle "theta" in the range -180 < theta <= 180. "theta" is an absolute angle (ie a position around the circle measured from the positive x axis). Given two positions angles T1 and T2 we can find the incremental clockwise angle CT between them or the incremental counter-clockwise angle CCT where -360 < CT <= 0 and 0 <= CCT < 360. When we add two angles, we are adding an incremental angle to a position angle to get a new position angle. We subtract two position angles to get an incremental angle. All angles are in degrees. Pier, December 6, 1985 10:01:09 am PST Takes an angle in degrees and puts it in -180 < theta <= 180 form. Takes an angle in degrees and puts it in 0 <= theta < 180 form. This may require adding 180 degrees for negative angles. All angles in degrees All angles in degrees. -360 < increment <= 0 All angles in degrees. 0 <= increment < 360. For example, if the clockwise angle is -90, the counter-clockwise angle will be 270. All angles in degrees. RETURNS ClockwiseAngle or CounterClockwiseAngle. Whichever is smaller. -180< pos1MinusPos2 <= 180. All angles in degrees. Think of angle as the increment from 0 degrees to angle degrees. Scale this and normalize. Has the effect of calling RealFns.ArcTanDegrees and normalizing the result. Consider the set of angles encountered when traveling counterclockwise from angle "fromPosition" to angle "toPosition" around a circle. Is testPosition one of the angles encountered? pos1 and pos2 are assumed to be in -180 < theta <= 180. Return TRUE if they are the same angle +- epsilon or if they differ by 180+- epsilon. Κυ˜Icodešœ™Kšœ2™2Kšœ4™4šœέ™έK™&—K˜Kšœ Οkœ œ˜Kš˜K˜š Οn œœ œœ œ˜:KšœB™B—š žœœ œœ œ˜6Kšœy™y—š žœœœœœ˜DKšœ™—š žœœœœ œ˜PKšœ,™,—š žœœœœ œ˜WKšœ,™,KšœT™T—š žœœœœœ˜UKšœ{™{—K˜š žœœ œ œœœ˜IKšœr™r—K˜š žœœœœ œ˜DKšœK™K—K˜Kš žœœœœœœ˜Zš žœœœœœœ˜ZKšœ·™·K™—š žœœœ œœœ˜FK™ŽK˜—K˜Kšœ˜K˜—…—t u