Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/134.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 将笛卡尔平面上的X,Y坐标旋转θ度,单位为C++;_C++ - Fatal编程技术网

C++ 将笛卡尔平面上的X,Y坐标旋转θ度,单位为C++;

C++ 将笛卡尔平面上的X,Y坐标旋转θ度,单位为C++;,c++,C++,在我的代码中,我正在创建点的二维散点图: //Loop through all 13 objects for (int playerEntity = 0; playerEntity < 13; playerEntity++) { //Obtain X and Y Value Offset from Scatter Plot's origin for each object int px = positionX[playerEntity] / 20; int py

在我的代码中,我正在创建点的二维散点图:

//Loop through all 13 objects
for (int playerEntity = 0; playerEntity < 13; playerEntity++) {

    //Obtain X and Y Value Offset from Scatter Plot's origin for each object
    int px = positionX[playerEntity] / 20;
    int py = positionY[playerEntity] / 20;

    //Establish X and Y origin in terms of the screen's pixels;
    int originX = 500;
    int originY = 1000;

    //Plot the scatter plot point in respect to the origin
    FillRGB(originX  + px , originY  + py);

}
//遍历所有13个对象
对于(int-playerEntity=0;playerEntity<13;playerEntity++){
//获取每个对象从散点图原点的X和Y值偏移
int px=位置X[播放性]/20;
int py=位置Y[游戏性]/20;
//根据屏幕像素建立X和Y原点;
int-originX=500;
int-originY=1000;
//绘制相对于原点的散点图点
FillRGB(originX+px,originY+py);
}

如何将点px和py围绕图形原点旋转一定程度?例如,如果我想将图形的点px和py围绕原点旋转48度,我该怎么做?有什么想法吗?

你可以用这个公式:x=r*cosθ;y=r*sinθ。这里r是半径,这很方便,你可以用这个公式:x=r*cosθ;y=r*sinθ。这是半径,这很方便