圆上一个点的翻译

时间:2012-12-28 18:04:59

标签: math geometry

给出一个圆半径为R且其中心位于点(0,0)和一个点P(x,y),位于圆上(x * x + y * y = R * R)。我必须以圆角方向顺时针方向移动点P,角度为Z,然后找到新点的坐标。这样做有什么数学公式吗?提前谢谢!

3 个答案:

答案 0 :(得分:4)

使用极坐标,您可以推导出以下内容。

初始假设笛卡尔坐标中的(x,y)是极坐标中的(r,t),方式如下

x = r * cos(t)
y = r * sin(t)

现在让(x',y')在旋转角度a(逆时针)后成为新点

x' = r * cos(t + a)
y' = r * sin(t + a)

扩展它们,你可以得到以下

x' = r * cos (t) * cos (a) - r * sin (t) * sin (a) 
y' = r * sin (t) * cos (a) + r * cos (t) * sin (a)

x' = x * cos (a) - y * sin (a)
y' = x * sin (a) + y * cos (a)

现在替换a = -theta(因为你在时钟方向上提到了theta),你将得到新的分数。

答案 1 :(得分:1)

使用极坐标为此类使用或推断三角学:

感兴趣的方法:

    /// <summary>
    /// Returns polar coordinate converted to 2-d cartesian coordinates.
    /// Coordinates are relative to 0,0 of the angle base vertex
    /// </summary>
    public Point Point
    {
      get
      {
        int x = (int)(m_R * Math.Cos(m_Theta));
        int y = (int)(m_R * Math.Sin(m_Theta));
        return new Point(x, y);
      }
    }

全班:

  /* NFX by ITAdapter
   * Originated: 2006.01
   * Revision: NFX 0.2  2009.02.10
   */
  using System;
  using System.Collections.Generic;
  using System.Drawing;
  using System.Text;

  namespace NFX.Geometry
  {

    /// <summary>
    /// Represents a point with polar coordinates
    /// </summary>
    public struct PolarPoint
    {

      #region .ctor

        /// <summary>
        /// Initializes polar coordinates
        /// </summary>
        public PolarPoint(double r, double theta)
        {
          m_R = r;
          m_Theta = 0;
          Theta = theta;
        }

        /// <summary>
        /// Initializes polar coordinates from 2-d cartesian coordinates
        /// </summary>
        public PolarPoint(Point center, Point point)
        {
          this = CartesianUtils.PointToPolarPoint(center, point);
        }
      #endregion

      #region Private Fields 
        private double m_R;
        private double m_Theta;

      #endregion


      #region Properties
        /// <summary>
        /// R coordinate component which is coordinate distance from point of coordinates origin
        /// </summary>
        public double R
        {
          get { return m_R; }
          set { m_R = value; }
        }


        /// <summary>
        /// Angular azimuth coordinate component. An angle must be between 0 and 2Pi.
        /// Note: Due to screen Y coordinate going from top to bottom (in usual orientation)
        ///  Theta angle may be reversed, that is - be positive in the lower half coordinate plane.
        /// Please refer to:
        ///  http://en.wikipedia.org/wiki/Polar_coordinates
        /// </summary>
        public double Theta
        {
          get { return m_Theta; }
          set
          {
            if ((value < 0) || (value > Math.PI * 2))
              throw new NFXException("Invalid polar coordinates angle");
            m_Theta = value;
          }
        }


        /// <summary>
        /// Returns polar coordinate converted to 2-d cartesian coordinates.
        /// Coordinates are relative to 0,0 of the angle base vertex
        /// </summary>
        public Point Point
        {
          get
          {
            int x = (int)(m_R * Math.Cos(m_Theta));
            int y = (int)(m_R * Math.Sin(m_Theta));
            return new Point(x, y);
          }
        }
      #endregion



      #region Operators  
        public static bool operator ==(PolarPoint left, PolarPoint right)
        {
          return (left.m_R == right.m_R) && (left.m_Theta == right.m_Theta);
        }

        public static bool operator !=(PolarPoint left, PolarPoint right)
        {
          return (left.m_R != right.m_R) || (left.m_Theta != right.m_Theta);
        }
      #endregion


      #region Object overrides
        public override bool Equals(object obj)
        {
          if (obj is PolarPoint)
           return this==((PolarPoint)obj);
          else
           return false; 
        }

        public override int GetHashCode()
        {
          return m_R.GetHashCode() + m_Theta.GetHashCode();
        }

        public override string ToString()
        {
          return string.Format("Distance: {0}; Angle: {1} rad.", m_R, m_Theta);
        }


      #endregion

    }


  }

答案 2 :(得分:0)

使用笛卡尔到极坐标公式:

  

x = r * cos(theta)

     

y = r * sin(theta)

使用弧度并求解起始点和目标点(您缺少原点的θ,并且您具有目标点的delta theta)。

然后转换回笛卡尔:

  

r ^ 2 = x ^ 2 + y ^ 2

     

r = sqrt(x ^ 2 + y ^ 2)

     

theta = arctan(y / x)

可以在http://tutorial.math.lamar.edu/Classes/CalcII/PolarCoordinates.aspx

找到很好的参考资料