Ported from here
import { Vector } from 'p5js-vector-standalone';
const vec1: Vector = new Vector(10, 0, 0);
const vec2: Vector = new Vector(20, 10, 0);
vec1.add(vec2); // vec1 = {x: 30, y: 10, z: 0};
- copy()
- add()
- rem()
- sub()
- mult()
- div()
- mag()
- magSq()
- dot()
- cross()
- dist()
- normalize()
- limit()
- setMag()
- heading()
- setHeading()
- rotate()
- angleBetween()
- lerp()
- reflect()
- array()
- equals()
- fromAngle()
- fromAngles()
- random2D()
- random3D()
- add()
- rem()
- sub()
- mult()
- rotate()
- div()
- dot()
- cross()
- dist()
- lerp()
- mag()
- normalize()
Huge thanks to everyone involved with p5.js