public override void OnButtonDownEvent(InputEvent evt)
        {
            if (evt.IsRButtonDown())
            {
                this.Exit(1);
                return;
            }
            this.RemoveAllTempNodes();

            Renderer rv = GetRenderer();

            PickHelper pickHelper = new PickHelper();

            pickHelper.Initialize(rv);

            if (!pickHelper.Pick(evt.GetMousePosition()))
            {
                return;
            }


            TopoShape   shape   = pickHelper.GetGeometry();
            GeomSurface surface = new GeomSurface();

            if (!surface.Initialize(shape))
            {
                return;
            }

            IntersectionLineSurface intersector = new IntersectionLineSurface();

            intersector.SetSurface(shape);
            if (!intersector.Perform(rv.ComputeScreenRay(evt.GetMousePosition())))
            {
                return;
            }

            int nCount = intersector.GetPointCount();

            if (nCount < 1)
            {
                return;
            }

            double u = intersector.GetParameterU(1);
            double v = intersector.GetParameterV(1);

            Vector3 pt     = surface.Value(u, v);
            Vector3 normal = surface.GetNormal(u, v);

            LineNode lineNode = new LineNode();

            lineNode.Set(pt, pt + normal);

            this.ShowTempNode(lineNode);
            rv.RequestDraw(1);
        }
Beispiel #2
0
        Vector3 GetSelectedShape(int cx, int cy)
        {
            Renderer rv = GetRenderer();

            PickHelper ph = new PickHelper();

            ph.Initialize(rv);
            if (!ph.Pick(cx, cy))
            {
                return(null);
            }

            return(ph.GetPointOnShape());
        }
        Vector3 GetPointOnShape(int cx, int cy)
        {
            Platform.Vector3 hitPoint = null;
            Renderer rv = GetRenderer();

            PickHelper pickHelper = new PickHelper();
            pickHelper.Initialize(rv);

            if (pickHelper.Pick(cx, cy))
            {
                hitPoint = pickHelper.GetPointOnShape();
            }

            return hitPoint;
        }
Beispiel #4
0
        Vector3 GetPointOnShape(int cx, int cy)
        {
            Platform.Vector3 hitPoint = null;
            Renderer         rv       = GetRenderer();

            PickHelper pickHelper = new PickHelper();

            pickHelper.Initialize(rv);

            if (pickHelper.Pick(cx, cy))
            {
                hitPoint = pickHelper.GetPointOnShape();
            }

            return(hitPoint);
        }
        public override void OnButtonDownEvent(InputEvent evt)
        {

            if (evt.IsRButtonDown())
            {
                this.Exit(1);
                return;
            }
            this.RemoveAllTempNodes();

            Renderer rv = GetRenderer();

            PickHelper pickHelper = new PickHelper();
            pickHelper.Initialize(rv);

            if (!pickHelper.Pick(evt.GetMousePosition()))
                return;


            TopoShape shape = pickHelper.GetGeometry();
            GeomSurface surface = new GeomSurface();
            if (!surface.Initialize(shape))
                return;

            IntersectionLineSurface intersector = new IntersectionLineSurface();
            intersector.SetSurface(shape);
            if (!intersector.Perform(rv.ComputeScreenRay(evt.GetMousePosition())))
            {
                return;
            }

            int nCount = intersector.GetPointCount();
            if(nCount < 1)
                return;

            float u = intersector.GetParameterU(1);
            float v = intersector.GetParameterV(1);

            Vector3 pt = surface.Value(u, v);
            Vector3 normal = surface.GetNormal(u, v);

            LineNode lineNode = new LineNode();
            lineNode.Set(pt, pt + normal);

            this.ShowTempNode(lineNode);
            rv.RequestDraw(1);
        }