ImplicitWheelCmdImpl.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Bloomenthal, July 21, 1991 11:30 pm PDT
DIRECTORY Commander, G3dBasic, G3dSpline, G3dVector, ImplicitConvolve, ImplicitDefs, ImplicitDesign, IO, RealFns, Rope;
ImplicitWheelCmdImpl: CEDAR PROGRAM
IMPORTS G3dBasic, ImplicitConvolve, ImplicitDesign, RealFns
~ BEGIN
Types
Triple:    TYPE ~ G3dBasic.Triple;
TripleSequence:  TYPE ~ G3dBasic.TripleSequence;
Primitive:    TYPE ~ ImplicitConvolve.Primitive;
PrimitiveList:  TYPE ~ ImplicitConvolve.PrimitiveList;
Tool:     TYPE ~ ImplicitConvolve.Tool;
TripleList:   TYPE ~ ImplicitConvolve.TripleList;
A Flat Wheel
Wheel: Commander.CommandProc ~ {
id: INTEGER ← 0;
primitives: PrimitiveList;
center: Triple ← [0, 0, 0];
pts: ARRAY [0..6) OF Triple;
FOR i: INTEGER IN [0..6) DO
a: REAL ← 2.0*3.141592*REAL[i]/5.0;
pts[i] ← [0.25*RealFns.Cos[a], 0.25*RealFns.Sin[a], -0.2];
ENDLOOP;
FOR l: LIST OF REALLIST[0.0, 0.2, 0.3, 0.55, 0.75, 1.0], l.rest WHILE l # NIL DO
a: REAL ← 2.0*3.141592*l.first;
pts[id] ← [0.25*RealFns.Cos[a], 0.25*RealFns.Sin[a], 0.0];
id ← id+1;
ENDLOOP;
FOR i: INTEGER IN [0..5) DO
triples: TripleSequence ← G3dBasic.TripleSequenceFromList[LIST[center, pts[i], pts[i+1]]];
primitives ← CONS[ImplicitConvolve.MakePrimitive[points: triples, extent: 0.05, color: [0, 0, 0]], primitives];
ENDLOOP;
[] ← ImplicitConvolve.MakeTool[name: "Wheel", toolSettings: [threshold: .5], primitives: primitives];
};
Start Code
ImplicitDesign.Register["Wheel", Wheel, "a wheel", "ImplicitConvolve"];
END.