• 两点计算角度


    /// <summary>
          /// 两点计算角度
          /// </summary>
          /// <param name="startx"></param>
          /// <param name="starty"></param>
          /// <param name="endx"></param>
          /// <param name="endy"></param>
          /// <returns></returns>
          public static double CalulateXYAnagle(double startx, double starty, double endx, double endy)
          {

                                  //除数不能为0
              double tan = Math.Atan(Math.Abs((endy - starty) / (endx - startx))) * 180 / Math.PI;
              if (endx > startx && endy > starty)//第一象限
              {
                  return -tan;
              }
              else if (endx > startx && endy < starty)//第二象限
              {
                  return tan;
              }
              else if (endx < startx && endy > starty)//第三象限
              {
                  return tan - 180;
              }
              else
              {
                  return 180 - tan;
              }

          }

      /// <summary>
            ///     计算旋转角度
            /// </summary>
            /// <param name="nowpoint"></param>
            /// <returns></returns>
            public double ComputeAngle(Point nowpoint)
            {
                //斜边长度
                double length = PointLegth(nowpoint, CentPoint);
                //对边比斜边 sin
                double hudu = Math.Asin(Math.Abs(nowpoint.Y - CentPoint.Y)/length);
                double ag = hudu*180/Math.PI;
                //第一象限90-
                if ((CentPoint.X - nowpoint.X) <= 0 && (CentPoint.Y - nowpoint.Y) >= 0)
                    ag = 90 - ag;
                    //第二象限90+
                else if ((CentPoint.X - nowpoint.X) <= 0 && (CentPoint.Y - nowpoint.Y) <= 0)
                    ag = ag + 90;
                    //第三象限270-
                else if ((CentPoint.X - nowpoint.X) >= 0 && (CentPoint.Y - nowpoint.Y) <= 0)
                    ag = 270 - ag;
                    //第四象限270+
                else if ((CentPoint.X - nowpoint.X) >= 0 && (CentPoint.Y - nowpoint.Y) >= 0)
                    ag = ag + 270;
                //偏移
                ag -= 235;
                return ag;
            }
    
            /// <summary>
            ///     计算两点间距离
            /// </summary>
            /// <param name="pa"></param>
            /// <param name="pb"></param>
            /// <returns></returns>
            public double PointLegth(Point pa, Point pb)
            {
                return Math.Sqrt(Math.Pow((pa.X - pb.X), 2) + Math.Pow((pa.Y - pb.Y), 2));
            }
    
  • 相关阅读:
    oracle 11g ocp 笔记(7)-- DDL和模式对象
    oracle 11g ocp 笔记(6)-- oracle安全
    oracle 11g ocp 笔记(5)-- oracle存储结构
    oracle 11g ocp 笔记(4)-- 网络服务
    oracle 11g ocp 笔记(3)-- 实例管理
    oracle 11g ocp 笔记(2)-- 安装和创建数据库
    oracle 11g ocp 笔记(1)-- oracle 11g体系结构概述
    https://blog.csdn.net/gyming/article/details/46611369
    AWR管理
    3、实例管理
  • 原文地址:https://www.cnblogs.com/aoldman/p/3171559.html
Copyright © 2020-2023  润新知