Computing Distance Functions from Generalized Sources on Weighted Polyhedral Surfaces