Since I first learned about vectors, I noticed something interesting: almost any numeric formula can be replaced by a vectorial formula by just replacing addition, multiplication, etc., with their vectorial elementwise versions. For example:
average a b = (a + b) / 2
not only gets the average of 2 numbers, but the mid-point between 2 vectors if you use the elementwise addition. On Calculus, many formulas for integrals can be extended to triple, quadruple integrals unchanged the same way. Even more interestingly, some formulas gain a dimensional generality by doing so.
distance a b = modulus (a - b)
That formula holds for numbers, returning their difference, but also works for any n-dimensional vectors, returning their n-dimensional distance. Even complicated formulas such as:
intersectAABB (Ray r_pos r_dir) (AABB aabb_min aabb_max) = [tmin, tmax] where t1 = (aabb_min - r_pos) / r_dir t2 = (aabb_max - r_pos) / r_dir tmin = foldr1 max (liftI2 min t1 t2) tmax = foldr1 min (liftI2 max t1 t2)
get the same benefit. On this case,
intersectAABB, used for numbers, returns the intersection distance between a line and a segment. Used with 2d vectors, it returns the intersection distances between a line and a rectangle. With 3d vectors, the intersection distances between a line and a cuboid. And so on.
All that leads me to believe it makes a lot of sense to use vectors just like number. My question is: why is nobody doing so? Why are
cross considered the vectorial version of multiplication when they're mostly completely different operations? Is there any case where using vectors in place of numbers stops making sense?