This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| math [2019/08/26 18:16] – korshun | math [2019/08/26 18:26] (current) – [Length] korshun | ||
|---|---|---|---|
| Line 191: | Line 191: | ||
| ===== Vector math ===== | ===== Vector math ===== | ||
| + | |||
| + | Vector math functions come in 2D and 3D versions. All vector math functions operate only on fixed-point vectors. No integer versions are available. | ||
| + | |||
| + | Vectors are passed as arguments named '' | ||
| + | |||
| + | If a function returns a vector, it uses [[multiple return values]], returning vector components in the same XYZ order, so '' | ||
| + | |||
| + | If a function accepts more than one vector, the first vector is passed as '' | ||
| + | |||
| ==== Length ==== | ==== Length ==== | ||
| - | * 2D: [[zdoom> | + | * 2D: [[zdoom> |
| * 3D: '' | * 3D: '' | ||
| - | '' | + | These functions return the length of the input vector. |
| ==== Dot product ==== | ==== Dot product ==== | ||
| Line 204: | Line 213: | ||
| * 3D: '' | * 3D: '' | ||
| - | These functions return the [[wp>dot product]] | + | These functions return |
| ==== Normalization ==== | ==== Normalization ==== | ||
| Line 211: | Line 220: | ||
| * 3D: '' | * 3D: '' | ||
| - | These functions [[wp> | + | These functions |
| - | === Example usage === | + | === Examples |
| < | < | ||
| normalize3d(x, | normalize3d(x, | ||