Calculate gradient of a line joining two points (#376)