File: CoordSys.mesa
Last edited by Bier on August 5, 1984 10:08:44 pm PDT
Author: Eric Bier in June, 1982
Contents: Allocation and access to a user-specified set of named coordinate systems
DIRECTORY
Rope,
SV2d,
SV3d,
SVModelTypes,
SVVector3d;
CoordSys: DEFINITIONS =
BEGIN
CoordSystem: TYPE = SVModelTypes.CoordSystem;
CoordSysList: TYPE = SVModelTypes.CoordSysList;
Matrix4by4: TYPE = SV3d.Matrix4by4;
Point2d: TYPE = SV2d.Point2d;
Point3d: TYPE = SV3d.Point3d;
Vector: TYPE = SVVector3d.Vector;
CreateRoot: PROC [name: Rope.ROPE] RETURNS [newCS: CoordSystem];
CreateCoordSysInTree: PROC [name: Rope.ROPE, mat: Matrix4by4, parent: CoordSystem, root: CoordSystem] RETURNS [newCS: CoordSystem];
NameAlreadyExists: SIGNAL;
CreateScalarsOnlyCoordSysInTree: PROC [name: Rope.ROPE, scalars: Vector, parent: CoordSystem, root: CoordSystem] RETURNS [newCS: CoordSystem];
CopyCoordSysFromAnyTree: PROC [source: CoordSystem, newName: Rope.ROPE, parent: CoordSystem, root: CoordSystem] RETURNS [newCS: CoordSystem];
Like CreateCoordSysInTree but uses the matrix from the old CoordSys. If source is a scalars-only coordsys, then newCS will be as well.
ResetScalars: PROC [cs: CoordSystem, scalars: Vector];
cs must be scalarsOnly.
GetScalars: PROC [cs: CoordSystem] RETURNS [scalars: Vector];
cs must be scalarsOnly.
DeleteCoordSysAndChildren: PROC [cs: CoordSystem, root: CoordSystem];
MakeListFromTree: PROC [root: CoordSystem] RETURNS [csl: CoordSysList];
Produces a list of the CoordSystem's in subtree rooted at root. The list is in breadth-first order.
TSortCoordSysListByBreadth: PUBLIC PROC [csl: CoordSysList] RETURNS [sortedCsl: CoordSysList];
This procedure is on its way out. MakeListFromTree produces a breadth-sorted list.
FindCoordSysInTree: PROC [name: Rope.ROPE, root: CoordSystem] RETURNS [cs: CoordSystem];
CoordSysNotFound: SIGNAL;
CoordSysListEmpty: SIGNAL;
CoordSysNameIsPresent: PROC [name: Rope.ROPE, root: CoordSystem] RETURNS [BOOL];
FindCoordSysInList: PROC [name: Rope.ROPE, csl: CoordSysList] RETURNS [cs: CoordSystem];
This procedure is on its way out. Use FindCoordSysInTree when possible.
FindCoordSysAndNeighborsInList: PROC [name: Rope.ROPE, csl: CoordSysList] RETURNS [beforeCS, cs, afterCS: CoordSysList];
Signals CoordSysNotFound if that is the case.
BaseAndNumber: PROC [name: Rope.ROPE] RETURNS [base: Rope.ROPE, number: NAT];
UniqueNameWithSuffix: PROC [oldName: Rope.ROPE, suffix: Rope.ROPE, root: CoordSystem] RETURNS [unique: Rope.ROPE];
Takes a solidviews name, like "teapot.73". Adds the suffix to the basename and fixes the number to ensure uniqueness. If the suffix were "$$tool", then UniqueNameWithSuffix might return "teapot$$tool.89".
UniqueNameFrom: PROC [name: Rope.ROPE, root: CoordSystem] RETURNS [unique: Rope.ROPE];
Takes a solidviews name, like "teapot.73". Fixes the number to ensure uniqueness. UniqueNameFrom might return "teapot.106".
CameraToScreen: PROC [cameraPoint2d: Point2d, screenCoordSys: CoordSystem] RETURNS [screenPoint2d: Point2d];
ScreenToCamera: PROC [screenPoint2d: Point2d, screenCoordSys: CoordSystem] RETURNS [cameraPoint2d: Point2d];
FromCSToCS: PROC [pt: Point3d, currentCS: CoordSystem, newCS: CoordSystem] RETURNS [newPt: Point3d];
Takes ptcurrentCS and returns ptnewCS.
FromCSToCSMat: PROC [mat: Matrix4by4, currentCS: CoordSystem, newCS: CoordSystem] RETURNS [newMat: Matrix4by4];
Takes matcurrentCS and returns matnewCS.
FindInTermsOfWorld: PROC [cs: CoordSystem] RETURNS [mat: Matrix4by4];
FindInTermsOfCamera: PROC [cs: CoordSystem, camera: CoordSystem] RETURNS [mat: Matrix4by4];
FindWorldInTermsOf: PROC [cs: CoordSystem] RETURNS [mat: Matrix4by4];
FindCameraInTermsOf: PROC [cs: CoordSystem, camera: CoordSystem] RETURNS [mat: Matrix4by4];
FindAInTermsOfB: PROC [a: CoordSystem, b: CoordSystem] RETURNS [mat: Matrix4by4];
The above three procs return the relevant matrix with no side effects
FindTranslationOfAinTermsOfB: PROC [a: CoordSystem, b: CoordSystem] RETURNS [displacements: Vector];
A New Parent
PutAInTermsOfB: PROC [a: CoordSystem, b: CoordSystem] RETURNS [mat: Matrix4by4];
Finds the matrix and redefines CoordSystem a to be in terms of b from now on.
END.