DIRECTORY CoordSys, Imager, IO, PredefSweeps, Rope, SV2d, SV3d, SVAssembly, SVBasicTypes, SVBoundBox, SVBoundSphere, SVCastRays, SVFaces, SVMasterObject, SVModelTypes, SVObjectCast, SVPolygon2d, SVPolygon3d, SVRayTypes, SVScene, SVSceneTypes, SweepCast, SweepGeometry, TFI3d, TFO3d; SVMasterObjectImplB: CEDAR PROGRAM IMPORTS CoordSys, IO, PredefSweeps, SVAssembly, SVBoundBox, SVBoundSphere, SVCastRays, SVMasterObject, SVPolygon2d, SVPolygon3d, SVScene, SweepCast, SweepGeometry, TFI3d, TFO3d EXPORTS SVMasterObject = BEGIN OPEN SVSceneTypes; BoundBox: TYPE = SVBasicTypes.BoundBox; BoundHedron: TYPE = SVBasicTypes.BoundHedron; Camera: TYPE = SVModelTypes.Camera; Classification: TYPE = SVRayTypes.Classification; Composite: TYPE = SVRayTypes.Composite; Cone: TYPE = SVFaces.Cone; ConeSurface: TYPE = REF ConeSurfaceObj; ConeSurfaceObj: TYPE = SVObjectCast.ConeSurfaceObj; CoordSystem: TYPE = SVModelTypes.CoordSystem; Cylinder: TYPE = SVFaces.Cylinder; DiskRing: TYPE = SVFaces.DiskRing; DiskSurface: TYPE = REF DiskSurfaceObj; DiskSurfaceObj: TYPE = SVObjectCast.DiskSurfaceObj; LightSourceList: TYPE = SVModelTypes.LightSourceList; LinearMesh: TYPE = REF LinearMeshRecord; LinearMeshArray: TYPE = SweepGeometry.LinearMeshArray; LinearMeshRecord: TYPE = SweepGeometry.LinearMeshRecord; MasterObject: TYPE = SVSceneTypes.MasterObject; MasterObjectClass: TYPE = SVSceneTypes.MasterObjectClass; MasterObjectClassList: TYPE = SVSceneTypes.MasterObjectClassList; MasterObjectClassObj: TYPE = SVSceneTypes.MasterObjectClassObj; MasterObjectList: TYPE = SVSceneTypes.MasterObjectList; Matrix4by4: TYPE = SV3d.Matrix4by4; Path: TYPE = SV2d.Path; PlanarSurface: TYPE = SVSceneTypes.PlanarSurface; PlanarSurfaceList: TYPE = SVSceneTypes.PlanarSurfaceList; Point2d: TYPE = SV2d.Point2d; PointGenerator: TYPE = REF PointGeneratorObj; PointGeneratorObj: TYPE = SVSceneTypes.PointGeneratorObj; Poly3d: TYPE = SV3d.Poly3d; Polygon: TYPE = SV2d.Polygon; Primitive: TYPE = SVRayTypes.Primitive; Ray: TYPE = SVRayTypes.Ray; RectSurface: TYPE = REF RectSurfaceObj; RectSurfaceObj: TYPE = SVObjectCast.RectSurfaceObj; RevoFace: TYPE = SweepCast.RevoFace; RevoluteMesh: TYPE = REF RevoluteMeshRecord; RevoluteMeshArray: TYPE = SweepGeometry.RevoluteMeshArray; RevoluteMeshRecord: TYPE = SweepGeometry.RevoluteMeshRecord; Shape: TYPE = SVSceneTypes.Shape; ShellSurface: TYPE = REF ShellSurfaceObj; ShellSurfaceObj: TYPE = SVObjectCast.ShellSurfaceObj; Slice: TYPE = SVSceneTypes.Slice; SubBoxesBody: TYPE = REF SubBoxesBodyObj; SubBoxesBodyObj: TYPE = SweepCast.SubBoxesBodyObj; SubSpheresBody: TYPE = REF SubSpheresBodyObj; SubSpheresBodyObj: TYPE = SweepCast.SubSpheresBodyObj; SurfaceArray: TYPE = REF SurfaceArrayObj; SurfaceArrayObj: TYPE = SVRayTypes.SurfaceArrayObj; ToroidalMesh: TYPE = REF ToroidalMeshRecord; ToroidalMeshRecord: TYPE = SweepGeometry.ToroidalMeshRecord; ToroidalSurface: TYPE = REF ToroidalSurfaceObj; ToroidalSurfaceObj: TYPE = SVObjectCast.ToroidalSurfaceObj; TubeSurface: TYPE = REF TubeSurfaceObj; TubeSurfaceObj: TYPE = SVObjectCast.TubeSurfaceObj; linClass, revoClass: MasterObjectClass; LinSweepMakeMasterObject: PUBLIC PROC [name: Rope.ROPE, linMesh: LinearMesh] RETURNS [mo: MasterObject] = { mainBody: REF ANY _ NIL; lineBody: REF ANY _ linMesh; shadeBody: REF ANY _ lineBody; rayCastBody: REF ANY _ LinSweepGetRayCastBody[linMesh]; mo _ SVScene.CreateMasterObject[name, linClass, mainBody, lineBody, shadeBody, rayCastBody]; }; LinSweepUpdate: PUBLIC PROC [mo: MasterObject, updateData: REF ANY] = { }; LinSweepBoundHedron: PUBLIC PROC [masterObject: MasterObject] RETURNS [hedron: BoundHedron] = { linMesh: LinearMesh _ NARROW[masterObject.lineBody]; vertCount: NAT _ 2*linMesh.len; hedron _ SVBoundBox.CreateBoundHedron[vertCount]; FOR i: NAT IN[1..linMesh.len] DO FOR j: NAT IN[1..2] DO SVBoundBox.AddBoundHedronPoint[hedron, linMesh.array[i][j]]; ENDLOOP; ENDLOOP; }; LinSweepFaces: TYPE = SweepCast.LinSweepFaces; LinSweepHint: TYPE = REF LinSweepHintObj; LinSweepHintObj: TYPE = RECORD [linMesh: LinearMesh, faces: LinSweepFaces]; LinSweepGetRayCastBody: PROC [linMesh: LinearMesh] RETURNS [hint: LinSweepHint] = { hint _ NEW[LinSweepHintObj]; hint.linMesh _ linMesh; hint.faces _ SweepCast.MakeLinSweepFaces[linMesh]; }; GetLinSweepData: PUBLIC PROC RETURNS [linMesh: LinearMesh] = { linMesh _ PredefSweeps.GetUnitCube[];-- for now. }; LinSweepRayCast: PUBLIC PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification] = { mo: MasterObject _ NARROW[masterObject]; rayCastBody: LinSweepHint _ NARROW[mo.rayCastBody]; class _ SweepCast.LinCast[localRay, prim, rayCastBody.linMesh, rayCastBody.faces]; }; LinSweepRayCastNoBBoxes: PUBLIC PROC [localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification] = { mo: MasterObject _ NARROW[masterObject]; rayCastBody: LinSweepHint _ NARROW[mo.rayCastBody]; class _ SweepCast.LinCast[localRay, prim, rayCastBody.linMesh, rayCastBody.faces]; }; LinSweepRayCastBoundingSpheres: PUBLIC PROC [localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification] = { mo: MasterObject _ NARROW[masterObject]; rayCastBody: LinSweepHint _ NARROW[mo.rayCastBody]; class _ SweepCast.LinCast[localRay, prim, rayCastBody.linMesh, rayCastBody.faces]; }; LinSweepLineDraw: PUBLIC PROC[slice: Slice, dc: Imager.Context, camera: Camera] = { localCS: CoordSystem _ slice.coordSys; mo: MasterObject _ NARROW[slice.shape, Shape].mo; linMesh: LinearMesh; linMesh _ NARROW[mo.lineBody]; SweepGeometry.LineDrawLinearSweep[dc, linMesh, camera, localCS]; }; LinSweepDrawNormals: PUBLIC PROC[dc: Imager.Context, data: REF ANY, camera: Camera, localCS: CoordSystem] = { linMesh: LinearMesh; IF ISTYPE[data, LinearMesh] THEN linMesh _ NARROW[data] ELSE SIGNAL SVMasterObject.WrongTypeOfData; SweepGeometry.DrawNormalsLinearSweep[dc, linMesh, camera, localCS]; }; LinSweepCountSurf: PUBLIC PROC [masterObject: MasterObject] RETURNS [len: NAT] = { linMesh: LinearMesh _ NARROW[masterObject.shadeBody]; len _ SweepGeometry.CountPlanarSurfacesLinearSweep[linMesh]; }; LinSweepCountVert: PUBLIC PROC [masterObject: MasterObject] RETURNS [len: NAT] = { linMesh: LinearMesh _ NARROW[masterObject.shadeBody]; len _ SweepGeometry.CountVerticesLinearSweep[linMesh]; }; LinSweepGetSurf: PUBLIC PROC [slice: Slice, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList] = { shape: Shape _ NARROW[slice.shape]; masterObject: MasterObject _ shape.mo; linMesh: LinearMesh _ NARROW[masterObject.shadeBody]; psl _ SweepGeometry.PlanarSurfacesLinearSweep[linMesh, slice, camera]; }; LinSweepDrawSurf: PUBLIC PROC [dc: Imager.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera] = { SweepGeometry.DrawPlanarSurfaceLinearSweep[dc, ps, lightSources, camera]; }; LinearFileout: PUBLIC PROC [f: IO.STREAM, mo: MasterObject] = { linMesh: LinearMesh _ NARROW[mo.lineBody]; lma: LinearMeshArray _ linMesh.array; len: NAT _ linMesh.len; f.PutF["name: %g\n",[rope[mo.name]]]; f.PutF["frontDepth: %g, backDepth: %g\n",[real[lma[1][1][3]]],[real[lma[1][2][3]]]]; f.PutF["DataPoints [%g]: ",[integer[len]]]; FOR i: NAT IN[1..len-1] DO TFO3d.FileoutPoint3dAsPoint2d[f, lma[i][1]]; f.PutF[","]; ENDLOOP; TFO3d.FileoutPoint3dAsPoint2d[f, lma[len][1]]; f.PutChar[IO.CR]; }; LinearFilein: PUBLIC PROC [f: IO.STREAM, name: Rope.ROPE, version: REAL] RETURNS [mo: MasterObject] = { count: NAT; frontDepth, backDepth: REAL; poly: Polygon; instanceName: Rope.ROPE; linMesh: LinearMesh; TFI3d.ReadRope[f, "name:"]; instanceName _ TFI3d.ReadBlankAndWord[f]; TFI3d.ReadBlankAndRope[f, "frontDepth:"]; frontDepth _ TFI3d.ReadBlankAndReal[f]; TFI3d.ReadBlankAndRope[f, ","]; TFI3d.ReadBlankAndRope[f, "backDepth:"]; backDepth _ TFI3d.ReadBlankAndReal[f]; TFI3d.ReadBlankAndRope[f, "DataPoints ["]; count _ TFI3d.ReadNAT[f]; TFI3d.ReadBlankAndRope[f, "]:"]; TFI3d.ReadBlank[f]; poly _ SVPolygon2d.CreatePoly[count]; FOR i: NAT IN[1..count-1] DO poly _ SVPolygon2d.PutPolyPoint[poly, i-1, TFI3d.ReadPoint2d[f]]; TFI3d.ReadBlankAndRope[f, ","]; TFI3d.ReadBlank[f]; ENDLOOP; poly _ SVPolygon2d.PutPolyPoint[poly, count-1, TFI3d.ReadPoint2d[f]]; TFI3d.ReadBlank[f]; linMesh _ SweepGeometry.LinearSweep[poly, frontDepth, backDepth]; mo _ LinSweepMakeMasterObject[name, linMesh]; }; LinearFileoutPoly: PUBLIC PROC [f: IO.STREAM, mo: MasterObject] = { linMesh: LinearMesh _ NARROW[mo.shadeBody]; SweepGeometry.PolyListLinear[f, linMesh]; }; RevoSweepRec: TYPE = REF RevoSweepRecObj; RevoSweepRecObj: TYPE = RECORD [ path: Path ]; RevoSweepMakeMasterObject: PUBLIC PROC [name: Rope.ROPE, path: Path, long: NAT] RETURNS [mo: MasterObject] = { mainBody: RevoSweepRec _ NEW[RevoSweepRecObj _ [path: path]]; lineBody: REF ANY; shadeBody: REF ANY; rayCastBody: REF ANY; revMesh: RevoluteMesh; revMesh _ SweepGeometry.RevoluteSweep[path, long]; lineBody _ revMesh; shadeBody _ lineBody; rayCastBody _ RevoSweepGetRayCastBody[revMesh]; mo _ SVScene.CreateMasterObject[name, revoClass, mainBody, lineBody, shadeBody, rayCastBody]; }; RevoSweepUpdate: PUBLIC PROC [mo: MasterObject, updateData: REF ANY] = { revMesh: RevoluteMesh; mainBody: RevoSweepRec _ NARROW[mo.mainBody]; path: Path _ mainBody.path; revMesh _ SweepGeometry.RevoluteSweep[path, PredefSweeps.GetLinesOfLongitude[]]; mo.lineBody _ revMesh; mo.shadeBody _ mo.lineBody; mo.rayCastBody _ RevoSweepGetRayCastBody[revMesh]; }; RevoSweepBoundHedron: PUBLIC PROC [masterObject: MasterObject] RETURNS [hedron: BoundHedron] = { revMesh: RevoluteMesh _ NARROW[masterObject.shadeBody]; vertCount: NAT _ revMesh.linesOfLatitude*6;-- hexagons*6 hex: Poly3d; hedron _ SVBoundBox.CreateBoundHedron[vertCount]; FOR i: NAT IN[1..revMesh.linesOfLatitude] DO hex _ SVPolygon3d.CircumHexagon[revMesh.array[i][1][2], revMesh.array[i][revMesh.linesOfLongitude][1]]; SVBoundBox.AddBoundHedronPoly[hedron, hex]; ENDLOOP; }; RevoSweepHint: TYPE = REF RevoSweepHintObj; RevoSweepHintObj: TYPE = RECORD [ boxes: SubBoxesBody, spheres: SubSpheresBody]; RevoSweepFaces: TYPE = SweepCast.RevoSweepFaces; RevoSweepRayCastBody: TYPE = REF RevoSweepRayCastBodyObj; RevoSweepRayCastBodyObj: TYPE = RECORD [faces: RevoSweepFaces]; RevoSweepGetRayCastBody: PROC [revMesh: RevoluteMesh] RETURNS [rayCastBody: RevoSweepRayCastBody] = { rayCastBody _ NEW[RevoSweepRayCastBodyObj]; rayCastBody.faces _ SweepCast.MakeRevoSweepFaces[revMesh]; }; RevoSweepRayCast: PUBLIC PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification] = { mo: MasterObject _ NARROW[masterObject]; rayCastBody: RevoSweepRayCastBody _ NARROW[mo.rayCastBody]; revoHint: RevoSweepHint _ NARROW[prim.hints]; RETURN[SweepCast.RevoCast[cameraPoint, localRay, prim, rayCastBody.faces, revoHint.boxes]]; }; RevoSweepRayCastNoBBoxes: PUBLIC PROC [localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification] = { mo: MasterObject _ NARROW[masterObject]; rayCastBody: RevoSweepRayCastBody _ NARROW[mo.rayCastBody]; RETURN[SweepCast.RevoCastNoBBoxes[localRay, prim, rayCastBody.faces]]; }; RevoSweepRayCastBoundingSpheres: PUBLIC PROC [localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification] = { mo: MasterObject _ NARROW[masterObject]; rayCastBody: RevoSweepRayCastBody _ NARROW[mo.rayCastBody]; revoHint: RevoSweepHint _ NARROW[prim.hints]; RETURN[SweepCast.RevoCastBoundSpheres[localRay, prim, rayCastBody.faces, revoHint.spheres]]; }; RevoSweepPreprocess: PUBLIC PROC [prim: Primitive, camera: Camera] = { revoSweepHint: RevoSweepHint _ NEW[RevoSweepHintObj]; mo: MasterObject _ NARROW[prim.mo]; rayCastBody: RevoSweepRayCastBody _ NARROW[mo.rayCastBody]; faces: RevoSweepFaces _ rayCastBody.faces; boxes: SubBoxesBody; spheres: SubSpheresBody; worldCS: CoordSystem _ CoordSys.Parent[camera.coordSys]; revoSweepHint.boxes _ NEW[SubBoxesBodyObj[faces.len]]; revoSweepHint.spheres _ NEW[SubSpheresBodyObj[faces.len]]; boxes _ revoSweepHint.boxes; spheres _ revoSweepHint.spheres; FOR i: NAT IN[0..faces.len) DO WITH faces[i] SELECT FROM cone: Cone => { boxes[i] _ SVBoundBox.BoundBoxFromBoundHedron[cone.boundHedron, camera, prim.localCS]; spheres[i] _ SVBoundSphere.BoundSphereFromBoundHedron[cone.boundHedron, worldCS, prim.localCS]; }; ring: DiskRing=> { boxes[i] _ SVBoundBox.BoundBoxFromBoundHedron[ring.boundHedron, camera, prim.localCS]; spheres[i] _ SVBoundSphere.BoundSphereFromBoundHedron[ring.boundHedron, worldCS, prim.localCS]; }; cyl: Cylinder=> { boxes[i] _ SVBoundBox.BoundBoxFromBoundHedron[cyl.boundHedron, camera, prim.localCS]; spheres[i] _ SVBoundSphere.BoundSphereFromBoundHedron[cyl.boundHedron, worldCS, prim.localCS]; }; ENDCASE => ERROR; ENDLOOP; spheres.len _ faces.len; boxes.len _ faces.len; prim.hints _ revoSweepHint; }; RevoSweepLineDraw: PUBLIC PROC[slice: Slice, dc: Imager.Context, camera: Camera] = { localCS: CoordSystem _ slice.coordSys; mo: MasterObject _ NARROW[slice.shape, Shape].mo; revMesh: RevoluteMesh; revMesh _ NARROW[mo.lineBody]; SweepGeometry.LineDrawRevoluteSweep[dc, revMesh, camera, localCS]; }; RevoSweepDrawNormals: PUBLIC PROC[dc: Imager.Context, data: REF ANY, camera: Camera, localCS: CoordSystem] = { revMesh: RevoluteMesh; IF ISTYPE[data, RevoluteMesh] THEN revMesh _ NARROW[data] ELSE SIGNAL SVMasterObject.WrongTypeOfData; SweepGeometry.DrawNormalsRevoluteSweep[dc, revMesh, camera, localCS]; }; RevoSweepCountSurf: PUBLIC PROC [masterObject: MasterObject] RETURNS [len: NAT] = { revMesh: RevoluteMesh _ NARROW[masterObject.shadeBody]; len _ SweepGeometry.CountPlanarSurfacesRevoluteSweep[revMesh]; }; RevoSweepCountVert: PUBLIC PROC [masterObject: MasterObject] RETURNS [len: NAT] = { revMesh: RevoluteMesh _ NARROW[masterObject.shadeBody]; len _ SweepGeometry.CountVerticesRevoluteSweep[revMesh]; }; RevoSweepGetSurf: PUBLIC PROC [slice: Slice, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList] = { shape: Shape _ NARROW[slice.shape]; masterObject: MasterObject _ shape.mo; revMesh: RevoluteMesh _ NARROW[masterObject.shadeBody]; psl _ SweepGeometry.PlanarSurfacesRevoluteSweep[revMesh, slice, camera]; }; RevoSweepDrawSurf: PUBLIC PROC [dc: Imager.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera] = { SweepGeometry.DrawPlanarSurfaceRevoluteSweep[dc, ps, lightSources, camera]; }; RevoSweepDrawSubBoxes: PUBLIC PROC [dc: Imager.Context, prim: Primitive, screenCS: CoordSystem] = { revoHint: RevoSweepHint _ NARROW[prim.hints]; boxes: SubBoxesBody _ revoHint.boxes; FOR i: NAT IN [0..boxes.len) DO SVBoundBox.DrawBoundBox[dc, boxes[i], screenCS]; ENDLOOP; }; RevoSweepDrawSubSpheres: PUBLIC PROC [dc: Imager.Context, prim: Primitive, camera: Camera] = { revoHint: RevoSweepHint _ NARROW[prim.hints]; spheres: SubSpheresBody _ revoHint.spheres; FOR i: NAT IN [0..spheres.len) DO SVBoundSphere.DrawBoundSphere[dc, spheres[i], camera]; ENDLOOP; }; RevoluteFileout: PUBLIC PROC [f: IO.STREAM, mo: MasterObject] = { rma: RevoluteMeshArray; revMesh: RevoluteMesh _ NARROW[mo.lineBody]; lat, long: NAT; rma _ revMesh.array; lat _ revMesh.linesOfLatitude; long _ revMesh.linesOfLongitude; f.PutF["lat: %g, long: %g\npoints [%g]:\n", -- TAB [integer[lat]],[integer[long]],[integer[lat]]]; FOR i: NAT IN[1..lat-1] DO TFO3d.FileoutPoint3dAsPoint2d[f, rma[i][long]]; f.PutF[","]; IF (i/3)*3 = i THEN f.PutF["\n"]; -- CR TAB ENDLOOP; TFO3d.FileoutPoint3dAsPoint2d[f, rma[lat][long]]; f.PutChar[IO.CR]; }; RevoluteFilein: PUBLIC PROC [f: IO.STREAM, name: Rope.ROPE, version: REAL] RETURNS [mo: MasterObject] = { lat, long, count: NAT; path: Path; TFI3d.ReadBlankAndRope[f, "lat:"]; lat _ TFI3d.ReadBlankAndNAT[f]; TFI3d.ReadBlankAndRope[f, ","]; TFI3d.ReadBlankAndRope[f, "long:"]; long _ TFI3d.ReadBlankAndNAT[f]; TFI3d.ReadBlankAndRope[f, "points"]; TFI3d.ReadBlankAndRope[f, "["]; count _ TFI3d.ReadBlankAndNAT[f]; TFI3d.ReadBlankAndRope[f, "]:"]; TFI3d.ReadBlank[f]; path _ SVPolygon2d.CreatePath[count]; FOR i: NAT IN[1..count-1] DO SVPolygon2d.PutPathPoint[path, i-1, TFI3d.ReadPoint2d[f]]; TFI3d.ReadBlankAndRope[f, ","]; TFI3d.ReadBlank[f]; ENDLOOP; SVPolygon2d.PutPathPoint[path, lat-1, TFI3d.ReadPoint2d[f]]; TFI3d.ReadBlank[f]; mo _ RevoSweepMakeMasterObject[name, path, long]; }; RevoluteFileoutPoly: PUBLIC PROC [f: IO.STREAM, mo: MasterObject] = { revMesh: RevoluteMesh _ NARROW[mo.shadeBody]; SweepGeometry.PolyListRevolute[f, revMesh]; }; NoOpGetHedron: PUBLIC GetHedronProc = {RETURN[NIL]}; NoOpLineDraw: PUBLIC LineDrawProc = {}; -- don't draw anything NoOpNormalsDraw: PUBLIC NormalsDrawProc = {}; -- don't draw anything NoOpPreprocess: PUBLIC PreprocessProc = {}; -- don't preprocess anything NoOpRayCast: PUBLIC RayCastProc = { class _ SVCastRays.GetClassFromPool[]; SVCastRays.MakeClassAMiss[class]; }; NoOpRayCastNoBBoxes: PUBLIC RayCastNoBBoxesProc = { class _ SVCastRays.GetClassFromPool[]; SVCastRays.MakeClassAMiss[class]; }; NoOpRayCastBoundingSpheres: PUBLIC RayCastBoundingSpheresProc = { class _ SVCastRays.GetClassFromPool[]; SVCastRays.MakeClassAMiss[class]; }; NoOpDrawPlanarSurface: PUBLIC DrawPlanarSurfaceProc = {}; -- don't draw anything NoOpDrawSubBoxes: PUBLIC DrawSubBoxesProc = {}; -- don't draw anything NoOpDrawSubSpheres: PUBLIC DrawSubSpheresProc = {}; -- don't draw anything NoOpDescribe: PUBLIC DescribeProc = {}; -- say nothing NoOpDescribeHit: PUBLIC DescribeHitProc = {}; -- say nothing NoOpFilein: PUBLIC FileinProc = {}; NoOpFileout: PUBLIC FileoutProc = {}; NoOpFileoutPoly: PUBLIC FileoutPolyProc = {}; NoOpCountPlanarSurfaces: PUBLIC CountSurfProc = {RETURN[0]}; NoOpGetPlanarSurfaces: PUBLIC GetSurfProc = {RETURN[NIL]}; NoOpEmptyParts: PUBLIC EmptyPartsProc = { RETURN[TRUE]; }; NoOpNewParts: PUBLIC NewPartsProc = { sliceD _ SVAssembly.DescriptorFromParts[slice, NIL]; }; NoOpUnionParts: PUBLIC UnionPartsProc = { }; NoOpDifferenceParts: PUBLIC DifferencePartsProc = { }; NoOpMovingParts: PUBLIC MovingPartsProc = { }; NoOpAugmentParts: PUBLIC AugmentPartsProc = { }; NoOpPointsInDescriptor: PUBLIC PointsInDescriptorProc = { pointGen: PointGenerator; pointGen _ NEW[PointGeneratorObj _ [ sliceD: sliceD, toGo: 0, index: 0, classSpecific: NIL ]]; RETURN[pointGen]; }; NoOpNextPoint: PUBLIC NextPointProc = { pointAndDone.done _ TRUE; pointAndDone.point _ [0,0,0]; }; NoOpClosestPointToPoint: PUBLIC ClosestPointToPointProc = { success _ FALSE; }; NoOpClosestPointToLine: PUBLIC ClosestPointToLineProc = { success _ FALSE; }; NoOpClosestSegmentToPoint: PUBLIC ClosestSegmentToPointProc = { success _ FALSE; }; NoOpClosestSegmentToLine: PUBLIC ClosestSegmentToLineProc = { success _ FALSE; }; NoOpUpdate: PUBLIC UpdateProc = { }; Init: PROC = { linClass _ NEW[MasterObjectClassObj _ [ name: "linearSweep", update: LinSweepUpdate, filein: LinearFilein, fileout: LinearFileout, fileoutPoly: LinearFileoutPoly, rayCast: LinSweepRayCast, rayCastNoBBoxes: LinSweepRayCastNoBBoxes, rayCastBoundingSpheres: LinSweepRayCastBoundingSpheres, getHedron: LinSweepBoundHedron, preprocess: NoOpPreprocess, lineDraw: LinSweepLineDraw, normalsDraw: LinSweepDrawNormals, countSurf: LinSweepCountSurf, getSurf: LinSweepGetSurf, pointsInDescriptor: NoOpPointsInDescriptor, nextPoint: NoOpNextPoint, drawSurf: LinSweepDrawSurf, drawSubBoxes: NoOpDrawSubBoxes, drawSubSpheres: NoOpDrawSubSpheres]]; revoClass _ NEW[MasterObjectClassObj _ [ name: "revoluteSweep", update: RevoSweepUpdate, filein: RevoluteFilein, fileout: RevoluteFileout, fileoutPoly: RevoluteFileoutPoly, rayCast: RevoSweepRayCast, rayCastNoBBoxes: RevoSweepRayCastNoBBoxes, rayCastBoundingSpheres: RevoSweepRayCastBoundingSpheres, getHedron: RevoSweepBoundHedron, preprocess: RevoSweepPreprocess, lineDraw: RevoSweepLineDraw, normalsDraw: RevoSweepDrawNormals, countSurf: RevoSweepCountSurf, getSurf: RevoSweepGetSurf, pointsInDescriptor: NoOpPointsInDescriptor, nextPoint: NoOpNextPoint, drawSurf: RevoSweepDrawSurf, drawSubBoxes: RevoSweepDrawSubBoxes, drawSubSpheres: RevoSweepDrawSubSpheres]]; SVMasterObject.RegisterMasterObjectClass[linClass]; SVMasterObject.RegisterMasterObjectClass[revoClass]; }; Init[]; END. (File: SVMasterObjectImplB.mesa Last edited by: Eric Bier on May 5, 1987 11:47:07 pm PDT Copyright c 1984 by Xerox Corporation. All rights reserved. Contents: Defines a simple set of objects which can be display with ray casting, line drawing, or shaded planar-surface approximation. GENERAL TYPES GetHedronProc: TYPE = SVSceneTypes.GetHedronProc; LineDrawProc: TYPE = SVSceneTypes.LineDrawProc; NormalsDrawProc: TYPE = SVSceneTypes.NormalsDrawProc; PreprocessProc: TYPE = SVSceneTypes.PreprocessProc; RayCastProc: TYPE = SVSceneTypes.RayCastProc; RayCastNoBBoxesProc: TYPE = SVSceneTypes.RayCastNoBBoxesProc; RayCastBoundingSpheresProc: TYPE = SVSceneTypes.RayCastBoundingSpheresProc; DrawPlanarSurfaceProc: TYPE = SVSceneTypes.DrawPlanarSurfaceProc; DrawSubBoxesProc: TYPE = SVSceneTypes.DrawSubBoxesProc; DrawSubSpheresProc: TYPE = SVSceneTypes.DrawSubSpheresProc; FileinProc: TYPE = SVSceneTypes.FileinProc; FileoutProc: TYPE = SVSceneTypes.FileoutProc; FileoutPolyProc: TYPE = SVSceneTypes.FileoutPolyProc; CountPlanarSurfacesProc: TYPE = SVSceneTypes.CountPlanarSurfacesProc; GetPlanarSurfacesProc: TYPE = SVSceneTypes.GetPlanarSurfacesProc; PointsInDescriptorProc: TYPE = SVSceneTypes.PointsInDescriptorProc; NextPointProc: TYPE = SVSceneTypes.NextPointProc; UpdateProc: TYPE = SVSceneTypes.UpdateProc; GLOBAL VARIABLES Assume that the defining contour has not been rotated. Output elements [i][1] the radius at this line of latitude is revMesh.array[i][revMesh.linesOfLongitude][1]; prim.hints is a set of bounding boxes assume that the defining contour has not been rotated. Output the [i][long] points Noop Procedures A master object can use these entries if it doesn't implement one of these procedures Fundamentals Drawing Textual Description Parts PROC [slice: Slice, hitData: REF ANY, hitPoint: Point3d, mode: SelectMode] RETURNS [sliceD: SliceDescriptor]; Part Generators HitTest PROC [sliceD: SliceDescriptor, testPoint: Point3d, criticalR: REAL] RETURNS [bestDist: REAL, pointWORLD: Point3d, hitData: REF ANY, success: BOOL]; PROC [sliceD: SliceDescriptor, cameraPoint: Point2d, line3d: Line3d, criticalR: REAL, camera: Camera] RETURNS [bestDist: REAL, pointWORLD: Point3d, hitData: REF ANY, success: BOOL]; PROC [sliceD: SliceDescriptor, testPoint: Point3d, criticalR: REAL] RETURNS [bestDist: REAL, pointWORLD: Point3d, hitData: REF ANY, success: BOOL]; PROC [sliceD: SliceDescriptor, cameraPoint: Point2d, line3d: Line3d, criticalR: REAL, camera: Camera] RETURNS [bestDist: REAL, pointWORLD: Point3d, hitData: REF ANY, success: BOOL]; Miscellaneous Don't update anything. Κ ˜Iheadšœ™Iprocšœ8™8Jšœ Οmœ1™Lšœ%Οc ˜0Lšœ˜—š  œžœžœ5žœžœžœ˜ŽLšœžœ˜(Lšœžœ˜3LšœR˜RLšœ˜—š  œžœžœžœžœžœ˜€Lšœžœ˜(Lšœžœ˜3LšœR˜RLšœ˜—š  œžœžœžœžœžœ˜‡Lšœžœ˜(Lšœžœ˜3LšœR˜RLšœ˜—š œžœžœ6˜SLšœ&˜&Lšœžœ˜1Lšœ˜Lšœ žœ˜Lšœ@˜@Lšœ˜—š  œžœžœžœžœ+˜mLšœ˜Lšžœžœ˜Lšžœ žœ˜Lšžœžœ ˜+LšœC˜CLšœ˜—š  œžœžœžœžœ˜RLšœžœ˜5Lšœ<˜˜>Lšœ˜—š  œžœžœžœžœ˜SLšœžœ˜7Lšœ8˜8Lšœ˜—š œžœžœ%žœ˜fLšœžœ˜#Lšœ&˜&Lšœžœ˜7LšœH˜HLšœ˜—š œžœžœ[˜yLšœK˜KLšœ˜—š œžœžœA˜cLšœžœ˜.Lšœ%˜%šžœžœžœž˜Lšœ0˜0Lšžœ˜—Lšœ˜—š œžœžœ:˜^Lšœžœ˜.Lšœ+˜+šžœžœžœž˜!Lšœ6˜6Lšžœ˜—Lšœ˜—š  œžœžœžœžœ˜ALšœ˜Lšœžœ˜,Lšœ žœ˜Lšœ˜Lšœ˜Lšœ ˜ LšœR™RLšœ,‘˜2Lšœ/˜/šžœžœžœ ž˜Lšœ/˜/Lšœ ˜ Lšžœ žœ‘ ˜+Lšžœ˜—Lšœ1˜1Lšœ žœžœ˜Lšœ˜—š œžœžœžœžœ žœ žœžœ˜iLšœžœ˜Lšœ ˜ Lšœ"˜"Lšœ˜Lšœ˜Lšœ#˜#Lšœ ˜ Lšœ$˜$Lšœ˜Lšœ!˜!Lšœ ˜ Lšœ˜Lšœ%˜%šžœžœžœ ž˜Lšœ:˜:Lšœ˜Lšœ˜—Lšžœ˜Lšœ<˜Jš œžœ-˜DJš œžœ2˜Hš  œžœ˜#Jšœ&˜&Jšœ!˜!Jšœ˜—š œžœ˜3Jšœ&˜&Jšœ!˜!Jšœ˜—š œžœ˜AJšœ&˜&Jšœ!˜!Jšœ˜—Jš œžœ3˜PJš œžœ/˜GJš œžœ‘˜KMšœ™Mš  œžœ‘˜6Mš œžœ‘ ˜