• 点缓冲区边界生成算法【转】


    /************************************************************
     *  文档作者:dxj
     *  创建时间:2010.3.7
     *  文档说明:
     *      本文件是点缓冲区边界生成算法的C#实现。
     *
     ************************************************************/

    using System;
    using System.Collections.Generic;
    using System.Text;

    using DXJ.Teresa.GIS.GeoObject;

    namespace DXJ.Teresa.GIS.Buffer
    {
        /// <summary>
        /// 点缓冲区边界生成算法
        /// </summary>
        public class PointBuffer
        {
            #region Public Members
            /// <summary>
            /// 用于近似表示点缓冲区边界的内接正多边形的边数N
            /// </summary>
            public static int N = 12;
            #endregion

            #region Public Static Methods
            /// <summary>
            /// 根据一个给定点的坐标,生成基于这个点的点缓冲区边界点坐标串(逆时针)
            /// </summary>
            /// <param name="center">一个给定点的坐标</param>
            /// <param name="radius">缓冲区的半径</param>
            /// <returns>点缓冲区边界点坐标串(逆时针)</returns>
            public static string GetBufferEdgeCoords(Coordinate center, double radius)
            {
                double alpha = 0.0;//Math.PI / 6;
                double gamma = (2 * Math.PI) / N;

                StringBuilder strCoords = new StringBuilder();
                double x = 0.0, y = 0.0;
                for (double phi = 0; phi < (N - 1) * gamma; phi += gamma)
                {
                    x = center.X + radius * Math.Cos(alpha + phi);
                    y = center.Y + radius * Math.Sin(alpha + phi);
                    if (strCoords.Length > 0) strCoords.Append(";");
                    strCoords.Append(x.ToString()+","+y.ToString());
                }
                return strCoords.ToString();
            }
            #endregion
        }
    }

  • 相关阅读:
    poj 3714 Raid(平面最近点对)
    hdu 4638 Group(离线+树状数组)
    UVa 10294(polya 翻转与旋转)
    hdu 4633 Who's Aunt Zhang(polya+逆元)
    Use of Function Arctan
    codeforces 299E Cube Problem
    UVa11806 Cheerleaders(容斥原理)
    UVa11538 A Chess Queen
    UVa11401
    周报(2017.3.19-3.16)
  • 原文地址:https://www.cnblogs.com/neumik/p/2557045.html
Copyright © 2020-2023  润新知