private void OnMove(object sender, Vector3 screenPos)
        {
            Ray ray = rayCamera.ScreenPointToRay(screenPos);

            if (Physics.Raycast(ray, out hit, 10000, layerMask))
            {
                bool lineUpdated = false;
                try
                {
                    lineUpdated = line.UpdateLine(hit.point);
                }
                catch (MissingReferenceException e)
                {
                    line = null;
                }

                if (lineUpdated)
                {
                    RaiseLineDrawn(line, hit.point);
                }
            }
            else
            {
                OnUp(sender, screenPos);
            }
        }
        private void OnDown(object sender, Vector3 screenPos)
        {
            Ray ray = rayCamera.ScreenPointToRay(screenPos);

            if (Physics.Raycast(ray, out hit, 10000, layerMask))
            {
                // Do something with the object that was hit by the raycast.
                line = lineFactory.GetLine(lineProperty);
                line.UpdateLine(hit.point);

                RaiseLineCreated(line);
            }
        }
예제 #3
0
        /*
         * Return the line points.
         */
        private List <DataPoint> generateLinePoints()
        {
            float            maxX = 0, minX = float.MaxValue;
            float            currentValue;
            List <DataPoint> pointsList = new List <DataPoint>();

            Line.Line line = getLinearReg();
            foreach (var value in info.get_attribute(GraphAttribute))
            {
                currentValue = float.Parse(value);
                if (currentValue < minX)
                {
                    minX = currentValue;
                }
                if (currentValue > maxX)
                {
                    maxX = currentValue;
                }
            }
            pointsList.Add(new DataPoint(minX, line.f(minX)));
            pointsList.Add(new DataPoint(maxX, line.f(maxX)));
            return(pointsList);
        }
예제 #4
0
        /*
         * Return Anomalies Reg Line
         */
        private List <DataPoint> generateAnomaliesLine()
        {
            float            maxX = float.MinValue, minX = float.MaxValue;
            List <DataPoint> pointsList = new List <DataPoint>();

            Line.Line line = getLinearReg();
            foreach (DataPoint point in anomaliesPoints)
            {
                if (point.X < minX)
                {
                    minX = (float)point.X;
                }
                if (point.X > maxX)
                {
                    maxX = (float)point.X;
                }
            }
            if (minX != float.MaxValue && maxX != float.MinValue)
            {
                pointsList.Add(new DataPoint(minX, line.f(minX)));
                pointsList.Add(new DataPoint(maxX, line.f(maxX)));
            }
            return(pointsList);
        }
예제 #5
0
        private void OnUp(object sender, Vector3 screenPos)
        {
            RaiseLineEnded(line);

            line = null;
        }
예제 #6
0
 protected void RaiseLineDrawn(Line.Line line, Vector3 position)
 {
     OnLineSegmentAdded?.Invoke(line, position);
 }
예제 #7
0
 protected void RaiseLineEnded(Line.Line line)
 {
     OnLineEnded?.Invoke(line);
 }