コード例 #1
0
        /* This MouseDown event handler prints:
         * (1) the current position of the mouse
         * (2) the 3D mouse location on the ground plane (z = 0)
         * (3) the 2D mouse location converted from the 3D location */
        private void Window_MouseDown(object sender, MouseEventArgs e)
        {
            var range   = new LineRange();
            var isValid = ViewportInfo.Point2DtoPoint3D(Viewport, e.GetPosition(Viewport), out range);

            if (!isValid)
            {
                MouseLabel.Content = "(no data)";
            }
            else
            {
                var point3D = range.PointFromZ(0);
                var point   = ViewportInfo.Point3DtoPoint2D(Viewport, point3D);
                MouseLabel.Content = e.GetPosition(Viewport) + "\n" + point3D + "\n" + point;
            }
        }
コード例 #2
0
 public Vector To2DPoint(Point3D point)
 {
     return(viewPort == null ? new Vector() : ViewportInfo.Point3DtoPoint2D(viewPort, point).ToVector());
 }