Added functions for calculating the magnitude of a graphics vector and normalizing it.