CodingTrain / CodingTrain/Nebula-AppleSoft-Basic
Rotation matrix may be computed just once
- 主要言語
- BASIC
- スター
- 51
- フォーク
- 14
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
This might speed up the simulation, but probably not enough to have an acceptable frame rate in real time. So I guess you would still need to make a time lapse. In that regard, I'm not sure this is worth the trouble.
What the code does now is increment the rotation angle every loop by 1 degree, construct a new rotation matrix and use that matrix only once. Alternatively, you could construct a rotation matrix just once, before the draw loop, with an angle of 1 degree. Then use that matrix every time to transform the current coordinates. This will have the same effect, cumulatively. So instead of using sin and cos every loop *and* do the matrix multiplication, you have only the multiplication left.
One slight complication is that matrix multiplication p' = R.p can't be done in-place, because the old values would be overwritten when you still need them. So in BASIC, this probably requires juggling with array indices where you transform p(0..7) into p(8..15) on one loop, and p(8..15) into p(0..7) on the next loop.
I hope this is clear and that it will be helpful. Cheers!
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
描画ループから開始し、回転角、回転行列、および座標配列 p(0..7) と p(8..15) がどのように使用されているかを追跡します。現在のループごとの行列構築を、固定の1度行列を再利用して座標配列を交互に使用する方法と比較します。各ループで行列を再構築せずに、累積回転が同じ効果になることを完了条件とします。
索引モデルが issue の本文から書いたものです。
評価
- 領域
- computer-graphics
- issue の種類
- リファクタリング
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100