здесь код, который вы можете использовать
* get the points of the region contour
get_region_contour (Region, Rows, Columns)
* sort the Columns
tuple_sort_index ( Columns, Indices)
* Left point
LeftIndex := Indices[0]
LeftRow := Rows[LeftIndex]
LeftColumn := Columns[LeftIndex]
* Right point
RightIndex := Indices[|Indices|-1]
RightRow := Rows[RightIndex]
RightColumn := Columns[RightIndex]