當前位置: 首頁>>代碼示例>>C#>>正文


C# Coordinate.ToArray方法代碼示例

本文整理匯總了C#中System.Coordinate.ToArray方法的典型用法代碼示例。如果您正苦於以下問題:C# Coordinate.ToArray方法的具體用法?C# Coordinate.ToArray怎麽用?C# Coordinate.ToArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Coordinate的用法示例。


在下文中一共展示了Coordinate.ToArray方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HyperDistance

 /// <summary>
 /// Returns the distance that is appropriate for N dimensions.  In otherwords, if this point is
 /// three dimensional, then all three dimensions will be used for calculating the distance.
 /// </summary>
 /// <param name="coordinate">The coordinate to compare to this coordinate</param>
 /// <returns>A double valued distance measure that is invariant to the number of coordinates</returns>
 /// <exception cref="CoordinateMismatchException">The number of dimensions does not match between the points.</exception>
 public double HyperDistance(Coordinate coordinate)
 {
     if (coordinate.NumOrdinates != NumOrdinates) throw new CoordinateMismatchException();
     double sqrDist = 0;
     double[] vals = coordinate.ToArray();
     for (int i = 0; i < NumOrdinates; i++)
     {
         double diff = vals[i] - Coordinate[i];
         sqrDist += diff * diff;
     }
     return Math.Sqrt(sqrDist);
 }
開發者ID:joelmuzz,項目名稱:DotSpatial,代碼行數:19,代碼來源:Point.cs

示例2: HyperDistance

        /// <summary>
        /// Returns the distance that is appropriate for N dimensions.  In otherwords, if this point is
        /// three dimensional, then all three dimensions will be used for calculating the distance.
        /// </summary>
        /// <param name="coordinate">The coordinate to compare to this coordinate</param>
        /// <returns>A double valued distance measure that is invariant to the number of coordinates</returns>
        /// <exception cref="CoordinateMismatchException">The number of dimensions does not match between the points.</exception>
        public double HyperDistance(Coordinate coordinate)
        {
            if (coordinate.NumOrdinates != NumOrdinates) throw new CoordinateMismatchException();
            double[] vals = coordinate.ToArray();
            double diff = vals[0] - Convert.ToDouble(_x);
            double sqrDist = diff * diff;
            diff = vals[1] - Convert.ToDouble(_y);
            sqrDist += diff * diff;
            diff = vals[2] - Convert.ToDouble(_z);
            sqrDist += diff * diff;

            return Math.Sqrt(sqrDist);
        }
開發者ID:DIVEROVIEDO,項目名稱:DotSpatial,代碼行數:20,代碼來源:CoordinateF.cs

示例3: SlowCoordinate

 /// <summary>
 /// Creates a SlowCoordinate from any ICoordinate Interface
 /// </summary>
 /// <param name="coordinate">The Vector.IPoint interface to construct a coordinate from</param>
 public SlowCoordinate(Coordinate coordinate)
 {
     _numOrdinates = coordinate.NumOrdinates;
     _values = new double[_numOrdinates];
     double[] inVals = coordinate.ToArray();
     for (int I = 0; I < _numOrdinates; I++)
     {
         _values[I] = inVals[I];
     }
 }
開發者ID:zhongshuiyuan,項目名稱:mapwindowsix,代碼行數:14,代碼來源:SlowCoordinate.cs


注:本文中的System.Coordinate.ToArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。