perm filename RIBSUB.SAI[NEW,AIL] blob
sn#408315 filedate 1979-01-08 generic text, type T, neo UTF8
Procedure MakeDeltaParams;
begin
itemvar x,y,u,w;
integer itemvar v;
foreach x,y such that NEIGHBOR of x is y do
begin
w :=NEW;
make OFFSET!PARAMS of x is w;
u := NEW;
make y of w is u;
Print("deltax for",y, "of",x," :=");
v:= NEW(0);
make DELTAX of u is v;
ReadOn(datum(v));
v := NEW(0);
Print("deltay for ",y," of ",x," :=");
make DELTAY of u is v;
ReadOn(datum(v));
v := NEW(0);
make DELTAA of u is v;
Print("deltaA of ",y,"of" ,x," :="); ReadOn(datum(v));
end;
end;
itemvar procedure ThinkTop(item z);
begin
end;
itemvar procedure ThinkBot(item z);
begin
end;
Procedure MakeLocationDescriptor(item z);
begin
integer itemvar x,y,v;
x := NEW(0); y := NEW(0);
make LOCATION!DESCRIPTOR of z is x;
make BOUNDING!BOX of x is y;
v := NEW(0);
make XCOORD of y is v;
Print("xcoord of ",z,":= ");
ReadOn(datum(v));
v := NEW(0);
make YCOORD of y is v;
Print("ycord of ",z," :=");
ReadOn(datum(v));
make XLEN of y is NEW(0);
make YLEN of y is NEW(0);
end;
Procedure MakeReferenceCoords(item z);
begin
integer itemvar x,y,u;
if LOCATION!DESCRIPTOR of z is BIND x then
begin
u := NEW(0);
make REFERENCE!COORDS of x is u;
y := NEW(0);
make XCOORD of u is y;
y := NEW(0);
make YCOORD of u is y;
end;
end;
Define Think( z)=
[ begin
itemvar x;
if THINKING!PROCEDURE of z is BIND x
then begin Print("JB",z," ",x);
Apply(datum(x),{{REF!ITEM( VALUE z) ⎇⎇);BAIL;end
else Print("no thinking procedure for ",z);
end ] ;
Define Look( z)=
[ begin
itemvar x;
if LOOKING!PROCEDURE of z is BIND x
then Apply(datum(x),Arg!List(z))
else Print("no looking procedure for",z);
end ];
Define MakeThinkingProcedure( z, p) =
[ begin
itemvar x;
x := NEW;
Print("tp ","p");
make THINKING!PROCEDURE of z is x;
Print("Thinking procedure for",z);
Assign(x,p);
end ];
Define MakeLookingProcedure( z, p) =
[ begin
itemvar x;
x := NEW;
Print("lp ","p");
make LOOKING!PROCEDURE of z is x;
Print("Looking procedure for ",z);
Assign(x,p);
end ];
Itemvar Procedure LookLungTopAndBot(item z);
begin
itemvar x,y;
integer itemvar u;
! insert here the part that looks at signatures;
! if successful, do the following;
x := NEW;
make INSTANCE of z is x;
y := NEW;
make REFERENCE!COORDS of x is y;
u := NEW(0);
make YCOORD of y is u;
! when routine is attached load appropriate datum, here we read it;
Print("Ycoord of",z," :=");ReadOn(datum(u));
end;
Procedure MakeBBSubr(item z; integer x,y,xs,ys);
begin
integer x1,x2,y1,y2;
integer itemvar u,v;
u :=NEW;
make BOUNDING!BOX of z is u;
v := NEW(0);
make XCOORD of u is v;
datum(v) := x;
v := NEW(0);
make YCOORD of u is v;
datum(v) := y;
v := NEW(0);
make XLEN of u is v;
datum(v) := xs;
v := NEW(0);
make YLEN of u is v;
datum(v) := ys;
x1 := x-xs/2; x2 := x+xs/2; y1 := y-ys/2; y2 := y+ys/2;
! PutLine(x1,y1,x1,y2);
! PutLine(x1,y1,x2,y1);
! PutLine(x1,y2,x2,y2);
! PutLine(x2,y1,x2,y2);
end;
procedure MakeBoundingBox(item z; integer x,y,xs,ys);
begin
itemvar u;
if INSTANCE of z is BIND u then MakeBBSubr(u,x,y,xs,ys)
else begin
u := NEW;
make INSTANCE of z is u;
MakeBBSubr(u,x,y,xs,ys);
end;
end;
Itemvar Procedure ThinkRib(item z);
begin
integer itemvar x,y,u,v; integer yT,yB, Xcor,Ycor,Xsize,Ysize,i;
Print("inside thinkrib z:",z);
if INSTANCE of TOP is BIND x and
REFERENCE!COORDS of x is BIND y and
YCOORD of y is BIND u
then begin
yT := datum(u);
if INSTANCE of BOT is BIND x and
REFERENCE!COORDS of x is BIND y and
YCOORD of y is BIND u
then begin
yB := datum(u);
! make bounding box params;
if INDEX of z is BIND v then i := datum(v);
if SIDE of z is LEFT then Xcor := 76-2*i;
if SIDE of z is RIGHT then Xcor := 180+2*i;
Ycor := yT + ((yB-yT)*i)/NumberOfRibs;
Xsize := 101 +2*i;
Ysize := ((yB-yT)*2)/NumberOfRibs;
Print("i:",i,"Xcor:",Xcor,"Ycor:",Ycor);
MakeBoundingBox(z,Xcor,Ycor,Xsize,Ysize);
end
else Print("no instance of Bot");
end
else Print("no instance of Top");
end;
procedure DrawParabola(item z; integer XFoc,YFoc,A);
begin
integer Sde,XMid;
integer firstterm,XDirec,XParab,reply,A,ymind,x,y;
XMid := 128; Sde :=0;
XDirec := XFoc - (2 * A); ! Probably Negative;
! now plug in the values for x and y up until y:=YFoc and if;
! the equation: X:=(Y - YFoc)**2/4A +A + XDirec;
! fits, plot the point;
ymind := YFoc -120;
if ymind < 0 then ymind := 0;
for y:=ymind step 1 until YFoc+30 do
begin
firstterm := (YFoc - y) ;
if SIDE of z is LEFT
then XParab := ((firstterm*firstterm) / (4 * A)) + A + XDirec
! if (((firstterm*firstterm) rem (4 * A)) gr (2 * A)) then;
! XParab := XParab + 1;
else begin
Sde := 1;
XParab := -((firstterm*firstterm)/(4*A))+XFoc+A;
end;
for x:=XMid*Sde step 1 until XMid*Sde +XMid do
begin
! if x = XParab
! then PutPoint(x,y);
end; ! for x:=0 loop--goes across columns;
end; ! for y:=0 loop--goes down rows;
end;
Procedure MakeParabola(item z; integer xF,yF,a);
begin
integer itemvar x,y,u;
if not( INSTANCE of z is BIND u) then begin
u := NEW;
make INSTANCE of z is u;
end;
x :=NEW(0);
make PARABOLA of u is x;
y := NEW(0);
make XCOORD of x is y;
datum(y) := xF;
y := NEW(0);
make YCOORD of x is y;
datum(y) := yF;
y := NEW(0);
datum(y) := a;
DrawParabola(z,xF,yF,a);
end;
Itemvar Procedure LookRib(item z);
begin
integer itemvar x,y; integer xF,yF,a;
if INSTANCE of z is BIND x and
BOUNDING!BOX of x is BIND y
then begin
Print("xF,yF,a, for rib",z," :=");
ReadOn(xF,yF,a);
MakeParabola(z,xF,yF,a);
end
else Print("no bounding box for rib",z);
end;