Update pointToLineDistance and add tests