FUNCTION MATCH_POINT,win1,win2 ;+ ;R=SAMPLE_CLICK(win1,win2) uses the mouse cursor to collect matching ;points from windows win1 and win2. The windows need not be the same size. ; ;To use the process, click the left mouse in the active window. This ;causes the coordinates of the point to be determined. The other window ;is then made active. Clicking there collects the matching point. ; ;To terminate the process, right-click in the current window. If the first ;window is active the process returns the previously-collected pairs of ;points. If the second window is active, then that point is collected ;and the last pair of points is included in the return. ; ;R is an anonymous structure with arrays P=[X1,Y1] and Q=[X2,Y2]. Display ;the points with R.P and R.Q. ; ; ;HISTORY: ;Written by H. Rhody, April 8, 2004 ;- !mouse.button=1 count=0 p1=ptr_new(/Allocate_Heap) p2=ptr_new(/Allocate_Heap) WHILE(!MOUSE.BUTTON NE 4) DO BEGIN wset,win1 & wshow CURSOR,Xa,Ya,/DEVICE,/DOWN IF !MOUSE.BUTTON NE 4 THEN BEGIN *p1=(count EQ 0) ? [[Xa,Ya]] : [[*p1],[Xa,Ya]] wset,win2 & wshow CURSOR,Xb,Yb,/DEVICE,/DOWN *p2=(count EQ 0) ? [[Xb,Yb]] : [[*p2],[Xb,Yb]] ENDIF count=count+1 ENDWHILE pv=*p1 qv=*p2 ptr_free,p1 ptr_free,p2 RETURN,{P:pv,Q:qv} END