IO3dImpl.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Bloomenthal, February 19, 1986 10:43:38 am PST
DIRECTORY IO, IO3d, Matrix3d, Rope, Vector3d;
IO3dImpl:
CEDAR
PROGRAM
IMPORTS IO
EXPORTS IO3d
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
PrintPair:
PUBLIC
PROC [stream:
IO.
STREAM, p: Vector3d.Pair, name:
ROPE ←
NIL] ~ {
IF name = NIL THEN stream.PutF["%f\t%f\n", IO.real[p.x], IO.real[p.y]]
ELSE stream.PutF["%g\t[%6.3f\t%6.3f]\n", IO.rope[name], IO.real[p.x], IO.real[p.y]];
};
PrintTriple:
PUBLIC
PROC [stream:
IO.
STREAM, p: Vector3d.Triple, name:
ROPE ←
NIL] ~ {
IF name = NIL THEN stream.PutF["%f\t%f\t%f\n", IO.real[p.x], IO.real[p.y], IO.real[p.z]]
ELSE stream.PutF["%g\t[%6.3f\t%6.3f\t%6.3f]\n", IO.rope[name], IO.real[p.x], IO.real[p.y], IO.real[p.z]];
};
PrintQuad:
PUBLIC PROC [stream:
IO.
STREAM, q: Vector3d.Quad, name:
ROPE ←
NIL] ~ {
IF name # NIL THEN stream.PutF["%g: [%f\t%f\t%f\t%f]\n", IO.rope[name], IO.real[q.x], IO.real[q.y], IO.real[q.z], IO.real[q.w]]
ELSE stream.PutF["%6.3f\t%6.3f\t%6.3f\t%6.3f\n", IO.real[q.x], IO.real[q.y], IO.real[q.z], IO.real[q.w]];
};
PrintMatrix:
PUBLIC PROC [stream:
IO.
STREAM, m: Matrix3d.Matrix, name:
ROPE ←
NIL] ~ {
IF name # NIL THEN stream.PutF["%g\n", IO.rope[name]];
FOR i:
NAT
IN [0..3]
DO
stream.PutF["%6.3f\t%6.3f\t%6.3f\t%6.3f\n", IO.real[m[i][0]], IO.real[m[i][1]], IO.real[m[i][2]], IO.real[m[i][3]]];
ENDLOOP;
};