<> <> <> <<>> <> <<>> 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]; <> CDOrienToInt: PUBLIC PROCEDURE[orien: CD.Orientation] RETURNS [num: INT]; <> 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[ <> SELECT operation FROM original => 0, mirrorX => 0, rotate90 => 1, rotate90X => 1, rotate180 => 2, rotate180X => 2, rotate270 => 3, rotate270X => 3, ENDCASE => ERROR] }; END.