(FILECREATED "18-FEB-83 13:35:14" {DSK}VECTOR.LSP;13 8596 changes to: (GLISPOBJECTS VECTOR) previous date: "10-FEB-83 13:44:17" {DSK}VECTOR.LSP;12) (PRETTYCOMPRINT VECTORCOMS) (RPAQQ VECTORCOMS ((GLISPOBJECTS DEGREES DOLPHINREGION GRAPHICSOBJECT RADIANS REGION RVECTOR SYMMETRY VECTOR) (FNS DRAWRECT GRAPHICSOBJECTMOVE NEWSTART NEWPOINT REGION-CENTEROFFSET REGION-CONTAINS REGION-INTERSECT REGION-SETPOSITION REGION-UNION VECTORPLUS VECTORDIFF VECTORDOTPRODUCT VECTORGREATERP VECTORLEQP VECTORTIMES VECTORQUOTIENT VECTORMOVE) (PROP DRAWFN RECTANGLE))) [GLISPOBJECTS (DEGREES REAL PROP ((RADIANS (self * (3.1415926 / 180.0)) RESULT RADIANS) (DISPLAYPROPS (T))) ) (DOLPHINREGION (LIST (LEFT INTEGER) (BOTTOM INTEGER) (WIDTH INTEGER) (HEIGHT INTEGER)) PROP ((START (self) RESULT VECTOR) (SIZE ((CDDR self)) RESULT VECTOR)) SUPERS (REGION) ) (GRAPHICSOBJECT (LIST (SHAPE ATOM) (START VECTOR) (SIZE VECTOR)) PROP ((LEFT (START:X)) (BOTTOM (START:Y)) (RIGHT (LEFT+WIDTH)) (TOP (BOTTOM+HEIGHT)) (WIDTH (SIZE:X)) (HEIGHT (SIZE:Y)) (CENTER (START + SIZE / 2)) (AREA (WIDTH*HEIGHT))) MSG ([DRAW ((APPLY* (GETPROP SHAPE 'DRAWFN) self (QUOTE PAINT] [ERASE ((APPLY* (GETPROP SHAPE 'DRAWFN) self (QUOTE ERASE] (MOVE GRAPHICSOBJECTMOVE OPEN T)) ) (RADIANS REAL PROP ((DEGREES (self* (180.0 / 3.1415926)) RESULT DEGREES) (DISPLAYPROPS (T))) ) (REGION (LIST (START VECTOR) (SIZE VECTOR)) PROP ((LEFT (START:X)) (BOTTOM (START:Y)) (RIGHT (LEFT+WIDTH)) (TOP (BOTTOM+HEIGHT)) (WIDTH (SIZE:X)) (HEIGHT (SIZE:Y)) (CENTER (START + SIZE / 2)) (TOPCENTER ((A VECTOR WITH X = LEFT + WIDTH / 2 Y = TOP))) (BOTTOMCENTER ((A VECTOR WITH X = LEFT + WIDTH / 2 Y = BOTTOM))) (AREA (WIDTH*HEIGHT))) ADJ ((EMPTY (WIDTH IS ZERO OR HEIGHT IS ZERO)) (ZERO (self IS EMPTY))) MSG ((CONTAINS? REGION-CONTAINS OPEN T) (SETPOSITION REGION-SETPOSITION OPEN T) (CENTEROFFSET REGION-CENTEROFFSET OPEN T)) ) (RVECTOR (LIST (X REAL) (Y REAL)) SUPERS (VECTOR) ) (SYMMETRY INTEGER PROP ((SWAPXY ((LOGAND self 4) <>0)) (INVERTY ((LOGAND self 2) <>0)) (INVERTX ((LOGAND self 1) <>0))) ) (VECTOR (LIST (X INTEGER) (Y INTEGER)) PROP [(MAGNITUDE ((SQRT X↑2 + Y↑2))) (IMAGNITUDE ((FIX MAGNITUDE + .9999))) (ANGLE ((ARCTAN2 Y X T)) RESULT RADIANS) (UNITVECTOR ((A RVECTOR WITH X = X / MAGNITUDE Y = Y / MAGNITUDE] ADJ ((ZERO (X IS ZERO AND Y IS ZERO)) (NORMALIZED (MAGNITUDE = 1.0))) MSG [(+ VECTORPLUS OPEN T ARGTYPES (VECTOR)) (- VECTORDIFF OPEN T ARGTYPES (VECTOR)) (* VECTORTIMES OPEN T ARGTYPES (NUMBER)) (* VECTORDOTPRODUCT OPEN T ARGTYPES (VECTOR)) (/ VECTORQUOTIENT OPEN T ARGTYPES (NUMBER)) (> VECTORGREATERP OPEN T ARGTYPES (VECTOR)) (<= VECTORLEQP OPEN T ARGTYPES (VECTOR)) (←+ VECTORMOVE OPEN T ARGTYPES (VECTOR)) (PRIN1 ((PRIN1 "(") (PRIN1 X) (PRIN1 ",") (PRIN1 Y) (PRIN1 ")"))) (PRINT ((← self PRIN1) (TERPRI] ) ] (DEFINEQ (DRAWRECT (GLAMBDA ((A GRAPHICSOBJECT) DSPOP:ATOM) (* edited: "11-JAN-82 12:40") (PROG (OLDDS) (OLDDS ←(CURRENTDISPLAYSTREAM DSPS)) (DSPOPERATION DSPOP) (MOVETO LEFT BOTTOM) (DRAWTO LEFT TOP) (DRAWTO RIGHT TOP) (DRAWTO RIGHT BOTTOM) (DRAWTO LEFT BOTTOM) (CURRENTDISPLAYSTREAM OLDDS)))) (GRAPHICSOBJECTMOVE (GLAMBDA (self:GRAPHICSOBJECT DELTA:VECTOR) (* edited: "11-JAN-82 16:07") (← self ERASE) (START ←+ DELTA) (← self DRAW))) (NEWSTART [GLAMBDA (START:VECTOR SIZE:VECTOR SYM:SYMMETRY) (* GSN "30-JAN-83 15:44") (* Transform the starting point of an object as appropriate for the specified symmetry transform.) (PROG (W H TMP) (W←SIZE:X) (H←SIZE:Y) (IF SYM:SWAPXY THEN TMP←W W←H H←TMP) (IF ~SYM:INVERTY THEN H←0) (IF ~SYM:INVERTX THEN W←0) (RETURN (A (TYPEOF START) WITH X = START:X+W Y = START:Y+H]) (NEWPOINT [GLAMBDA (START:VECTOR POINT:VECTOR SYM:SYMMETRY) (* GSN "30-JAN-83 15:44") (* Transform a given relative POINT for specified symmetry transform.) (PROG (W H TMP) (W←POINT:X) (H←POINT:Y) (IF SYM:SWAPXY THEN TMP←W W←H H←TMP) (IF ~SYM:INVERTY THEN H ← - H) (IF ~SYM:INVERTX THEN W ← - W) (RETURN (A (TYPEOF POINT) WITH X = START:X+W Y = START:Y+H]) (REGION-CENTEROFFSET (GLAMBDA (R:REGION V:VECTOR) (* GSN " 2-FEB-83 14:00") (A (TYPEOF V) WITH X =(R:WIDTH - V:X) / 2 Y =(R:HEIGHT - V:Y) / 2))) (REGION-CONTAINS (GLAMBDA (AREA P) (* edited: "26-OCT-82 11:45") (* Test whether an area contains a point P.) (P:X>=AREA:LEFT AND P:X<=AREA:RIGHT AND P:Y>=AREA:BOTTOM AND P:Y<=AREA:TOP))) (REGION-INTERSECT (GLAMBDA (P:AREA Q:AREA) (* GSN "30-JAN-83 15:45") (RESULT (TYPEOF P)) (* Produce an AREA which is the intersection of two given AREAs.) (PROG (NEWBOTTOM NEWLEFT NEWAREA XSIZE YSIZE) (NEWBOTTOM ←(IMAX P:BOTTOM Q:BOTTOM)) (YSIZE ←(IMIN P:TOP Q:TOP) - NEWBOTTOM) (NEWLEFT ←(IMAX P:LEFT Q:LEFT)) (XSIZE ←(IMIN P:RIGHT Q:RIGHT) - NEWLEFT) (NEWAREA ←(A (TYPEOF P))) (IF XSIZE>0 AND YSIZE>0 THEN NEWAREA:LEFT←NEWLEFT NEWAREA:BOTTOM←NEWBOTTOM NEWAREA:WIDTH←XSIZE NEWAREA:HEIGHT←YSIZE) (RETURN NEWAREA)))) (REGION-SETPOSITION (GLAMBDA (AREA APOS:VECTOR NEWPOS:VECTOR) (* GSN "14-JAN-83 11:52") (* Change the START point of AREA so that the position APOS relative to the area will have the position NEWPOS.) (AREA:START ←+ NEWPOS - APOS))) (REGION-UNION (GLAMBDA (P:AREA Q:AREA) (* GSN "30-JAN-83 15:46") (RESULT (TYPEOF P)) (* Produce an AREA which is the union of two given AREAs.) (PROG (NEWBOTTOM NEWLEFT XSIZE YSIZE NEWAREA) (NEWBOTTOM ←(IMIN P:BOTTOM Q:BOTTOM)) (YSIZE ←(IMAX P:TOP Q:TOP) - NEWBOTTOM) (NEWLEFT ←(IMIN P:LEFT Q:LEFT)) (XSIZE ←(IMAX P:RIGHT Q:RIGHT) - NEWLEFT) (NEWAREA ←(A (TYPEOF P))) (NEWAREA:LEFT←NEWLEFT) (NEWAREA:BOTTOM←NEWBOTTOM) (NEWAREA:WIDTH←XSIZE) (NEWAREA:HEIGHT←YSIZE) (RETURN NEWAREA)))) (VECTORPLUS (GLAMBDA (V1:VECTOR V2:VECTOR) (* GSN "10-FEB-83 13:41") (A (TYPEOF V1) WITH X = V1:X + V2:X Y = V1:Y + V2:Y))) (VECTORDIFF (GLAMBDA (V1:VECTOR V2:VECTOR) (* GSN "10-FEB-83 13:41") (A (TYPEOF V1) WITH X = V1:X - V2:X Y = V1:Y - V2:Y))) (VECTORDOTPRODUCT (GLAMBDA (V1:VECTOR V2:VECTOR) (* GSN "10-FEB-83 13:42") (A (TYPEOF V1) WITH X = V1:X * V2:X Y = V1:Y * V2:Y))) (VECTORGREATERP (GLAMBDA (U:VECTOR V:VECTOR) (* GSN "14-JAN-83 12:33") (* This version of > tests whether one box will fit inside the other.) (U:X>V:X OR U:Y>V:Y))) (VECTORLEQP (GLAMBDA (U:VECTOR V:VECTOR) (* GSN "14-JAN-83 12:31") (U:X<=V:X AND U:Y<=V:Y))) (VECTORTIMES (GLAMBDA (V:VECTOR N:NUMBER) (* GSN "10-FEB-83 13:41") (A (TYPEOF V) WITH X = X*N Y = Y*N))) (VECTORQUOTIENT (GLAMBDA (V:VECTOR N:NUMBER) (* GSN "10-FEB-83 13:42") (A (TYPEOF V) WITH X = X / N Y = Y / N))) (VECTORMOVE (GLAMBDA (V:VECTOR DELTA:VECTOR) (* GSN "10-FEB-83 13:43") (V:X ←+ DELTA:X) (V:Y ←+ DELTA:Y) V)) ) (PUTPROPS RECTANGLE DRAWFN DRAWRECT) (DECLARE: DONTCOPY (FILEMAP (NIL (3214 8536 (DRAWRECT 3224 . 3644) (GRAPHICSOBJECTMOVE 3646 . 3820) (NEWSTART 3822 . 4383 ) (NEWPOINT 4385 . 4928) (REGION-CENTEROFFSET 4930 . 5117) (REGION-CONTAINS 5119 . 5414) ( REGION-INTERSECT 5416 . 6128) (REGION-SETPOSITION 6130 . 6474) (REGION-UNION 6476 . 7163) (VECTORPLUS 7165 . 7329) (VECTORDIFF 7331 . 7495) (VECTORDOTPRODUCT 7497 . 7667) (VECTORGREATERP 7669 . 7943) ( VECTORLEQP 7945 . 8073) (VECTORTIMES 8075 . 8223) (VECTORQUOTIENT 8225 . 8380) (VECTORMOVE 8382 . 8534 ))))) STOP