have you tried just getting the magnitude of two positions that have been offset away from the center line then just choosing the point with a smaller magnitude