@pravsripad: I suggest to combine the functionality of both rescale function. This one here rescales vector1 to the domain of vector2