Esempio n. 1
0
        public override void MouseDown(int mx, int my, bool isRightButton)
        {
            double x = mx;
            double y = my;
            int    i;

            for (i = 0; i < 3; i++)
            {
                if (Math.Sqrt((x - m_x[i]) * (x - m_x[i]) + (y - m_y[i]) * (y - m_y[i])) < 5.0)
                {
                    m_dx  = x - m_x[i];
                    m_dy  = y - m_y[i];
                    m_idx = i;
                    break;
                }
            }
            if (i == 3)
            {
                if (AggMath.point_in_triangle(m_x[0], m_y[0],
                                              m_x[1], m_y[1],
                                              m_x[2], m_y[2],
                                              x, y))
                {
                    m_dx  = x - m_x[0];
                    m_dy  = y - m_y[0];
                    m_idx = 3;
                }
            }
        }
Esempio n. 2
0
        public override void MouseDown(int mx, int my, bool isRightButton)
        {
            int i;

            if (isRightButton)
            {
                //ScanlineUnpacked8 sl = new ScanlineUnpacked8();
                //ScanlineRasterizer ras = new ScanlineRasterizer();
                //stopwatch.Restart();
                stopwatch.Stop();
                stopwatch.Reset();
                stopwatch.Start();
                for (i = 0; i < 100; i++)
                {
                    //render_gouraud(sl, ras);
                }

                stopwatch.Stop();
                string buf;
                buf = "Time=" + stopwatch.ElapsedMilliseconds.ToString() + "ms";
                throw new NotImplementedException();
                //guiSurface.ShowSystemMessage(buf);
            }

            if (!isRightButton)
            {
                double x = mx;
                double y = my;

                for (i = 0; i < 3; i++)
                {
                    if (Math.Sqrt((x - m_x[i]) * (x - m_x[i]) + (y - m_y[i]) * (y - m_y[i])) < 10.0)
                    {
                        m_dx  = x - m_x[i];
                        m_dy  = y - m_y[i];
                        m_idx = (int)i;
                        break;
                    }
                }
                if (i == 3)
                {
                    if (AggMath.point_in_triangle(m_x[0], m_y[0],
                                                  m_x[1], m_y[1],
                                                  m_x[2], m_y[2],
                                                  x, y))
                    {
                        m_dx  = x - m_x[0];
                        m_dy  = y - m_y[0];
                        m_idx = 3;
                    }
                }
            }
        }