podobni X1 Y1 X2 Y2 X3 Y3 X4 Y4 X5 Y5 X6 Y6 TRUE rasstoyanie X1 Y1 X2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
podobni(X1, Y1, X2, Y2, X3, Y3, X4, Y4, X5, Y5, X6, Y6, TRUE) :-
rasstoyanie(X1, Y1, X2, Y2, R1),
rasstoyanie(X2, Y2, X3, Y3, R2),
rasstoyanie(X3, Y3, X1, Y1, R3),
rasstoyanie(X4, Y4, X5, Y5, R4),
rasstoyanie(X5, Y5, X6, Y6, R5),
rasstoyanie(X6, Y6, X4, Y4, R6),
TRUE = (R1*R5 == R2*R4), (R1*R6 == R4*R3).
rasstoyanie(X1, Y1, X2, Y2, R) :-
R is ((X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1)).