Function orthogonalToLine