Is there a way to find the relative path of dir 'b' with respect to dir 'a', where 'a' != pwd?

relativePath(‘b’) gives the relative path of ‘b’ with respect to the present working directory. I need to find the relative path with respect to a different directory. Is there support for it or do I’ve to write some code to achieve that?