-- File: BasicObject3d.mesa
-- Last edited by Bier on December 18, 1982 1:26 am
-- Author: Eric Bier on January 2, 1983 8:43 pm
-- Contents: Defines a simple set of objects which can be display with ray casting, line drawing, or shaded planar-surface approximation

DIRECTORY
 CoordSys,
CSG,
 CSGGraphics,
 CastRays,
 DisplayList3d,
 Graphics,
IO,
 ObjectCast,
 Rope,
 SV2d,
 SVBoundBox,
 SweepGeometry;

BasicObject3d: DEFINITIONS =
BEGIN

BoundHedron: TYPE = SVBoundBox.BoundHedron;
Camera: TYPE = CSGGraphics.Camera;
LinearMesh: TYPE = SweepGeometry.LinearMesh;
LightSourceList: TYPE = DisplayList3d.LightSourceList;
MasterObject: TYPE = REF MasterObjectRec;
MasterObjectRec: TYPE = DisplayList3d.MasterObjectRec;
Point2d: TYPE = SV2d.Point2d;
Primitive: TYPE = CSG.Primitive;
RevoluteMesh: TYPE = SweepGeometry.RevoluteMesh;
Assembly: TYPE = REF AssemblyObj;
AssemblyObj: TYPE = DisplayList3d.AssemblyObj;
CoordSystem: TYPE = REF CoordSysObj;
CoordSysObj: TYPE = CoordSys.CoordSysObj;

Classification: TYPE = REF ClassificationObj;
ClassificationObj: TYPE = CastRays.ClassificationObj;

Ray: TYPE = REF RayObj;
RayObj: TYPE = CSG.RayObj;

PlanarSurface: TYPE = REF PlanarSurfaceObj;
PlanarSurfaceObj: TYPE = DisplayList3d.PlanarSurfaceObj;
PlanarSurfaceList: TYPE = DisplayList3d.PlanarSurfaceList;

-- BASIC SHAPES

SphereRec: TYPE = REF SphereRecObj;
SphereRecObj: TYPE = RECORD [
 radius: REAL];

BlockRec: TYPE = REF BlockRecObj;
BlockRecObj: TYPE = RECORD [
 x, y, z: REAL];

CylinderRec: TYPE = REF CylinderRecObj;
CylinderRecObj: TYPE = RECORD [
 radius, height: REAL];

ConeRec: TYPE = REF ConeRecObj;
ConeRecObj: TYPE = RECORD [
 radius, height: REAL];

TorusRec: TYPE = REF TorusRecObj;
TorusRecObj: TYPE = RECORD [
 bigRadius: REAL,
 sectionRadius: REAL];

LonelyAssemblyHasSon: ERROR; -- returned from *PrimitiveFromAssembly is assembly is not a primitive assembly
WrongTypeOfData: SIGNAL; -- signalled if the assembly given to *PrimitiveFromAssembly has an assembly.object which is not a MasterObject;

SphereMakeMasterObject: PROC [name: Rope.ROPE] RETURNS [mo: MasterObject];
SphereGetBoundHedron: PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
SphereRayCast: PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification];
SpherePreprocess: PROC [prim: Primitive, camera: Camera];
SphereLineDraw: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
SphereDrawNormals: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
SphereCountSurf: PROC [masterObject: MasterObject] RETURNS [len: NAT];
SphereCountVert: PROC [masterObject: MasterObject] RETURNS [len: NAT];
SphereGetSurf: PROC [assembly: Assembly, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList];
SphereDrawSurf: PROC [dc: Graphics.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera];
SphereDrawSubBoxes: PROC [dc: Graphics.Context, prim: Primitive, screenCS: CoordSystem];
SphereFileout: PROC [f: IO.STREAM, mo: MasterObject];
SphereFilein: PROC [f: IO.STREAM, name: Rope.ROPE] RETURNS [mo: MasterObject];

BlockMakeMasterObject: PROC [name: Rope.ROPE] RETURNS [mo: MasterObject];
BlockGetBoundHedron: PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
BlockRayCast: PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification];
BlockPreprocess: PROC [prim: Primitive, camera: Camera];
BlockLineDraw: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
BlockDrawNormals: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
BlockCountSurf: PROC [masterObject: MasterObject] RETURNS [len: NAT];
BlockCountVert: PROC [masterObject: MasterObject] RETURNS [len: NAT];
BlockGetSurf: PROC [assembly: Assembly, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList];
BlockDrawSurf: PROC [dc: Graphics.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera];
BlockDrawSubBoxes: PROC [dc: Graphics.Context, prim: Primitive, screenCS: CoordSystem];
BlockFileout: PROC [f: IO.STREAM, mo: MasterObject];
BlockFilein: PROC [f: IO.STREAM, name: Rope.ROPE] RETURNS [mo: MasterObject];

