refactor getSlope function into Line prototype