1
edit
Changes
no edit summary
<li>Used for storing position, velocity, acceleration, etc.</li>
<li>Processing has a built-in <b>PVector</b> object for 2D and 3D</li>
</ul>
<b>Operations</b><br />
<br />
<b>Addition</b>
<ul>
<li>Graphically -> add head to tail</li>
<li>Algebraically -> add components [3, 3] + [1, 2] = [4, 5]</li>
<li>PVector.add(v1, v2);</li>
<li>vec.add(v);</li>
</ul>
<b>Subtraction</b>
<ul>
<li>Graphically -> flip the direction of one vector, then add</li>
<li>Algebraically -> subtract components [3, 3] - [1, 2] = [2, 1]</li>
<li>PVector.sub(v1, v2);</li>
<li>vec.sub(v);</li>
</ul>
<b>Scale</b>
<ul>
<li>Graphically -> stretch or shrink</li>
<li>Algebraically -> multiply components by scalar [1,3] * 2 = [2, 6]</li>
<li>PVector.mult(float);</li>
</ul>
<b>Calculate Magnitude</b>
<ul>
<li>Graphically -> measure length</li>
<li>Algebraically -> use Pythagorean theorem</li>
<li>PVector.mag()</li>
</ul>