CylinderMakeMasterObject: PROC [name: Rope.ROPE] RETURNS [mo: MasterObject];
CylinderBoundHedron: PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
CylinderRayCast: PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification];
CylinderPreprocess: PROC [prim: Primitive, camera: Camera];
CylinderLineDraw: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
CylinderDrawNormals: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
CylinderCountSurf: PROC [masterObject: MasterObject] RETURNS [len: NAT];
CylinderCountVert: PROC [masterObject: MasterObject] RETURNS [len: NAT];
CylinderGetSurf: PROC [assembly: Assembly, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList];
CylinderDrawSurf: PROC [dc: Graphics.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera];
CylinderDrawSubBoxes: PROC [dc: Graphics.Context, prim: Primitive, screenCS: CoordSystem];
CylinderFileout: PROC [f: IO.STREAM, mo: MasterObject];
CylinderFilein: PROC [f: IO.STREAM, name: Rope.ROPE] RETURNS [mo: MasterObject];

ConeMakeMasterObject: PROC [name: Rope.ROPE] RETURNS [mo: MasterObject];
ConeBoundHedron: PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
ConeRayCast: PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification];
ConePreprocess: PROC [prim: Primitive, camera: Camera];
ConeLineDraw: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
ConeDrawNormals: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
ConeCountSurf: PROC [masterObject: MasterObject] RETURNS [len: NAT];
ConeCountVert: PROC [masterObject: MasterObject] RETURNS [len: NAT];
ConeGetSurf: PROC [assembly: Assembly, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList];
ConeDrawSurf: PROC [dc: Graphics.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera];
ConeDrawSubBoxes: PROC [dc: Graphics.Context, prim: Primitive, screenCS: CoordSystem];
ConeFileout: PROC [f: IO.STREAM, mo: MasterObject];
ConeFilein: PROC [f: IO.STREAM, name: Rope.ROPE] RETURNS [mo: MasterObject];

TorusMakeMasterObject: PROC [name: Rope.ROPE, bigRadius: REAL, sectionRadius: REAL] RETURNS [mo: MasterObject];
TorusBoundHedron: PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
TorusRayCast: PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification];
TorusPreprocess: PROC [prim: Primitive, camera: Camera];
TorusLineDraw: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
TorusDrawNormals: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
TorusCountSurf: PROC [masterObject: MasterObject] RETURNS [len: NAT];
TorusCountVert: PROC [masterObject: MasterObject] RETURNS [len: NAT];
TorusGetSurf: PROC [assembly: Assembly, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList];
TorusDrawSurf: PROC [dc: Graphics.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera];
TorusDrawSubBoxes: PROC [dc: Graphics.Context, prim: Primitive, screenCS: CoordSystem];
TorusFileout: PROC [f: IO.STREAM, mo: MasterObject];
TorusFilein: PROC [f: IO.STREAM, name: Rope.ROPE] RETURNS [mo: MasterObject];

LinSweepMakeMasterObject: PROC [name: Rope.ROPE, linMesh: LinearMesh] RETURNS [mo: MasterObject];
LinSweepBoundHedron: PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
LinSweepRayCast: PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification];
LinSweepPreprocess: PROC [prim: Primitive, camera: Camera];
LinSweepLineDraw: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
LinSweepDrawNormals: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
LinSweepCountSurf: PROC [masterObject: MasterObject] RETURNS [len: NAT];
LinSweepCountVert: PROC [masterObject: MasterObject] RETURNS [len: NAT];
LinSweepGetSurf: PROC [assembly: Assembly, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList];
LinSweepDrawSurf: PROC [dc: Graphics.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera];
LinSweepDrawSubBoxes: PROC [dc: Graphics.Context, prim: Primitive, screenCS: CoordSystem];
LinSweepFileout: PROC [f: IO.STREAM, mo: MasterObject];
LinSweepFilein: PROC [f: IO.STREAM, name: Rope.ROPE] RETURNS [mo: MasterObject];

RevoSweepMakeMasterObject: PROC [name: Rope.ROPE, revMesh: RevoluteMesh] RETURNS [mo: MasterObject];
RevoSweepBoundHedron: PROC [mo: MasterObject] RETURNS [hedron: BoundHedron];
RevoSweepRayCast: PROC [cameraPoint: Point2d, localRay: Ray, masterObject: REF ANY, prim: Primitive] RETURNS [class: Classification];
RevoSweepPreprocess: PROC [prim: Primitive, camera: Camera];
RevoSweepLineDraw: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
RevoSweepDrawNormals: PROC[dc: Graphics.Context, data: REF ANY, camera: Camera, localCS: CoordSystem];
RevoSweepCountSurf: PROC [masterObject: MasterObject] RETURNS [len: NAT];
RevoSweepCountVert: PROC [masterObject: MasterObject] RETURNS [len: NAT];
RevoSweepGetSurf: PROC [assembly: Assembly, camera: CoordSystem] RETURNS [psl: PlanarSurfaceList];
RevoSweepDrawSurf: PROC [dc: Graphics.Context, ps: PlanarSurface, lightSources: LightSourceList, camera: Camera];
RevoSweepDrawSubBoxes: PROC [dc: Graphics.Context, prim: Primitive, screenCS: CoordSystem];
RevoSweepFileout: PROC [f: IO.STREAM, mo: MasterObject];
RevoSweepFilein: PROC [f: IO.STREAM, name: Rope.ROPE] RETURNS [mo: MasterObject];


END.