コード例 #1
0
ファイル: StartEndPoint.cs プロジェクト: BrettHewitt/MWA
        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
ファイル: StartEndPoint.cs プロジェクト: pierrekhoury/MWA
        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;
        }