IPOrient.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Preas, January 13, 1987 3:02:47 pm PST
Implements CD23 CDOrient for Phoenix
DIRECTORY
CD, CDBasics, D2Orient;
IPOrient: CEDAR DEFINITIONS
IMPORTS CDBasics
~ BEGIN
Orientation: TYPE = D2Orient.Orientation;
ComposeOrient: PROC [itemOrientInCell, cellOrientInWorld: Orientation] RETURNS [itemOrientInWorld: Orientation] ~ INLINE {
-- This procedure produces the composite orientation
-- obtained by first doing itemInCell and then
-- doing cellInWorld.
RETURN[CDBasics.ComposeOrient[itemOrientInCell, cellOrientInWorld]]};
InverseOrient: PROC [orient: Orientation] RETURNS [inverse: Orientation] ~ INLINE {
--For all orientationIndexes o1, ComposeOrient[o1, InverseOrient[o1]] = 0.
RETURN[CDBasics.InverseOrient[orient]]};
IncludesMirrorX: PROC [orient: Orientation] RETURNS [BOOLEAN] ~ INLINE {
-- returns orient includes some mirroring
RETURN[CDBasics.IncludesMirrorX[orient]]};
IncludesOddRot90: PROC [orient: Orientation] RETURNS [BOOLEAN] ~ INLINE {
-- returns orient includes an odd multiple of 90 degree
RETURN[CDBasics.IncludesOddRot90[orient]]};
CDIntToOrien: PUBLIC PROCEDURE[num: INT] RETURNS [orien: CD.Orientation];
get the CD orientation for a number like CD23
CDOrienToInt: PUBLIC PROCEDURE[orien: CD.Orientation] RETURNS [num: INT];
get the number for a CD orientation like CD23
MapPoint: PROC [pointInCell: CD.Position, cellSize: CD.Position,
cellInstOrient: Orientation, cellInstPos: CD.Position ← [0,0]]
RETURNS
[pointInWorld: CD.Position];
-- Given an point in a prototype cell,
-- the size of the prototype cell, both in "cell" co-ordinates, and
-- the position and orientation index of an instance of that cell in "world"
-- co-ordinates, this procedure returns the world
-- co-ordinates of the point.
-- WARNING: a position of a rect can not be mapped with MapPoint
OrientD2: PROC [operation: Orientation] RETURNS [INT] ~ INLINE {RETURN[
a flakey procedure; a holdover from CD23
SELECT operation FROM
original => 0, mirrorX => 0, rotate90 => 1, rotate90X => 1, rotate180 => 2, rotate180X => 2, rotate270 => 3, rotate270X => 3, ENDCASE => ERROR]
};
END.