1 #include "EyetrackerFilter.h"
3 CEyetrackerFilter::CEyetrackerFilter(Dasher::CEventHandler
* pEventHandler
, CSettingsStore
*pSettingsStore
, CDasherInterfaceBase
*pInterface
, CDasherModel
*m_pDasherModel
)
4 : CDefaultFilter(pEventHandler
, pSettingsStore
, pInterface
, m_pDasherModel
, 5, "Eyetracker Mode") {
7 void CEyetrackerFilter::ApplyTransform(myint
&iDasherX
, myint
&iDasherY
) {
8 double disty
=(myint
)GetLongParameter(LP_OY
)-iDasherY
;
12 myint dasherOX
=(myint
)GetLongParameter(LP_OX
);
14 // if( iDasherX < dasherOX ) {
16 //cout << "dasherOX: " << dasherOX << endl;
17 myint dasherOY
=(myint
)GetLongParameter(LP_OY
);
19 // X co-ordinate changes.
20 double double_x
= (x
/dasherOX
); // Fraction of way over to crosshair
21 double double_y
= -((iDasherY
-dasherOY
)/(double)(dasherOY
) ); // Fraction above the crosshair
23 // FIXME - I have *no* idea how this is supposed to work - someone else fix it and comment the code please!
25 double xmax_y
= xmax(double_x
, double_y
);
27 if(double_x
< xmax_y
) {
31 // std::cout << xmax_y << std::endl;
33 x
= myint(dasherOX
*double_x
);
35 // Finished x-coord changes.
37 double repulsionparameter
=0.5;
38 iDasherY
= myint(dasherOY
- (1.0+ double_y
*double_y
* repulsionparameter
) * disty
);
44 double CEyetrackerFilter::xmax(double x
, double y
) {
45 // DJCM -- define a function xmax(y) thus:
46 // xmax(y) = a*[exp(b*y*y)-1]
47 // then: if(x<xmax(y) [if the mouse is to the RIGHT of the line xmax(y)]
48 // set x=xmax(y). But set xmax=c if(xmax>c).
49 // I would set a=1, b=1, c=16, to start with.
51 int a
= 1, b
= 1, c
= 100;
52 double xmax
= a
* (exp(b
* y
* y
) - 1);
53 //cout << "xmax = " << xmax << endl;