Closed
Description
Dyon uses vectors in 4D to describe points in 2D, 3D and 4D.
(1, 2, 3, 4)
(1, 2, 3) // `w` is 0
(1, 2) // `z` is 0, `w` is 0
At least two arguments must be specified. Arguments must be numbers.
Operators for vec4:
- Addition (
+
) and multiplication (*
) is per-component for two vectors - Scalar product (
*
) and scalar division (/
) allowed on both sides and is per-component - Dot product (
·
/*.
) - Cross product (
⨯
/x
) ignoresw
component - Norm/length of vector
|v|
The precision is f32
. Thumb rule: Whenever you do calculations with vectors, expect f32
precision unless the algorithms are carefully analyzed.
This is designed for:
- Easier 2D and 3D programming