DIRECTORY Imager, SV2d, SV3d, SVBasicTypes, SVModelTypes, SVSceneTypes, SVSelect; SVBoundBox: CEDAR DEFINITIONS = BEGIN BoundHedron: TYPE = SVBasicTypes.BoundHedron; BoundBox: TYPE = SVBasicTypes.BoundBox; Camera: TYPE = SVModelTypes.Camera; CoordSystem: TYPE = SVModelTypes.CoordSystem; Point2d: TYPE = SV2d.Point2d; Point3d: TYPE = SV3d.Point3d; Poly3d: TYPE = SV3d.Poly3d; Scene: TYPE = SVSceneTypes.Scene; SelectionClass: TYPE = SVSelect.SelectionClass; CreateBoundHedron: PROC [len: NAT] RETURNS [bh: BoundHedron]; AddBoundHedronPoint: PROC [bh: BoundHedron, point: Point3d]; AddBoundHedronPoly: PROC [bh: BoundHedron, poly: Poly3d]; RectangularBoundHedron: PROC [sx, sy, sz: REAL] RETURNS [bh: BoundHedron]; RectangularBoundHedron2: PROC [x1, x2, y1, y2, z1, z2: REAL] RETURNS [bh: BoundHedron]; PyramidBoundHedron: PROC [sx, sy, sz: REAL] RETURNS [bh: BoundHedron]; HexagonalBoundHedron: PROC [r, hOver2: REAL] RETURNS [bh: BoundHedron]; HexPyramidBoundHedron: PROC [r, h: REAL] RETURNS [bh: BoundHedron]; GeneralConeBoundHedron: PROC [r1, h1, r2, h2: REAL] RETURNS [bh: BoundHedron]; DiskBoundHedron: PROC [r, h: REAL] RETURNS [bh: BoundHedron]; ClearBoundHedron: PROC [bh: BoundHedron]; DrawBoundHedron: PROC [dc: Imager.Context, bh: BoundHedron, localWRTWorld: CoordSystem, camera: Camera, screen: CoordSystem]; CenterOfMassBoundHedron: PROC [bh: BoundHedron] RETURNS [cm: Point3d]; NullBoundBox: PROC [] RETURNS [bBox: BoundBox]; BoundBoxFromBoundHedron: PROC [bh: BoundHedron, camera: Camera, localCS: CoordSystem] RETURNS [boundBox: BoundBox]; FillBoundBoxFromBoundHedron: PROC [bh: BoundHedron, camera: Camera, localCS: CoordSystem, boundBox: BoundBox]; BoundBoxFromValues: PROC [minX, minY, maxX, maxY: REAL] RETURNS [boundBox: BoundBox]; BoundBoxFromRectangle: PROC [rect: Imager.Rectangle, camera: Camera] RETURNS [bBox: BoundBox]; UnionCombineBoundBoxes: PROC [bb1, bb2: BoundBox] RETURNS [newBB: BoundBox]; IntersectionCombineBoundBoxes: PROC [bb1, bb2: BoundBox] RETURNS [newBB: BoundBox]; DifferenceCombineBoundBoxes: PROC [bb1, bb2: BoundBox] RETURNS [newBB: BoundBox]; EnlargeByBox: PROC [bBox: BoundBox, by: BoundBox]; BoundBoxOfMoving: PROC [scene: Scene, camera: Camera] RETURNS [bigBox: BoundBox]; BoundBoxOfSelected: PROC [scene: Scene, camera: Camera, selectClass: SelectionClass] RETURNS [bigBox: BoundBox]; PointInBoundBox: PROC [cameraPoint: Point2d, boundBox: BoundBox] RETURNS [BOOL]; OutsideOf: PROC [test, bound: BoundBox] RETURNS [BOOL]; DrawBoundBox: PROC [dc: Imager.Context, boundBox: BoundBox, screen: CoordSystem]; EraseWithinBoundBox: PROC [dc: Imager.Context, boundBox: BoundBox, screen: CoordSystem]; Clip: PROC [dc: Imager.Context, bBox: BoundBox, screen: CoordSystem]; END. ςFile: SVBoundBox.mesa Last edited by Bier on April 17, 1987 3:46:50 pm PDT Contents: Procedures for creating bounding polyhedra of master objects, and for deriving "3-d" bounding boxes from these polyhedra. Procedures for combining these bounding boxes with union, intersection and difference operators. Bounding Polyhedra (BoundHedron for short) Rectangular parallelpiped centered on the origin with dimensions given Like RectangularBoundHedron but use limits given instead of centering on origin A pyramid with base of size sx by sz on the y=0 plane and tip at [0, sy, 0]. A vertical hexagonal prism, ie the shape which would be produced by sweeping the hexagon (which circumscribes the circle x^2 + z^2 = r^2) from [0, -h/2, 0] to [0, h/2, 0]. A pyramid having a hexagonal base of inner radius r on the y = 0 plane (centered on [0,0,]) and having tip at [0, h, 0] Bounds a cone slice (cone around y axis) with radius r1 at y=h1 and radius r2 at y = h2. Currently uses two hexagons. Octagons may follow. Bounds a disk (centered on y axis) with radius r at y = h; Bounding Boxes (e.g. Three-D blocks) These blocks tend to have two faces parallel to the screen. Hence, they can be used as two-dimensional bounding boxes by ignoring the z coordinates. Three Dimensional BoundBox Operations Takes a rectangle in screen coordinates and returns a bound box in Camera coordinates. Two Dimensional BoundBox Operations Returns TRUE if test does not overlap bound at all. Only the x and y coordinates are checked. ΚK– "cedar" style˜Iheadšœ™Iprocšœ4™4Lšœε™εL˜šΟk ˜ LšœG˜G—L˜Lšœ œ˜Lš˜˜Lšœ œ˜-Lšœ œ˜'Lšœœ˜#Lšœ œ˜-Lšœ œ˜Lšœ œ˜Lšœœ˜Lšœœ˜!Lšœœ˜/L˜—Lšœ*™*LšΟnœœœœ˜=Lšžœœ#˜