Matrixの掛(か)け算(ざん)

https://scratch.mit.edu/projects/88081061/

Matrixにも、足(た)し算(ざん)、引(ひ)き算(ざん)、掛(か)け算(ざん)などがあります。

掛(か)け算(ざん)について学(まな)びましょう。

掛(か)け算(ざん)

$$ \left( \begin{array}{ccc} x{next} \ y{next} \ z_{next} \ 1 \ \end{array} \right) = \left(\begin{array}{ccc} \ 行列\ \ \end{array} \right) \left( \begin{array}{ccc} x \ y \ z \ 1 \ \end{array} \right)

$$

こんな感(かん)じて、掛(か)け算(ざん)する事(こと)で、ポリゴンを、引(ひ)き延(の)ばしたり、回転(かいてん)させたりすることができます。

※ $$\left(x{next},y{next},z_{next}\right)$$が変換後(へんかんご)の位置(いち)です。

2倍(ばい)に拡大(かくだい)

30度(ど)回転(かいてん)



掛(か)け算(ざん)のルール

$$ \left( \begin{array}{ccc} x{next} \ y{next} \ z{next} \ 1 \ \end{array} \right) = \left( \begin{array}{ccc} a{11} & a{12} & a{13} & a{14}\ a{21} & a{22} & a{23} & a{24}\ a{31} & a{32} & a{33} & a{34}\ a{41} & a{42} & a{43} & a{44}\ \end{array} \right) \left( \begin{array}{ccc} x \ y \ z \ 1 \ \end{array} \right) = \left( \begin{array}{ccc} a{11} \times x + a{12} \times y + a{13} \times z + a{14} \times 1\ a{21} \times x + a{22} \times y + a{23} \times z + a{24} \times 1\ a{31} \times x + a{32} \times y + a{33} \times z + a{34} \times 1\ a{41} \times x + a{42} \times y + a{43} \times z + a_{44} \times 1\ \end{array} \right)

$$

掛(か)け算(ざん)のルールはこんな感(かん)じです。これを、Scratchで実装(じっそう)してみましょう。



(B) Scratchで実装(じっそう)してみる

(1) スクリプト画面(がめん)を表示(ひょうじ)する

(1-1) 左下(ひだりした)のSprite1をクリックする
(1-2) スクリプトタブをクリックする



(2) 掛(か)け算(ざん)するスクリブトを追加(ついか)する



(3) ポリゴンを表示(ひょうじ)するスクリブトを修正(しゅうせい)する



(4) 確認(かくにん)してみよう

https://scratch.mit.edu/projects/88081061/

(4-1) 旗(はた)がクリックされた時(とき)のスクリプトを変更(へんこう)する。

(4-2) 右上(みぎうえ)の旗(はた)アイコンをクリックする

(4-3) 三角形(さんかっけい)が表示(ひょうじ)されること



(5) Good!!

よくできました。次(つぎ)のステップに進(すす)みましょう。

results matching ""

    No results matching ""