Exemplo n.º 1
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;
        }
Exemplo n.º 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;
        }