Friday 31 May 2019

When is a point inside a quadrilateral?

This all started because I am playing with four sided tiles (quadrilaterals) and needed to know if a point is inside one of the quadrilaterals. There are two basic shapes: kites and darts which you can see below. I got the (incorrect) answer, but not the proof, by searching on that web. There are other solutions which might be more reliable, but this one is good enough for my needs. There are some videos at the bottom of the post.

Kites

First we look at kites, quadrilaterals all of whose internal angles are less than 180°.

We show three situations with a point P inside (middle) or outside a kite. When P is inside, clearly the four angles add to 360°. If P is outside the tile then one of the angles will be the largest but less than 180° and the other three will add up to be the same as it, also less than 180°. So the total is less than 360°. For a kite this is an infallible test to see if a point is inside it or outside it.

Note: The four angles are always ∠APB, ∠BPC, ∠CPD, ∠APD and they are always measured the 'small' way so that they are less than 180°.

Darts

Sadly this is not an infallible test for dart shaped quadrilaterals when one internal angle is greater that 180° as we see in the three examples below:


Once we get further inside a dart things work better as can be illustrated by the graph below. We have a downward pointing dart (slightly exaggerated) and a horizontal yellow line passing through it. There are four points shown on the line: ##P_1,P_2,P_3,P_4##. A point on the green line shows the total angle (in radians) from the point above it on the yellow line to the four vertices. So
The first point which is outside the dart is ##P_1,total<2π ##
The second which is on the edge of the dart is ##P_2,total=2π ##
The third which is inside the dart is ##P_3,total=2π  ##
The fourth which is on another edge of the dart is ##P_4,=2π   ##

We can easily draw more graphs with the yellow line at different levels:

Our test would say that points inside the wing tips of the dart were not inside it.

For a kite the behaviour is much better:
These are all plotted and animated in Penrose Tile Plotter.xlsm. And here are the videos which demonstrate the limited but adequate validity of the method!

It is instructive to pause the videos at interesting points. The point P and the dashed lines to the vertices are there for illustrative purposes. The yellow and green lines are the important ones.