私は HTML5 で自分のキャンバスにいくつかの座標関数に取り組んでおり、オブジェクトを度単位で移動できる関数を作成したいと考えています。
私の夢は、次のように機能する関数を作成することです。
box.x=10;
box.y=10;
// now the box has the coordinates (10,10)
moveTheBoxWithThisAmountOfDistance=10;
degreesToMoveTheBox=90;
box.moveByDegrees(moveTheBoxWithThisAmountOfDistance,degreesToMoveTheBox);
// now the box.x would be 20 and box.y wouldn't be changed because
// we only move it to the right (directional 90 degrees)
これが意味をなすことを願っています!
だから私の質問は次のとおり
です。度を座標に変換する必要がある場合、数式はどのように見えますか?