added flag to matrix(), to reset or not reset the w component (not resetting is faster)