DIRECTORY G3dBasic, G3dShape, G3dBox; G3dGrid: CEDAR DEFINITIONS ~ BEGIN Box: TYPE ~ G3dBox.Box; Shape: TYPE ~ G3dShape.Shape; NatSequence: TYPE ~ G3dBasic.NatSequence; Triple: TYPE ~ G3dBasic.Triple; Object: TYPE ~ REF ObjectRep; ObjectRep: TYPE ~ RECORD [ type: ATOM ¬ $Unknown, index: NAT ¬ 0, clientData: REF ¬ NIL ]; CellData: TYPE ~ REF CellDataRep; CellDataRep: TYPE ~ RECORD [ box: Box ¬ [], objects: ObjectSequence ¬ NIL ]; Grid3d: TYPE ~ REF Grid3dRep; Grid3dRep: TYPE ~ RECORD [ xRes, yRes, zRes: NAT ¬ 0, box: Box ¬ [], cellData: CellDataSequence ¬ NIL ]; ObjectSequence: TYPE ~ REF ObjectSequenceRep; ObjectSequenceRep: TYPE ~ RECORD [ length: CARDINAL ¬ 0, element: SEQUENCE maxLength: CARDINAL OF Object ]; CellDataSequence: TYPE ~ REF CellDataSequenceRep; CellDataSequenceRep: TYPE ~ RECORD [ length: CARDINAL ¬ 0, element: SEQUENCE maxLength: CARDINAL OF CellData ]; TripleList: TYPE ~ LIST OF Triple; GridProc: TYPE ~ PROC [cellData: CellData, client: REF ANY] RETURNS [CellData]; TestGridProc: TYPE ~ PROC [cellData: CellData, client: REF ANY] RETURNS [continue: BOOL ¬ TRUE]; CreateGrid: PROC [box: Box, xRes: NAT ¬ 8, yRes, zRes: NAT ¬ 0] RETURNS [Grid3d]; CreateGridFromShape: PROC [shape: Shape, xRes: NAT ¬ 8, yRes, zRes: NAT ¬ 0] RETURNS [Grid3d]; InsertNatsIntoGrid: PROC [shape: Shape, grid: Grid3d, nats: NatSequence, surfID: INT, clientData: REF ¬ NIL]; InsertSurfaceIntoGrid: PUBLIC PROC [shape: Shape, grid: Grid3d, surfID: INT, clientData: REF ¬ NIL]; InsertTripleListIntoGrid: PUBLIC PROC [vertices: TripleList, grid: Grid3d, surfID: INT, clientData: REF ¬ NIL]; RemoveSurfaceFromGrid: PROC [grid: Grid3d, surfID: INT]; VisitGrid: PROC [grid: Grid3d, proc: GridProc, client: REF ANY ¬ NIL]; TestGrid: PROC [grid: Grid3d, proc: TestGridProc, client: REF ANY ¬ NIL]; CopyGrid: PROC [grid: Grid3d] RETURNS [Grid3d]; GridIndexFromXYZ: PROC [grid: Grid3d, x, y, z: INT] RETURNS [INT]; CopyObjectSequence: PROC [objects: ObjectSequence] RETURNS [ObjectSequence]; AddToObjectSequence: PROC [objects: ObjectSequence, object: Object] RETURNS [ObjectSequence]; LengthenObjectSequence: PROC [objects: ObjectSequence, amount: REAL ¬ 1.3] RETURNS [ObjectSequence]; CopyCellDataSequence: PROC [cells: CellDataSequence] RETURNS [CellDataSequence]; AddToCellDataSequence: PROC [cells: CellDataSequence, cell: CellData] RETURNS [CellDataSequence]; LengthenCellDataSequence: PROC [cells: CellDataSequence, amount: REAL ¬ 1.3] RETURNS [CellDataSequence]; END. R G3dGrid.mesa Copyright Σ 1985, 1992 by Xerox Corporation. All rights reserved. Glassner, February 18, 1991 3:48 pm PST Jules Bloomenthal July 15, 1992 4:04 pm PDT Imported Types New Types Callback Proc Types Passes the data describing this cell, and replaces the grid data with the returned value Passes the data describing this cell. If continue, the enumeration continues. Creation Procs Create and return a new grid with the given resolution, in the given box. The grid is a rectangular array of equally-spaced cells, with the specified resolutions on each axis. If either yRes or zRes are not given or are given as 0, the value of xRes is used instead. A resolution of 0 on any axis is illegal. This is a primitive call; use CreateGridFromShape to build a grid from a shape. Create a new grid, and add into it all the surfaces in the shape. See the comments for CreateGrid above for the last three arguments. Polygon Insertion and Deletion Procs Insert a polygon into the grid. The nats are vertex indices into the shape, the ID is the reference number of the polygon, and clientData will be stored with the surface. Convenience procedure to insert the identified surface into the grid. Convenience procedure to insert the vertexList into the grid. Delete all references to the polygon with this surface id from the grid. Grid Visiting Procs Call the client procedure for every cell in the grid. The value returned by the proc is stored as the new value for that cell. Call the client procedure for every cell in the grid. If the client proc returns FALSE, stop the enumeration. Cell contents are not changed. Utility Procs Return a copy of the grid. Auxiliary Procs I don't think clients should ever need these. But heck, this is a new interface, so they're here in case I've forgotten something important. If you ever use one of these let me know, otherwise I'll elide them from the interface at some convenient future date (today is 14 Feb 91). Return the index for this cell; -1 is returned if out of bounds. Traditional support for ObjectSequences. Traditional support for CellDataSequences. ΚV•NewlineDelimiter –"cedarcode" style™™ Jšœ Οeœ6™BJ™'J™+J˜JšΟk œ˜%J˜—šΡblnœžœž ˜J˜—Jšœž˜headšΟl™Jšœ žœ˜Jšœ žœ˜ Jšœžœ˜+Jšœ žœ˜"—š  ™ Jšœ žœžœ ˜!šœžœžœ˜Jšœ žœ ˜Jšœ žœ˜Jšœžœž˜J˜J˜—Jšœžœžœ ˜&šœžœžœ˜J˜Jšœž˜"J˜—J˜Jšœ žœžœ ˜!šœžœžœ˜Jšœžœ˜J˜Jšœ"ž˜%Jšœ˜J˜—Jšœžœžœ˜/šœžœžœ˜#Jšœ žœ˜Jšœžœ žœžœ˜4J˜J˜—Jšœžœžœ˜2šœžœžœ˜$Jšœ žœ˜Jšœžœ žœžœ ˜6J˜J˜—Jšœžœžœžœ˜%—š ™š œ žœžœžœžœžœ ˜OJšœX™XJ˜—šœžœžœžœžœžœ žœžœ˜`J™N——š ™š Οn œžœžœžœžœ ˜QJ™ˆJ™—š ‘œžœžœžœžœ ˜^J™†——š $™$š ‘œžœ9žœžœžœ˜mJ™«—J˜š ‘œžœžœ&žœžœžœ˜dJ™EJ™—š ‘œžœžœ.žœžœžœ˜oJ™=—J˜š‘œžœžœ˜8J™H——š ™š ‘ œžœ(žœžœžœ˜FJ™J™—š ‘œžœ,žœžœžœ˜IJ™Ž——š  ™ š‘œžœžœ ˜/J™——š ™™šJ™—š ‘œžœžœžœžœ˜BJ™@J™—J™*Jš‘œžœžœ˜LJš‘œžœ+žœ˜]Jš‘œžœ#žœžœ˜dJ™J™*Jš‘œžœžœ˜PJš‘œžœ+žœ˜aJš‘œžœ#žœžœ˜hJ™—Jšžœ˜J˜—…— Δ