是编程,在一个二维坐标系中已知一个点的坐标,求在坐标系经过旋转之后得到新的坐标系的点的坐标

如题所述

向量旋转问题。

设向量A(x,y)逆时针旋转theta度

那么有旋转后向量B(x*cos(theta)-y*sin(theta), x*sin(theta)+y*cos(theta))

座标系旋转等于点绕远点旋转等于向量旋转

代码:

       struct Vector {
        double x, y;
        Vector() {x = y = 0;}
        Vector(double a, double b):x(a),y(b){}
        const Vector rotateAC (double theta) ;
        const Vector getRotatedAC (double theta) const ;
        const Vector rotateC (double theta) ;
        const Vector getRotatedC (double theta) const ;
        const Vector operator += (Vector b);
        const Vector operator -= (Vector b);
        const Vector operator *= (double b);
        const Vector operator /= (double b);
    };
   
    const Vector Vector :: rotateAC (double theta)
    {return (*this) = getRotatedAC(theta);}
    const Vector Vector :: getRotatedAC (double theta) const
    {return Vector(x*cos(theta) - y*sin(theta), x*sin(theta) + y*cos(theta));}
    const Vector Vector :: rotateC (double theta) {return rotateAC(-theta);}
    const Vector Vector :: getRotatedC (double theta) const {return getRotatedAC(-theta);}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-06-23
有一个旋转公式,你百度一下,吧旋转角度和原坐标带入公式就可以算出新坐标追问

我是要那个编程代码,不是怎么求

本回答被提问者采纳
第2个回答  2017-05-12
什么语言的编程?

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网