PDA

View Full Version : TReflectionTiles.InPolygon not quite working normally?



ineedbot
04-25-2016, 07:17 AM
Am I making the polygon wrong?

http://i63.tinypic.com/2w1vatv.png
TReflectionTiles.InPolygon([Point(3243, 3244), Point(3248, 3244), Point(3248, 3248), Point(3243, 3248))])

The green tiles return true as expected, but the red tiles return false but are expected to be true.

Am I doing something wrong?

ALL of the outside (of the house) tiles return false as expected.

Joopi
04-25-2016, 07:41 AM
Try checking the function and make sense of it if some < / > operands that should be <= / >=. Don't know since I haven't used inPolygon. In this case I guess you could just check it manually since it's just a box.

ineedbot
04-25-2016, 07:47 AM
After some research, the inPolygon is using cross numbering (how many times a ray crosses the poly's edge, if odd then inside, if even then outside) to determine if the point is inside the poly or not and it turns out that the polygon's edge is inside the house with the parameters I gave it (the red tiles).

Turpinator
04-25-2016, 02:21 PM
Soo... it looks like the solution would be to increase the size of the box/polygon? subtract 1 from the X for the first, subtract 1 x, add 1 y for the second, and add 1 y for the third.

Wouldnt using a tbox/pointinbox() just be easier? (in this case)

ineedbot
04-25-2016, 09:17 PM
Soo... it looks like the solution would be to increase the size of the box/polygon? subtract 1 from the X for the first, subtract 1 x, add 1 y for the second, and add 1 y for the third.

Wouldnt using a tbox/pointinbox() just be easier? (in this case)
I guess I could just use PointInBox but however that would defeat the purpose in using inPolygon, its a great function, very useful and flexible, but what would I use if the area was indeed a polygon. Like Lumbridge general store for example, I tested it there, and again the far upper right return false when it should be true.