我在做一個小遊戲,現在我正在研究一個「雷達」。現在要做到這一點,我需要根據一個點圍繞中心點旋轉多少來找到兩個點。根據一個點在一箇中心點上旋轉多少來尋找2分
A
是要繞C
。
由於A
繞C
,B
& D
將隨A
移動,並停留在基於斷的地方A
是相同的「位置」。
因此,舉例來說,如果A
各地C
旋轉90度B
& D
會再移動,並在這個位置
但我不是在TRIG非常好,所以我真的不知道我需要的數學才能找到B
& D
根據多少A
已經旋轉了大約C
。
如何找到B
& D
基於關閉的多少A
各地C
已經轉動?
我會像最終的數學看起來有點類似於此:
float * returnB(float * APoint, float * CPoint)
{
float B_Out[2];
//calculate where B is based off A & C
B_Out[0] = B_X;
B_Out[1] = B_Y;
return B_Out;
}
float B[2];
B[0] = returnB(A,C)[0];
B[1] = returnB(A,C)[1];
float * returnD(float * APoint, float * CPoint)
{
float D_Out[2];
//calculate where D is based off A & C
D_Out[0] = D_X;
D_Out[1] = D_Y;
return D_Out;
}
float D[2];
D[0] = returnD(A,C)[0];
D[1] = returnD(A,C)[1];
http://stackoverflow.com/questions/2259476/rotating-a-point-about-another-point-2d – SingerOfTheFall
你知道A圍繞C旋轉的角度嗎? – acraig5075