DIRECTORY SVCoordSys, GGParseIn, Imager, IO, SVPredefSweeps, Rope, SV2d, SV3d, SVAssembly, SVBasicTypes, SVBoundBox, SVBoundSphere, SVCastRays, SVDraw3d, SVFaces, SVMasterObject, SVModelTypes, SVObjectCast, SVPolygon2d, SVPolygon3d, SVScene, SVSceneTypes, SVSweepCast, SVSweepGeometry, SVParseIn, SVParseOut; SVMasterObjectImplB: CEDAR PROGRAM IMPORTS SVCoordSys, GGParseIn, IO, SVPredefSweeps, SVAssembly, SVBoundBox, SVBoundSphere, SVCastRays, SVDraw3d, SVMasterObject, SVPolygon2d, SVPolygon3d, SVScene, SVSweepCast, SVSweepGeometry, SVParseIn, SVParseOut EXPORTS SVMasterObject = BEGIN OPEN SVSceneTypes; BoundBox: TYPE = SVBasicTypes.BoundBox; BoundHedron: TYPE = SVBasicTypes.BoundHedron; Camera: TYPE = SVModelTypes.Camera; Classification: TYPE = SVSceneTypes.Classification; Composite: TYPE = SVSceneTypes.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 = SVSweepGeometry.LinearMeshArray; LinearMeshRecord: TYPE = SVSweepGeometry.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; PointPairGenerator: TYPE = REF PointPairGeneratorObj; PointPairGeneratorObj: TYPE = SVSceneTypes.PointPairGeneratorObj; Poly3d: TYPE = SV3d.Poly3d; Polygon: TYPE = SV2d.Polygon; Primitive: TYPE = SVSceneTypes.Primitive; Ray: TYPE = SVSceneTypes.Ray; RectSurface: TYPE = REF RectSurfaceObj; RectSurfaceObj: TYPE = SVObjectCast.RectSurfaceObj; RevoFace: TYPE = SVSweepCast.RevoFace; RevoluteMesh: TYPE = REF RevoluteMeshRecord; RevoluteMeshArray: TYPE = SVSweepGeometry.RevoluteMeshArray; RevoluteMeshRecord: TYPE = SVSweepGeometry.RevoluteMeshRecord; Shape: TYPE = SVSceneTypes.Shape; ShellSurface: TYPE = REF ShellSurfaceObj; ShellSurfaceObj: TYPE = SVObjectCast.ShellSurfaceObj; Slice: TYPE = SVSceneTypes.Slice; SliceDescriptor: TYPE = SVSceneTypes.SliceDescriptor; SubBoxesBody: TYPE = REF SubBoxesBodyObj; SubBoxesBodyObj: TYPE = SVSweepCast.SubBoxesBodyObj; SubSpheresBody: TYPE = REF SubSpheresBodyObj; SubSpheresBodyObj: TYPE = SVSweepCast.SubSpheresBodyObj; SurfaceArray: TYPE = REF SurfaceArrayObj; SurfaceArrayObj: TYPE = SVSceneTypes.SurfaceArrayObj; ToroidalMesh: TYPE = REF ToroidalMeshRecord; ToroidalMeshRecord: TYPE = SVSweepGeometry.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 = SVSweepCast.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 _ SVSweepCast.MakeLinSweepFaces[linMesh]; }; GetLinSweepData: PUBLIC PROC RETURNS [linMesh: LinearMesh] = { linMesh _ SVPredefSweeps.GetUnitCube[];-- for now. }; LinSweepRayCast: PUBLIC PROC [cameraPoint: Point2d, localRay: Ray, sliceD: SliceDescriptor, prim: Primitive, positiveTOnly: BOOL _ TRUE] RETURNS [class: Classification] = { mo: MasterObject _ prim.mo; rayCastBody: LinSweepHint _ NARROW[mo.rayCastBody]; class _ SVSweepCast.LinCast[localRay, prim, rayCastBody.linMesh, rayCastBody.faces, positiveTOnly]; }; LinSweepRayCastNoBBoxes: PUBLIC PROC [localRay: Ray, sliceD: SliceDescriptor, prim: Primitive, positiveTOnly: BOOL _ TRUE] RETURNS [class: Classification] = { mo: MasterObject _ prim.mo; rayCastBody: LinSweepHint _ NARROW[mo.rayCastBody]; class _ SVSweepCast.LinCast[localRay, prim, rayCastBody.linMesh, rayCastBody.faces, positiveTOnly]; }; LinSweepRayCastBoundingSpheres: PUBLIC PROC [localRay: Ray, sliceD: SliceDescriptor, prim: Primitive, positiveTOnly: BOOL _ TRUE] RETURNS [class: Classification] = { mo: MasterObject _ prim.mo; rayCastBody: LinSweepHint _ NARROW[mo.rayCastBody]; class _ SVSweepCast.LinCast[localRay, prim, rayCastBody.linMesh, rayCastBody.faces, positiveTOnly]; }; 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]; SVSweepGeometry.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; SVSweepGeometry.DrawNormalsLinearSweep[dc, linMesh, camera, localCS]; }; LinSweepCountSurf: PUBLIC PROC [masterObject: MasterObject] RETURNS [len: NAT] = { linMesh: LinearMesh _ NARROW[masterObject.shadeBody]; len _ SVSweepGeometry.CountPlanarSurfacesLinearSweep[linMesh]; }; LinSweepCountVert: PUBLIC PROC [masterObject: MasterObject] RETURNS [len: NAT] = { linMesh: LinearMesh _ NARROW[masterObject.shadeBody]; len _ SVSweepGeometry.CountVerticesLinearSweep[linMesh]; }; LinSweepGetSurf: PUBLIC PROC [slice: Slice, camera: CoordSystem, eyeWorld: Point3d] RETURNS [psl: PlanarSurfaceList] = { shape: Shape _ NARROW[slice.shape]; masterObject: MasterObject _ shape.mo; linMesh: LinearMesh _ NARROW[masterObject.shadeBody]; psl _ SVSweepGeometry.PlanarSurfacesLinearSweep[linMesh, slice, camera]; }; LinSweepDrawSurf: PUBLIC PROC [dc: Imager.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera, eyeWorld: Point3d, hiddenLine: BOOL] = { SVSweepGeometry.DrawPlanarSurfaceLinearSweep[dc, ps, lightSources, camera, hiddenLine]; }; 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 SVParseOut.FileoutPoint3dAsPoint2d[f, lma[i][1]]; f.PutF[","]; ENDLOOP; SVParseOut.FileoutPoint3dAsPoint2d[f, lma[len][1]]; f.PutChar[IO.CR]; }; LinearFilein: PUBLIC PROC [f: IO.STREAM, name: Rope.ROPE, csList: CoordSysList, defaultCS: CoordSystem, wdir: Rope.ROPE, version: REAL, feedback: FeedbackData] RETURNS [mo: MasterObject] = { count: NAT; frontDepth, backDepth: REAL; poly: Polygon; instanceName: Rope.ROPE; linMesh: LinearMesh; GGParseIn.ReadWRope[f, "name:"]; instanceName _ GGParseIn.ReadWWord[f]; GGParseIn.ReadWRope[f, "frontDepth:"]; frontDepth _ GGParseIn.ReadWReal[f]; GGParseIn.ReadWRope[f, ","]; GGParseIn.ReadWRope[f, "backDepth:"]; backDepth _ GGParseIn.ReadWReal[f]; GGParseIn.ReadWRope[f, "DataPoints ["]; count _ GGParseIn.ReadWNAT[f]; GGParseIn.ReadWRope[f, "]:"]; GGParseIn.ReadBlank[f]; poly _ SVPolygon2d.CreatePoly[count]; FOR i: NAT IN[1..count-1] DO poly _ SVPolygon2d.PutPolyPoint[poly, i-1, SVParseIn.ReadPoint2d[f]]; GGParseIn.ReadWRope[f, ","]; GGParseIn.ReadBlank[f]; ENDLOOP; poly _ SVPolygon2d.PutPolyPoint[poly, count-1, SVParseIn.ReadPoint2d[f]]; GGParseIn.ReadBlank[f]; linMesh _ SVSweepGeometry.LinearSweep[poly, frontDepth, backDepth]; mo _ LinSweepMakeMasterObject[name, linMesh]; }; LinearFileoutPoly: PUBLIC PROC [f: IO.STREAM, mo: MasterObject] = { linMesh: LinearMesh _ NARROW[mo.shadeBody]; SVSweepGeometry.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 _ SVSweepGeometry.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 _ SVSweepGeometry.RevoluteSweep[path, SVPredefSweeps.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 = SVSweepCast.RevoSweepFaces; RevoSweepRayCastBody: TYPE = REF RevoSweepRayCastBodyObj; RevoSweepRayCastBodyObj: TYPE = RECORD [faces: RevoSweepFaces]; RevoSweepGetRayCastBody: PROC [revMesh: RevoluteMesh] RETURNS [rayCastBody: RevoSweepRayCastBody] = { rayCastBody _ NEW[RevoSweepRayCastBodyObj]; rayCastBody.faces _ SVSweepCast.MakeRevoSweepFaces[revMesh]; }; RevoSweepRayCast: PUBLIC PROC [cameraPoint: Point2d, localRay: Ray, sliceD: SliceDescriptor, prim: Primitive, positiveTOnly: BOOL _ TRUE] RETURNS [class: Classification] = { mo: MasterObject _ prim.mo; rayCastBody: RevoSweepRayCastBody _ NARROW[mo.rayCastBody]; revoHint: RevoSweepHint _ NARROW[prim.hints]; RETURN[SVSweepCast.RevoCast[cameraPoint, localRay, prim, rayCastBody.faces, revoHint.boxes, positiveTOnly]]; }; RevoSweepRayCastNoBBoxes: PUBLIC PROC [localRay: Ray, sliceD: SliceDescriptor, prim: Primitive, positiveTOnly: BOOL _ TRUE] RETURNS [class: Classification] = { mo: MasterObject _ prim.mo; rayCastBody: RevoSweepRayCastBody _ NARROW[mo.rayCastBody]; RETURN[SVSweepCast.RevoCastNoBBoxes[localRay, prim, rayCastBody.faces, positiveTOnly]]; }; RevoSweepRayCastBoundingSpheres: PUBLIC PROC [localRay: Ray, sliceD: SliceDescriptor, prim: Primitive, positiveTOnly: BOOL _ TRUE] RETURNS [class: Classification] = { mo: MasterObject _ prim.mo; rayCastBody: RevoSweepRayCastBody _ NARROW[mo.rayCastBody]; revoHint: RevoSweepHint _ NARROW[prim.hints]; RETURN[SVSweepCast.RevoCastBoundSpheres[localRay, prim, rayCastBody.faces, revoHint.spheres, positiveTOnly]]; }; 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 _ SVCoordSys.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]; SVSweepGeometry.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; SVSweepGeometry.DrawNormalsRevoluteSweep[dc, revMesh, camera, localCS]; }; RevoSweepCountSurf: PUBLIC PROC [masterObject: MasterObject] RETURNS [len: NAT] = { revMesh: RevoluteMesh _ NARROW[masterObject.shadeBody]; len _ SVSweepGeometry.CountPlanarSurfacesRevoluteSweep[revMesh]; }; RevoSweepCountVert: PUBLIC PROC [masterObject: MasterObject] RETURNS [len: NAT] = { revMesh: RevoluteMesh _ NARROW[masterObject.shadeBody]; len _ SVSweepGeometry.CountVerticesRevoluteSweep[revMesh]; }; RevoSweepGetSurf: PUBLIC PROC [slice: Slice, camera: CoordSystem, eyeWorld: Point3d] RETURNS [psl: PlanarSurfaceList] = { shape: Shape _ NARROW[slice.shape]; masterObject: MasterObject _ shape.mo; revMesh: RevoluteMesh _ NARROW[masterObject.shadeBody]; psl _ SVSweepGeometry.PlanarSurfacesRevoluteSweep[revMesh, slice, camera]; }; RevoSweepDrawSurf: PUBLIC PROC [dc: Imager.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera, eyeWorld: Point3d, hiddenLine: BOOL] = { SVSweepGeometry.DrawPlanarSurfaceRevoluteSweep[dc, ps, lightSources, camera, hiddenLine]; }; 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 SVParseOut.FileoutPoint3dAsPoint2d[f, rma[i][long]]; f.PutF[","]; IF (i/3)*3 = i THEN f.PutF["\n"]; -- CR TAB ENDLOOP; SVParseOut.FileoutPoint3dAsPoint2d[f, rma[lat][long]]; f.PutChar[IO.CR]; }; RevoluteFilein: PUBLIC PROC [f: IO.STREAM, name: Rope.ROPE, csList: CoordSysList, defaultCS: CoordSystem, wdir: Rope.ROPE, version: REAL, feedback: FeedbackData] RETURNS [mo: MasterObject] = { lat, long, count: NAT; path: Path; GGParseIn.ReadWRope[f, "lat:"]; lat _ GGParseIn.ReadWNAT[f]; GGParseIn.ReadWRope[f, ","]; GGParseIn.ReadWRope[f, "long:"]; long _ GGParseIn.ReadWNAT[f]; GGParseIn.ReadWRope[f, "points"]; GGParseIn.ReadWRope[f, "["]; count _ GGParseIn.ReadWNAT[f]; GGParseIn.ReadWRope[f, "]:"]; GGParseIn.ReadBlank[f]; path _ SVPolygon2d.CreatePath[count]; FOR i: NAT IN[1..count-1] DO SVPolygon2d.PutPathPoint[path, i-1, SVParseIn.ReadPoint2d[f]]; GGParseIn.ReadWRope[f, ","]; GGParseIn.ReadBlank[f]; ENDLOOP; SVPolygon2d.PutPathPoint[path, lat-1, SVParseIn.ReadPoint2d[f]]; GGParseIn.ReadBlank[f]; mo _ RevoSweepMakeMasterObject[name, path, long]; }; RevoluteFileoutPoly: PUBLIC PROC [f: IO.STREAM, mo: MasterObject] = { revMesh: RevoluteMesh _ NARROW[mo.shadeBody]; SVSweepGeometry.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 NoOpDrawSelectionFeedback: PUBLIC DrawSelectionFeedbackProc = {}; NoOpDrawAttractorFeedback: PUBLIC DrawAttractorFeedbackProc = { slice: Slice _ sliceD.slice; pointGen: SVSceneTypes.PointGenerator; IF dragInProgress AND selectedParts # NIL THEN {} ELSE { pointGen _ SVAssembly.PointsInDescriptor[sliceD, FALSE]; FOR pointAndDone: SVSceneTypes.PointAndDone _ SVAssembly.NextPoint[pointGen], SVAssembly.NextPoint[pointGen] UNTIL pointAndDone.done DO SVDraw3d.DrawCP[dc, pointAndDone.point, camera]; ENDLOOP; }; }; 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]}; NoOpIsEmptyParts: PUBLIC IsEmptyPartsProc = { RETURN[TRUE]; }; NoOpIsCompleteParts: PUBLIC IsCompletePartsProc = { RETURN[FALSE]; }; 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, centroids: FALSE, classSpecific: NIL ]]; RETURN[pointGen]; }; NoOpNextPoint: PUBLIC NextPointProc = { pointAndDone.done _ TRUE; pointAndDone.point _ [0,0,0]; }; NoOpPointPairsInDescriptor: PUBLIC PointPairsInDescriptorProc = { pointPairGen: PointPairGenerator; pointPairGen _ NEW[PointPairGeneratorObj _ [ sliceD: sliceD, toGo: 0, index: 0, classSpecific: NIL ]]; RETURN[pointPairGen]; }; NoOpNextPointPair: PUBLIC NextPointPairProc = { pointPairAndDone.done _ TRUE; pointPairAndDone.lo _ [0,0,0]; pointPairAndDone.hi _ [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 = { }; NoOpSetStrokeColor: PUBLIC SetStrokeColorProc = { }; NoOpGetStrokeColor: PUBLIC GetStrokeColorProc = { }; NoOpSetFillColor: PUBLIC SetFillColorProc = { }; NoOpGetFillColor: PUBLIC GetFillColorProc = { }; 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. 4File: SVMasterObjectImplB.mesa Last edited by: Eric Bier on September 1, 1987 7:00:08 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. Style Κͺ˜Iheadšœ™Iprocšœ=™=Jšœ Οmœ1™Lšœžœ˜!Lšœžœžœ˜)Lšœžœ ˜5Lšœžœ˜!Lšœžœ ˜5Lšœžœžœ˜)Lšœžœ˜4Lšœžœžœ˜-Lšœžœ!˜8Lšœžœžœ˜)Lšœžœ ˜5Lšœžœžœ˜,Lšœžœ&˜>Lšœžœžœ˜/Lšœžœ#˜;Lšœ žœžœ˜'Lšœžœ˜3L˜J– "Cedar" stylešΟb œžœ™1J– "Cedar" stylešŸ œžœ™/J– "Cedar" stylešŸœžœ ™5J– "Cedar" stylešŸœžœ™3J– "Cedar" stylešŸ œžœ™-J– "Cedar" stylešŸœžœ$™=J– "Cedar" stylešŸœžœ+™KJ– "Cedar" stylešŸœžœ&™AJ– "Cedar" stylešŸœžœ!™7J– "Cedar" stylešŸœžœ#™;J– "Cedar" stylešΟn œžœ™+J– "Cedar" styleš  œžœ™-J– "Cedar" stylešŸœžœ ™5J– "Cedar" stylešŸœžœ(™EJ– "Cedar" stylešŸœžœ&™AJ– "Cedar" stylešŸœžœ'™CJ– "Cedar" stylešŸ œžœ™1J– "Cedar" styleš  œžœ™+˜L˜—Lšœ™™Lšœ'˜'L˜—L˜š  œžœžœ žœžœ˜kLšœ žœžœžœ˜Lšœ žœžœ ˜Lšœ žœžœ ˜Lšœ žœžœ#˜7Lšœ\˜\Lšœ˜—š  œžœžœ žœžœ˜GLšœ˜—š œžœžœžœ˜_Lšœžœ˜4Lšœ žœ˜Lšœ1˜1Lšžœžœžœž˜ Lšžœžœžœž˜Lšœ<˜Lšœ'Οc ˜2Lšœ˜—š  œžœžœ`žœžœžœ˜¬Lšœ˜Lšœžœ˜3Lšœc˜cLšœ˜—š  œžœžœJžœžœžœ˜žLšœ˜Lšœžœ˜3Lšœc˜cLšœ˜—š  œžœžœJžœžœžœ˜₯Lšœ˜Lšœžœ˜3Lšœc˜cLšœ˜—š œžœžœ6˜SLšœ&˜&Lšœžœ˜1Lšœ˜Lšœ žœ˜LšœB˜BLšœ˜—š  œžœžœžœžœ+˜mLšœ˜Lšžœžœ˜Lšžœ žœ˜Lšžœžœ ˜+LšœE˜ELšœ˜—š  œžœžœžœžœ˜RLšœžœ˜5Lšœ>˜>Lšœ˜—š  œžœžœžœžœ˜RLšœžœ˜5Lšœ8˜8Lšœ˜—š  œžœžœ(Οuœ žœ˜xLšœžœ˜#Lšœ&˜&Lšœžœ˜5LšœH˜HLšœ˜—š  œžœžœ[’œžœ˜LšœW˜WLšœ˜—š   œžœžœžœžœ˜?Lšœžœ˜*Lšœ%˜%Lšœžœ˜Lšœ%˜%LšœN™NLšœT˜TLšœ+˜+Lšžœžœžœ ž˜Lšœ1˜1Lšœ ˜ Lšžœ˜Lšœ3˜3Lšœ žœžœ˜Lšœ˜—š  œžœžœžœžœ žœ;žœ žœžœ˜ΎLšœžœ˜ Lšœžœ˜Lšœ˜Lšœžœ˜Lšœ˜Lšœ ˜ Lšœ&˜&Lšœ&˜&Lšœ$˜$Lšœ˜Lšœ%˜%Lšœ#˜#Lšœ'˜'Lšœ˜Lšœ˜Lšœ˜Lšœ%˜%šžœžœžœ ž˜LšœE˜ELšœ˜Lšœ˜—Lšžœ˜LšœI˜ILšœ˜LšœC˜CLšœ-˜-Lšœ˜—š  œžœžœžœžœ˜CLšœžœ˜+Lšœ+˜+L˜—L˜Lšœžœžœ˜)šœžœžœ˜ L˜ L˜—š  œžœžœ žœžœžœ˜nLšœžœ!˜=Lšœ žœžœ˜Lšœ žœžœ˜Lšœ žœžœ˜Lšœ˜Lšœ4˜4Lšœ˜Lšœ˜Lšœ/˜/Lšœ]˜]Lšœ˜—š  œžœžœ žœžœ˜HLšœ˜Lšœžœ˜-Lšœ˜LšœT˜TLšœ˜Lšœ˜Lšœ2˜2L˜L˜—š œžœžœžœ˜`Lšœžœ˜7Lšœ žœ‘ ˜8Lšœ ˜ Lšœ1˜1L˜Lšžœžœžœž˜,LšœU™ULšœ7˜7Lšœ/˜/Lšœ+˜+Lšžœ˜Lšœ˜—Lšœžœžœ˜+šœžœžœ˜!Lšœ˜Lšœ˜—Lšœžœ˜2Lšœžœžœ˜9Lšœžœžœ˜?š œžœžœ(˜eLšœžœ˜+Lšœ<˜˜>Lšœ˜Lšœ˜—Lšžœ˜Lšœ@˜@Lšœ˜Lšœ1˜1Lšœ˜—š  œžœžœžœžœ˜ELšœžœ˜-Lšœ-˜-L˜—L˜head2šœ™J– "Cedar" stylešœU™U—J˜Mšœ ™ JšŸ œžœžœžœ˜4Mšœ™Jš  œžœ*˜>Jš œžœ-˜DJš œžœ2˜Hš  œžœ˜#Jšœ&˜&Jšœ!˜!Jšœ˜—š œžœ˜3Jšœ&˜&Jšœ!˜!Jšœ˜—š œžœ˜AJšœ&˜&Jšœ!˜!Jšœ˜—Jš œžœ3˜PJš œžœ/˜GJš œžœ‘˜KJš œžœ ˜Aš œžœ˜?Jšœ˜Jšœ&˜&Jšžœžœžœžœ˜1šžœ˜Jšœ1žœ˜8šžœjžœž˜‡Jšœ0˜0Jšžœ˜—J˜—J˜J˜—Mšœ™Mš  œžœ‘˜6Mš œžœ‘ ˜