Verify that the Rect frame is correct. Form OR No

enter image description here

Above the image containing 4 points that the user can drag, there are frames in the image, I want the algorithm (logic) in which the user draws a rectangle to have a value of rect or NOT.Rect must be a valid SHAPE (trapezoidal triangle, quadrangle). it is best to find that rect is a valid form or not.

Below forms are invalid enter image description here

enter image description here

+4
source share
1 answer

, , ( concave convex ). , , :

  • , 180 , .. . question SO.

  • , "" . . , , 360 ( ). , . 2 :

v_ {12} = (x2 - x1, y2 - y1) → 1 2

v_ {23} = (x3 - x2, y3 - y2) → 2 3

v_ {12}. v_ {23} = (x3 - x2) (x2 - x1) + (y3 - y2) (y2 - y1)

12 23 , .

+1

Source: https://habr.com/ru/post/1589189/


All Articles