perm filename PLOT.SIM[SIM,SYS] blob sn#453663 filedate 1979-07-20 generic text, type T, neo UTF8
BEGIN  CLASS PLOTTING;                                           
       BEGIN CLASS STACKABLE;                                    
             BEGIN  REF(STACKABLE)NEXT;                          
                    PROCEDURE INTO(H); NAME H; REF(STACKABLE)H;  
                    BEGIN  NEXT :- H;                            
                          H :- THIS STACKABLE;                   
                    END ***OF INTO*** ;                          
             END *STACKABLE*** ;                                 

             CLASS POINT(X,Y); REAL X,Y;                         
             BEGIN  REF(LINE) PROCEDURE RAY(L,A); REAL L,A;      
                      RAY :- NEW LINE(THIS POINT,L,A);           
                    REF(CIRCLE) PROCEDURE RING(R); REAL R;       
                      RING :- NEW CIRCLE(THIS POINT,R);          
             END ***OF POINT*** ;                                

   STACKABLE CLASS LINE(P,LENGTH,ANGLE); REF(POINT)P;            
                                   REAL LENGTH,ANGLE;            
             BEGIN  REF(LINE) PROCEDURE ROTATED(THETA);          
                          REAL THETA;                            
                    ROTATED :- NEW LINE(P,LENGTH,ANGLE+THETA);   
                   IF P == NONE OR LENGTH <= 0 THEN              
                    BEGIN  OUTTEXT("BAD POINT");                 
                          OUTIMAGE;                              
                    END;                                         
             END ***OF LINE*** ;                                 

STACKABLE CLASS CIRCLE(CP,RADIUS); REF(POINT)CP;                 
                                   REAL RADIUS;                  
          BEGIN  IF CP == NONE OR RADIUS <= 0 THEN               
                    BEGIN  OUTTEXT("BAD CIRCLE");                
                           OUTIMAGE;                             
                    END;                                         
          END ***OF CIRCLE*** ;                                  

          PROCEDURE PLOT ......;                                 

          REF(STACKABLE)DRAW;                                    
          REF(POINT)ORIGO;                                       
          ORIGO :- NEW POINT(0,0)                                
  END ***OF PLOTTING*** ;                                        

PLOTTING BEGIN  REF(LINE)L1,L2,L3,                               
                REF(CIRCLE)C;                                    
GENERATE:       INSPECT ORIGO DO                                 
                BEGIN  L1 :- RAY(1,-45);                         
                       L2 :- L1.ROTATED(-90);                    
                       L3 :- NEW POINT(0,-1).RAY(2,90);          
                        C :- RING(1)                             
                END;                                             
ASSEMBLE:        C.INTO(DRAW);                                   
                L1.INTO(DRAW);                                   
                L2.INTO(DRAW);                                   
                L3.INTO(DRAW);                                   
                PLOT;                                            
        END ***OF PREFIXED BLOCK*** ;                            
END