zoukankan      html  css  js  c++  java
  • 点缓冲区边界生成算法【转】

    /************************************************************
     *  文档作者: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
        }
    }

  • 相关阅读:
    [LUOGU] P3275 [SCOI2011]糖果
    [BZOJ] 2287: 【POJ Challenge】消失之物
    [BZOJ] 2131: 免费的馅饼
    [JZOJ] 5835. Prime
    [JZOJ] 5837.Omeed
    UF_CAMGEOM_ask_custom_points 封装缺陷
    NX Open 切削层加载
    NX Open 图层说
    c++ Dll调用
    VC操作Excel文件编程相关内容总结
  • 原文地址:https://www.cnblogs.com/neumik/p/2557045.html
Copyright © 2011-2022 走看看