예제 #1
0
        public void Distance(StartEndPoint points, out float distance, out ClosestPoints order)
        {
            float[] distances = new float[4];
            distances[0] = StartPoint.Distance(points.StartPoint);
            distances[1] = StartPoint.Distance(points.EndPoint);
            distances[2] = EndPoint.Distance(points.StartPoint);
            distances[3] = EndPoint.Distance(points.EndPoint);

            float minDist = distances.Min();

            if (distances[0] == minDist)
            {
                order = ClosestPoints.StartStart;
            }
            else if (distances[1] == minDist)
            {
                order = ClosestPoints.StartEnd;
            }
            else if (distances[2] == minDist)
            {
                order = ClosestPoints.EndStart;
            }
            else
            {
                order = ClosestPoints.EndEnd;
            }

            distance = minDist;
        }
예제 #2
0
        public void Distance(StartEndPoint points, out float distance, out ClosestPoints order)
        {
            float[] distances = new float[4];
            distances[0] = StartPoint.Distance(points.StartPoint);
            distances[1] = StartPoint.Distance(points.EndPoint);
            distances[2] = EndPoint.Distance(points.StartPoint);
            distances[3] = EndPoint.Distance(points.EndPoint);

            float minDist = distances.Min();

            if (distances[0] == minDist)
            {
                order = ClosestPoints.StartStart;
            }
            else if (distances[1] == minDist)
            {
                order = ClosestPoints.StartEnd;
            }
            else if (distances[2] == minDist)
            {
                order = ClosestPoints.EndStart;
            }
            else
            {
                order = ClosestPoints.EndEnd;
            }

            distance = minDist;
        }