<<>> <> <> <> DIRECTORY TerminalIO; ImplicitKDTreeImpl: CEDAR PROGRAM IMPORTS TerminalIO EXPORTS ImplicitKDTree ~ BEGIN <> Cell: TYPE ~ RECORD [ type: MajorPlane, box: Box, value: REAL, -- position of x, y, or z plane primitives: LIST OF Primitive, subCell1, subCell2: Cell ]; <> GetCells: PUBLIC PROC [p: Triple, tree: Cell] RETURNS [LIST OF Primitive] ~ { IF tree.subCell1 = NIL OR tre.subCel2 = NIL THEN RETURN[tree.primmitives] ELSE GetCells[sp, SELECT tree.type FROM x => IF p.x < tree.value THEN tree.subCell1 ELSE tree.subCell2, y => IF p.y < tree.value THEN tree.subCell1 ELSE tree.subCell2, z => IF p.z < tree.value THEN tree.subCell1 ELSE tree.subCell2, ENDCASE; }; MakeTree: PROC [primtivies: LIST OF Primitive, depth: NAT] RETURNS [root: Cell] ~ { type: MajorPlane ¬ x; Cut: [mp: MajorPlane] ~ { FOR l: LIST OF Primitive ¬ primitives, l.rest WHILE l # NIL DO <> <> <> <> <> }; END.