Example #1
0
        private void write_pt_to_hist(Point_Obj p, Screen_Prob_Map p_m, Subj_Data S, int frame_num)
        {
            int ID = S.get_ID();
            if (((Chart)this.hist_chart_list[ID]).InvokeRequired)
            {
                ChartHistCallback cH = new ChartHistCallback(write_pt_to_hist);
                this.Invoke(cH, new object[] { p, p_m, S, frame_num });
            }
            else
            {
                Chart chart = (Chart)this.hist_chart_list[ID];
                chart.ChartAreas[0].AxisX.Maximum = frame_num; // display points up to current frame

                Chart chart_f2 = (Chart)F2.hist_chart_list[ID];

                int MONITOR_DIM_X = S.get_MONITOR_DIM_X();
                int MONITOR_DIM_Y = S.get_MONITOR_DIM_Y();

                // convert gaze point (world coordinates) => monitor coordinates
                p.set_coord(-p.get_x(), p.get_y() + MONITOR_DIM_Y / 2, p.get_z());

                if (p.get_x() < -MONITOR_DIM_X / 2 || p.get_x() > MONITOR_DIM_X / 2)
                {
                    chart.Series["Series1"].Points.AddXY(frame_num, 0.0F);
                    Console.WriteLine("{0} - Confid Score: {1}", ID, 0.0F);

                    chart_f2.Series[0].Points.AddXY(DateTime.Now.ToLongTimeString(), 0.0F);
                }
                else if (p.get_y() < -MONITOR_DIM_Y / 2 || p.get_y() > MONITOR_DIM_Y / 2)
                {
                    chart.Series["Series1"].Points.AddXY(frame_num, 0.0F);
                    Console.WriteLine("{0} - Confid Score: {1}", ID, 0.0F);

                    chart_f2.Series[0].Points.AddXY(DateTime.Now.ToLongTimeString(), 0.0F);
                }
                else
                {
                    //chart.Series["Series1"].Points.AddXY(frame_num, 0);
                    //double D = p_m.look_up_value(Convert.ToInt32(-p.get_x()), Convert.ToInt32(p.get_y()) + MONITOR_DIM_Y / 2);
                    double D = p_m.look_up_value(Convert.ToInt32(p.get_x()), Convert.ToInt32(p.get_y()));
                    Console.WriteLine("{0} - Confid Score: {1}", ID, D);
                    //Console.WriteLine("Adding Point "+D.ToString());
                    chart.Series["Series1"].Points.AddXY(frame_num, Convert.ToSingle(D));
                    //write_to_msg_box(frame_num.ToString() + " " + D.ToString());

                    chart_f2.Series[0].Points.AddXY(DateTime.Now.ToLongTimeString(), Convert.ToSingle(D));
                }

                if (frame_num > 100)
                {
                    chart.ChartAreas[0].AxisX.Minimum = chart.ChartAreas[0].AxisX.Maximum - 100;
                }

            }
        }
Example #2
0
        private Subj_Data check_if_distract(Subj_Data S, Point_Obj est_gaze_pt)
        {
            int MONITOR_DIM_X = S.get_MONITOR_DIM_X();
            int MONITOR_DIM_Y = S.get_MONITOR_DIM_Y();

            //Console.WriteLine("INPUT PT: {0}", est_gaze_pt.ToString());
            //est_gaze_pt.set_coord(-est_gaze_pt.get_x(), est_gaze_pt.get_y() + MONITOR_DIM_Y / 2, est_gaze_pt.get_z());
            Point_Obj disp_pt = new Point_Obj(-est_gaze_pt.get_x(), est_gaze_pt.get_y() + MONITOR_DIM_Y / 2, est_gaze_pt.get_z());

            int cur_num_frames_distracted = S.get_num_frames_distracted();
            if (disp_pt.get_x() < -MONITOR_DIM_X / 2 || disp_pt.get_x() > MONITOR_DIM_X / 2)
            {
                //Console.WriteLine("INCREMENT!");
                S.set_num_frames_distracted(++cur_num_frames_distracted);
            }
            else if (disp_pt.get_y() < -MONITOR_DIM_Y / 2 || disp_pt.get_y() > MONITOR_DIM_Y / 2)
            {
                //Console.WriteLine("INCREMENT!!");
                S.set_num_frames_distracted(++cur_num_frames_distracted);
            }
            else
            {
                //Console.WriteLine("RESET");
                S.set_num_frames_distracted(0);
            }

            //Console.WriteLine("NUM DISTRACT FRAMES PRIOR: {0}", S.get_num_frames_distracted());

            return S;
        }