Example #1
0
        /// <summary>
        /// 输入新坐标系的点,返回旧坐标系的点
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="a"></param>
        internal static Point Rotate(Point mpNew, SinCos a)
        {
            Point mp = new Point(0, 0);

            mp.X = mpNew.X * a.iCos - mpNew.Y * a.iSin;
            mp.Y = mpNew.X * a.iSin + mpNew.Y * a.iCos;
            return(mp);
        }
Example #2
0
        public override bool Equals(object obj)
        {
            SinCos item = (SinCos)obj;

            if (item.iSin == this.iSin &&
                item.iCos == this.iCos)
            {
                return(true);
            }
            return(false);
        }
Example #3
0
        private static MyPoint mpBaseVector = new MyPoint(1.0f, 0);//使用x轴做基向量
        /// <summary>
        /// 按照参数2指定的向量与基向量的夹角计算参数1对应的绝对元胞坐标
        /// </summary>
        /// <param name="vector"></param>
        /// <returns></returns>
        internal static Point GetRealXY(Point point, MyPoint newVector)
        {
            if (newVector == null)
            {
                ThrowHelper.ThrowArgumentNullException("输入的参数不能为零");
            }
            //获取正弦和余弦值并且进行旋转变换
            SinCos sc = VectorTools.getSinCos(mpBaseVector, newVector);

            return(Coordinates.Rotate(point, sc));
        }