<<>> <> <> <> <> DIRECTORY Controls, Draw2d, G3dBasic, G3dMatrix, G3dPlane, G3dQuaternion, G3dShape, G3dView, Imager, Rope; G3dControl: CEDAR DEFINITIONS ~ BEGIN <> Control: TYPE ~ Controls.Control; ControlProc: TYPE ~ Controls.ControlProc; ControlList: TYPE ~ Controls.ControlList; Mouse: TYPE ~ Controls.Mouse; Viewer: TYPE ~ Controls.Viewer; DrawType: TYPE ~ Draw2d.DrawType; IntegerPair: TYPE ~ G3dBasic.IntegerPair; Pair: TYPE ~ G3dBasic.Pair; PairSequence: TYPE ~ G3dBasic.PairSequence; Triple: TYPE ~ G3dBasic.Triple; TripleSequence: TYPE ~ G3dBasic.TripleSequence; Matrix: TYPE ~ G3dMatrix.Matrix; Viewport: TYPE ~ G3dMatrix.Viewport; Plane: TYPE ~ G3dPlane.Plane; Quaternion: TYPE ~ G3dQuaternion.Quaternion; ScreenSequence: TYPE ~ G3dShape.ScreenSequence; Context: TYPE ~ Imager.Context; ROPE: TYPE ~ Rope.ROPE; <> Method: TYPE ~ {controls, geometry}; ProxyMode: TYPE ~ {par, wor, eye}; MovRot: TYPE ~ RECORD [ xMov: Control _ NIL, -- x translation yMov: Control _ NIL, -- y translation zMov: Control _ NIL, -- z translation xRot: Control _ NIL, -- rotation about x axis yRot: Control _ NIL, -- rotation about y axis zRot: Control _ NIL -- rotation about z axis ]; ArcBall: TYPE ~ REF ArcBallRep; ArcBallRep: TYPE ~ RECORD [ originBody: BOOL _ TRUE, -- rotate wrt body, else wrt world rotate: ArcControl _ NIL, -- data structure for the rotator translate: ArcControl _ NIL -- data structure for the translator ]; ArcControl: TYPE ~ REF ArcControlRep; ArcControlRep: TYPE ~ RECORD [ control: Control _ NIL, inCorner: BOOL _ FALSE, firstPlace, lastPlace: Triple _ [0,0,1], firstPrev, lastPrev: Triple _ [0,0,1], qAbs: Quaternion _ [0,0,0,1], -- rotation at mouse down tAbs: Triple _ [0,0,0], -- translation at mouse down qInc: Quaternion _ [0,0,0,1], -- incremented rotate tInc: Triple _ [0,0,0], -- incremented translate qTan: Quaternion _ [0,0,0,1], qBasis: Triple _ [0,0,0], ropeBasis: Triple _ [0,0,0], rope: ROPE _ NIL, inhibitPrint: BOOL _ FALSE, frame: Matrix _ NIL, camera: CameraControl _ NIL, clientProc: ControlProc _ NIL, clientData: REF ANY _ NIL ]; Camera: TYPE ~ G3dView.Camera; CameraControl: TYPE ~ REF CameraControlRep; CameraControlRep: TYPE ~ RECORD [ <> clientData: REF ANY _ NIL, -- client data proc: ControlProc _ NIL, -- client proc called if camera changes graphics: Viewer _ NIL, -- if non-nil, automate the redraw method: Method _ controls, -- interactive controls or geometric specs? use: {view, shape, light}, -- what is being controlled? <> matrix: Matrix _ NIL, -- camera matrix inverse: Matrix _ NIL, -- inverse of camera matrix view: Matrix _ NIL, -- matrix times viewport miscMatrix: Matrix _ NIL, -- for miscellaneous applications miscVector: Triple _ [], -- for miscellaneous applications miscPosition: Triple _ [], -- for miscellaneous applications save: Camera _ NIL, -- for undo <> mouse: Mouse _ [], -- current state of the user's mouse arcBall: ArcBall _ NIL, -- alternate to par/wor/eye proxyMode: ProxyMode _ par, -- meaning of proxy controls proxySelect: Control _ NIL, -- set camera.proxyMode proxy: MovRot _ [], -- use defined by camera.proxyMode par: MovRot _ [], -- actual tran & rotate parameter controls wor: MovRot _ [], -- incremental world space xform controls eye: MovRot _ [], -- incremental eye space xform controls scale: Control _ NIL, -- scale about origin fieldOfView: Control _ NIL, -- field of view hScreen: Control _ NIL, -- horizontal screen translation vScreen: Control _ NIL, -- vertical screen translation current: Control _ NIL, -- current control moused prev: Control _ NIL, -- previous control moused initval: REAL _ 0.0, -- init val for current incremental control incr: Matrix _ NIL, -- incremental xform (wor or eye space) <> eyePoint: Triple _ [], -- location of the camera lookAt: Triple _ [], -- camera's view direction up: Triple _ [], -- camera's notion of "up" roll: REAL _ 0.0 -- rotation about the camera's axis ]; <> InitArcBall: PROC [camera: CameraControl, clientProc: ControlProc, clientData: REF ANY] RETURNS [ArcBall]; <> <> <> <<>> SetArcBall: PROC [arcBall: ArcBall, rotate, translate: Triple _ []]; <> <<>> SetArcBallSize: PROC [arcBall: ArcBall, size: INTEGER]; <> <> <> SetCameraControlMethod: PROC [camera: CameraControl, method: Method]; <> CameraControlOrientation: PROC [camera: CameraControl, eyePoint, lookAt, up: Triple, roll: REAL]; <> <> InitCameraControl: PROC [ proc: ControlProc _ NIL, clientData: REF ANY _ NIL, proxyMode: ProxyMode _ wor, fieldOfView: REAL _ 60.0, scale: REAL _ 1.0, move: Triple _ [0.0, 2.0, 0.0], rotate: Triple _ [0.0, 0.0, 0.0], moveRange: REAL _ 10.0] RETURNS [CameraControl]; <> <> <> <> <> <> <<>> AddCameraControl: PROC [controls: ControlList, camera: CameraControl, useArcBalls: BOOL] RETURNS [ControlList]; <> SetCameraControlGraphics: PROC [camera: CameraControl, graphics: Viewer]; <> <<>> InitContext: PROC [ context: Context, camera: CameraControl, viewer: Viewer _ NIL, clear: BOOL _ TRUE, out: Matrix _ NIL] RETURNS [Matrix]; <> <> <<>> UpdateCameraControl: PROC [camera: CameraControl]; <> <> <> <> <<>> UpdateControl: PROC [camera: CameraControl, control: Control, value: REAL]; <> <> GetCameraControlMatrix: PROC [camera: CameraControl] RETURNS [Matrix]; <> <<>> GetViewMatrix: PROC [camera: CameraControl, out: Matrix] RETURNS [Matrix]; <> <<>> EyeViewFromCameraControl: PROC [camera: CameraControl] RETURNS [Triple]; <> <<>> SaveState: PROC [camera: CameraControl, state: Camera]; <> <<>> RestoreState: PROC [camera: CameraControl, state: Camera]; <> <<>> LastAdjustedCameraControl: PROC RETURNS [CameraControl]; <> <<>> CameraControlMessage: PROC [camera: CameraControl] RETURNS [ROPE]; <> <> <> Slice: TYPE ~ REF SliceRep; -- controls for a planar slice SliceRep: TYPE ~ RECORD [ x, y, z: Control _ NIL, -- center of plane phi, theta, size: Control _ NIL, -- direction and size of plane plane: Plane _ [], -- the plane equation matrix: Matrix _ NIL -- matrix to transform to plane ]; InitSlice: PROC [data: REF ANY _ NIL, proc: Controls.ControlProc _ NIL] RETURNS [slice: Slice]; <> <<>> SetSlice: PROC [slice: Slice, plane: Plane, size: REAL _ 1.0]; <> <<>> UpdateSlice: PROC [slice: Slice]; <> <<>> DrawSlice: PROC [ context: Context, slice: Slice, view: Matrix, viewport: Viewport _ [], drawType: DrawType _ solid]; <> <<>> MoveSliceInY: PROC [slice: Slice, amount: REAL]; <> <<>> MoveSliceInZ: PROC [slice: Slice, amount: REAL]; <> <> Hold: TYPE ~ REF HoldRep; HoldRep: TYPE ~ RECORD [ pitch: Control _ NIL, -- declination about the horizontal yaw: Control _ NIL, -- rotation about the absolute vertical roll: Control _ NIL, -- rotation about the relative vertical mag: Control _ NIL, -- magnitude of the pitch-yaw vector x: Control _ NIL, -- x coordinate of position y: Control _ NIL, -- y coordinate of position z: Control _ NIL -- z coordinate of position ]; InitHold: PROC [proc: ControlProc _ NIL, data: REF ANY _ NIL] RETURNS [Hold]; <> <<>> SetHold: PROC [hold: Hold, position, tangent: Triple _ [0.0, 0.0, 0.0]]; <> <<>> PositionFromHold: PROC [hold: Hold] RETURNS [Triple]; <> <<>> VectorFromHold: PROC [hold: Hold] RETURNS [t: Triple]; <> <> Pick: TYPE ~ RECORD [offset: Pair, selected: INTEGER]; ScreenPick: PROC [screens: ScreenSequence, screen: IntegerPair] RETURNS [INTEGER]; <> <> <<>> PointPick: PROC [points: TripleSequence, pairs: PairSequence, view: Matrix, mouse: Mouse] RETURNS [INTEGER]; <> <> <<-1 is returned if the length of pairs is less than the length of points.>> <<>> MovePointPick: PROC [ points: TripleSequence, pairs: PairSequence _ NIL, view: Matrix, viewport: Viewport, mouse: Mouse, pick: Pick] RETURNS [Pick]; <> <> <> <> <> PaintControls: PROC [c1, c2, c3, c4, c5, c6: Control _ NIL]; <> <<>> SetTripleControls: PROC [x, y, z: Control _ NIL, triple: Triple, repaint: BOOL _ TRUE]; <> <<>> END.