当前位置: 首页>>代码示例>>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;未经允许,请勿转载。