CDBasicsImpl.mesa (part of Chipndale)
Copyright © 1983, 1984 by Xerox Corporation. All rights reserved.
by Christian Jacobi, May 3, 1983 4:26 pm
Last Edited by Christian Jacobi, November 5, 1984 9:33:28 am PST
DIRECTORY
CD USING [Rect],
CDBasics;
CDBasicsImpl: CEDAR PROGRAM
EXPORTS CDBasics =
BEGIN
Skip: PUBLIC PROC[CD.Rect] = {};
DecomposeRect: PUBLIC PROC [r, test: CD.Rect, inside, outside: PROC[CD.Rect]←Skip] =
BEGIN
IF r.x1<test.x1 THEN
BEGIN
outside[[x1: r.x1, y1: r.y1, x2: MIN[r.x2, test.x1], y2: r.y2]];
IF r.x2<test.x1 THEN RETURN;
END;
IF r.y1<test.y1 THEN
BEGIN
outside[[x1: MAX[test.x1, r.x1], y1: r.y1, x2: r.x2, y2: MIN[r.y2, test.y1]]];
IF r.y2<test.y1 THEN RETURN;
END;
IF test.y2<r.y2 THEN
BEGIN
outside[[x1: MAX[test.x1, r.x1], y1: MAX[test.y2, r.y1], x2: r.x2,
y2: r.y2]];
IF test.y2<r.y1 THEN RETURN;
END;
IF test.x2<r.x2 THEN
BEGIN
outside[[x1: MAX[test.x2, r.x1], y1: MAX[test.y1, r.y1], x2: r.x2,
y2: MIN[r.y2, test.y2]]];
IF test.x2<r.x1 THEN RETURN;
END;
inside[[x1: MAX[test.x1, r.x1], y1: MAX[test.y1, r.y1],
x2: MIN[test.x2, r.x2], y2: MIN[test.y2, r.y2]]];
END;
END.