I
I
ibiescri2015-07-10 10:45:18
Algorithms
ibiescri, 2015-07-10 10:45:18

How to determine that three points satisfy the condition?

There are coordinates (x1, y1), (x2, y2), (x3, y3).
How to check the condition that all these three points are different, but at the same time they lie on the same straight line, either parallel to the abscissa axis, or parallel to the y-axis?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Movchan, 2015-07-10
@ibiescri

(x1 != x2 or y1 != y2) and    # Первая точка не совпадает со второй и...
(x1 != x3 or y1 != y3) and    # Первая точка не совпадает с третьей и...
(x2 != x3 or y2 != y3) and    # Вторая точка не совпадаят с третьей и...
((x1 == x2 and x2 == x3) or   # X-координаты всех точек равны или...
 (y1 == y2 and y2 == y3))     # Y-координаты всех точек равны

P
Pavel Gogolinsky, 2015-07-10
@gogolinsky

On the same curve? Or in one line?
The points are different - compare coordinates
Parallel to the y-axis - so everyone will have the same x-coordinate
Parallel to the x-axis - so everyone will have the same y-coordinate

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question