示例#1
0
        private void Mouse_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Point point = e.GetPosition(x_contentControl);

            if (m_trackball == null)
            {
                m_trackball = new Trackball((float)x_contentControl.ActualWidth, (float)x_contentControl.ActualHeight);
            }

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                m_downPoint = point;
                m_trackball.PreviousPoint = m_downPoint;
                m_isMoving = true;
            }
            if (e.RightButton == MouseButtonState.Pressed)
            {
                m_downPoint = point;
                m_isMoving  = true;
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the Mouse class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            m_renderEngine = new PointCloudRenderEngine();
            x_contentControl.RegisterRenderer(m_renderEngine);

            this.MouseMove  += new MouseEventHandler(Mouse_MouseMove);
            this.MouseDown  += new MouseButtonEventHandler(Mouse_MouseDown);
            this.MouseUp    += new MouseButtonEventHandler(Mouse_MouseUp);
            this.MouseWheel += new MouseWheelEventHandler(Mouse_MouseWheel);

            PositionString = string.Empty;

            this.DataContext = this;

            float minx, miny, minz, maxx, maxy, maxz;

            Vector4[] points = CreateFileData(out minx, out miny, out minz, out maxx, out maxy, out maxz);
            //Vector4[] points = CreateRandomData(out minx, out miny, out minz, out maxx, out maxy, out maxz);

            float rangeX       = maxx - minx;
            float rangeY       = maxy - miny;
            float rangeZ       = maxz - minz;
            float largestRange = Math.Max(rangeX, Math.Max(rangeY, rangeZ));

            m_renderEngine.TranslationVector = new Vector3(-minx, -miny, -minz);
            m_renderEngine.ScaleVector       = new Vector3(1 / largestRange, 1 / largestRange, 1 / largestRange);

            m_renderEngine.SetPoints(points, minx, miny, minz, maxx, maxy, maxz);

            m_trackball = null;

            // world coords
            m_renderEngine.CameraPosition = new Vector3(0.5f, 0.5f, -10.0f);
            m_renderEngine.TargetPosition = new Vector3(0.5f, 0.5f, 0.5f);

            return;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the Mouse class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            m_renderEngine = new PointCloudRenderEngine();
            x_contentControl.RegisterRenderer(m_renderEngine);

            this.MouseMove += new MouseEventHandler(Mouse_MouseMove);
            this.MouseDown += new MouseButtonEventHandler(Mouse_MouseDown);
            this.MouseUp += new MouseButtonEventHandler(Mouse_MouseUp);
            this.MouseWheel += new MouseWheelEventHandler(Mouse_MouseWheel);

            PositionString = string.Empty;

            this.DataContext = this;

            float minx, miny, minz, maxx, maxy, maxz;

            Vector4[] points = CreateFileData(out minx, out miny, out minz, out maxx, out maxy, out maxz);
            //Vector4[] points = CreateRandomData(out minx, out miny, out minz, out maxx, out maxy, out maxz);

            float rangeX = maxx - minx;
            float rangeY = maxy - miny;
            float rangeZ = maxz - minz;
            float largestRange = Math.Max(rangeX, Math.Max(rangeY, rangeZ));
            m_renderEngine.TranslationVector = new Vector3(-minx, -miny, -minz);
            m_renderEngine.ScaleVector = new Vector3(1 / largestRange, 1 / largestRange, 1 / largestRange);

            m_renderEngine.SetPoints(points, minx, miny, minz, maxx, maxy, maxz);

            m_trackball = null;

            // world coords
            m_renderEngine.CameraPosition = new Vector3(0.5f, 0.5f, -10.0f);
            m_renderEngine.TargetPosition = new Vector3(0.5f, 0.5f, 0.5f);

            return;
        }
示例#4
0
        private void Mouse_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Point point = e.GetPosition(x_contentControl);

            if (m_trackball == null)
            {
                m_trackball = new Trackball((float)x_contentControl.ActualWidth, (float)x_contentControl.ActualHeight);
            }

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                m_downPoint = point;
                m_trackball.PreviousPoint = m_downPoint;
                m_isMoving = true;
            }
            if (e.RightButton == MouseButtonState.Pressed)
            {
                m_downPoint = point;
                m_isMoving = true;
            }
        }