我正在嘗試圍繞圓的圓周來轉換一個點。C#中的旋轉矩陣繪製出怪異的形狀
爲了測試我的代碼,我只需要翻譯該點併爲每個角度增量畫一條從中心到翻譯點的直線。
這應該看起來像一個自行車輪,但它看起來更像一個鏟子。奇怪的是,我是否在數學函數中使用了弧度或度數似乎是一樣的。
for (double degrees = 0; degrees <= 360; degrees += 1)
{
double radians = Math.PI * degrees/180.0;
Console.Write("degrees = " + degrees + " radians = " + radians);
double sx = 0.0;
double sy = -100.0;
sx = ((sx * Math.Cos(radians)) + (sy * Math.Sin(radians)));
sy = (-(sx * Math.Sin(radians)) + (sy * Math.Cos(radians)));
Console.WriteLine(", sx = " + sx + ", sy = " + sy);
g.DrawLine(new Pen(Brushes.GhostWhite), 200, 200, (int)sx+200, (int)sy+200);
}
gah爲什麼我沒有看到/ facepalm – amcashcow