Esempio n. 1
0
        private void OnRenderWindow_MouseClick(object sender, MouseEventArgs e)
        {
            if (!m_PickPoint)
            {
                return;
            }

            //PickHelper pickHelper = renderViewDraw.PickShape(e.X, e.Y);
            //if (pickHelper != null)
            //{
            //    // add a ball
            //    Platform.TopoShape shape = GlobalInstance.BrepTools.MakeSphere(pickHelper.GetPointOnShape(), 2);
            //    renderView.ShowGeometry(shape, 100);
            //}
            //// Try the grid
            Vector3 pt = renderViewDraw.HitPointOnGrid(e.X, e.Y);

            if (pt != null)
            {
                if (Vecs.Count() == 0)
                {
                    Vecs.Add(pt);
                    TopoShape shape = GlobalInstance.BrepTools.MakeSphere(pt, 1);
                    renderViewDraw.ShowGeometry(shape, 100);
                }
                else
                {
                    var c = from m in Vecs
                            where m.Distance(pt) <= 1
                            select m;

                    if (c.Count() == 0)
                    {
                        var pt0 = Vecs.Last();
                        Vecs.Add(pt);
                        TopoShape shape = GlobalInstance.BrepTools.MakeSphere(pt, 1);
                        TopoShape edge  = GlobalInstance.BrepTools.MakeLine(pt0, pt);
                        EdgeG.Add(edge);
                        renderViewDraw.ShowGeometry(shape, 100);
                        renderViewDraw.ShowGeometry(edge, 100);
                    }
                    else if (Vecs.First().Equals(c.Last()))
                    {
                        TopoShape edge = GlobalInstance.BrepTools.MakeLine(Vecs.Last(), Vecs.First());
                        EdgeG.Add(edge);
                        renderViewDraw.ShowGeometry(edge, 100);
                        m_PickPoint = !m_PickPoint;
                    }
                }
            }
        }
Esempio n. 2
0
        private void OnRenderWindow_MouseClick(object sender, MouseEventArgs e)
        {
            if (!m_PickPoint)
            {
                return;
            }

            Platform.PickHelper pickHelper = renderView.PickShape(e.X, e.Y);
            if (pickHelper != null)
            {
            }

            Vector3 pt = renderView.HitPointOnGrid(e.X, e.Y);

            if (pt != null)
            {
            }
        }