Function pointOnLine