Print3dImpl.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Bloomenthal, February 25, 1986 11:09:19 am PST
DIRECTORY IO, Matrix3d, Print3d, Rope, Vector3d;
Print3dImpl:
CEDAR
PROGRAM
IMPORTS IO
EXPORTS Print3d
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
Pair:
PUBLIC
PROC [stream:
IO.
STREAM, p: Vector3d.Pair, name:
ROPE ←
NIL] ~ {
IF stream = NIL THEN RETURN;
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]];
};
Triple:
PUBLIC
PROC [stream:
IO.
STREAM, p: Vector3d.Triple, name:
ROPE ←
NIL] ~ {
IF stream = NIL THEN RETURN;
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]];
};
Quad:
PUBLIC PROC [stream:
IO.
STREAM, q: Vector3d.Quad, name:
ROPE ←
NIL] ~ {
IF stream = NIL THEN RETURN;
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]];
};
Matrix:
PUBLIC PROC [stream:
IO.
STREAM, m: Matrix3d.Matrix, name:
ROPE ←
NIL] ~ {
IF stream = NIL THEN RETURN;
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;
};