オブジェクトの回転を 0 ~ 360 度に正規化する単純な回転ルーチンに取り組んでいます。私の C# コードは機能しているようですが、完全に満足しているわけではありません。以下のコードを改善して、もう少し堅牢にすることはできますか?
public void Rotate(int degrees)
{
this.orientation += degrees;
if (this.orientation < 0)
{
while (this.orientation < 0)
{
this.orientation += 360;
}
}
else if (this.orientation >= 360)
{
while (this.orientation >= 360)
{
this.orientation -= 360;
}
}
}