Hi Bill,
Just a small patch to consider where I have simulated a circular Light Pen aperture.
I have just tacked on the code to this message as I found a lot of diffs I hadn't synced in repo even from today!.
/opt/pidp1-mods/src/blincolnlights/pdp1/pdp1.c
bool
checkLightPen(PDP1 *pdp1P)
{
int i, sawOne, dpyx, dpyy;
DispCon *dpyP;
int delx,dely;
if( !updatePenLocation(pdp1P) )
{
return(false); // no hit possible
}
dpyP = &(pdp1P->dpy[0]);
dpyx = cvtDpyToSigned(pdp1P->dbx);
dpyy = cvtDpyToSigned(pdp1P->dby);
// Both coordinate pairs have been converted from 10 bit 1's complement to
// full signed 2's complement.
delx = (lastX - dpyx)*(lastX - dpyx); // Find squared magnitudes of hit offset
dely = (lastY - dpyy)*(lastY - dpyy);
if (delx + dely < penAperture * penAperture * 4) // Compare with (penAperture*2)^2
/*
if((lastX >= (dpyx - penAperture)) &&
(lastX <= (dpyx + penAperture)) &&
(lastY >= (dpyy - penAperture)) &&
(lastY <= (dpyy + penAperture)))
*/
{
logger(LOG_LP, "LP x %d, y %d hit at x %d, y %d aperture %d\n", lastX, lastY, dpyx, dpyy,penAperture);
return(true);
}
return(false);
}
Try with LightPen MAINDEC. Hope this is of interest, BW, Ian.