Vector magnitude calculation