-1

There is a n sided regular polygon and there is a point .What is the minimum number of lines a person has to draw to determine whether point is inside the polygon in worst case.For example for n=5 there should be 4 lines (worst case).How should i approach.

1 Answers1

0

I am very confused by this question what exactly are you asking?

  1. for point inside polygon test you need to cast just 1 line

    • semi axis from that point to any direction and just count the intersections
    • the blue arrowed line on image below
    • see hit test
  2. did you mean how many lines this semi axis could hit instead?

    • in that case for convex polygon 2 or 4 (4 if you hit the vertexes)
    • for N-lines concave polygon N-1 or N in the worst case.
    • the regularity does not mean anything in this case unless I misunderstood something ...
    • may be an image of what you want will be better then text
    • this is how I see it:

    hit test edge cases

    • blue dot is your tested point
    • blue arrow is casted semi axis
    • green lines are hit-ed lines of polygon
Community
  • 1
  • 1
Spektre
  • 49,595
  • 11
  • 110
  • 380