Check if a point is in a rotated rectangle (C#)

前端 未结 7 1465
囚心锁ツ
囚心锁ツ 2021-01-07 22:20

I have a program in C# (Windows Forms) which draws some rectangles on a picturebox. They can be drawn at an angle too (rotated).

I know each of the rectangles\' star

7条回答
  •  抹茶落季
    2021-01-07 22:53

    If you know the coordinates of the corners of the rectangle, this is an fast, elegant solution that merely involves a couple of dot and scalar products: https://math.stackexchange.com/a/190373/178768

提交回复
热议问题