<> <> <> DIRECTORY CSG, DisplayList3d, Matrix3d, SVBoundBox, SVPrimitive; SVPrimitiveImpl: PROGRAM IMPORTS Matrix3d EXPORTS SVPrimitive = BEGIN Assembly: TYPE = DisplayList3d.Assembly; BoundHedron: TYPE = SVBoundBox.BoundHedron; MasterObject: TYPE = DisplayList3d.MasterObject; Primitive: TYPE = REF PrimitiveObj; PrimitiveObj: TYPE = CSG.PrimitiveObj; RayCastProc: TYPE = CSG.RayCastProc; FromAssembly: PUBLIC PROC [assem: Assembly] RETURNS [prim: Primitive] = { mo: MasterObject; prim _ NEW[PrimitiveObj]; IF NOT ISTYPE[assem.object, MasterObject] THEN ERROR PrimitiveAssemblyWithoutMO; mo _ NARROW[assem.object]; prim.name _ assem.name; prim.artwork _ assem.artwork; prim.assembly _ assem; prim.mo _ mo; prim.rayCast _ mo.class.rayCast; prim.rayCastNoBBoxes _ mo.class.rayCastNoBBoxes; prim.primWRTAssembly _ assem.coordSys; prim.scalars _ assem.scalars; prim.primWRTWorld _ assem.coordSys.wrtWorld; prim.worldWRTPrim _ Matrix3d.Inverse[prim.primWRTWorld]; <> prim.boundBox _ NIL; -- will be filled in at tree preprocess time prim.boundHedron _ mo.class.getHedron[mo]; prim.currentRay _ NIL; prim.rayStepX _ NIL; }; PrimitiveAssemblyWithoutMO: PUBLIC ERROR = CODE; END.