Get a point inside a polygon I have a 2D polygon of arbitrary geometry.  I need to find any point that is inside of that polygon.  Taking the center won't work, because the polygon might not be convex.  Is there a way to quickly find a point inside an arbitrary geometry?
 A: See question 3.6 in the Comp.Graphics.Algorithms FAQ: http://apodeline.free.fr/FAQ/CGAFAQ/CGAFAQ-3.html
A: *

*find the AABB (axis aligned bounding box) of the polygon

*choose a point P outside the bounding box, for example at the left and below the AABB

*choose a point M on the middle of an edge of the polygon

*intersect the line PM with the polygon and collect the intersection points in a list 

*check if the intersection points are passing too close to the vertices of the polygon. If so, go back to 2 and choose another point P outside the polygon, because otherwise you may run into problems

*sort the intersection points you find by the increasing distance from P

*your result is the middle of the segment determined by the first two intersection points

A: For the general polygonal area (not connected, not simply connected, possibly overlapping lines, self intersection allowed provided they happen at a vertex) the solution I came up with is:

*

*sort all y values

*for any pair of consecutive distinct y values $y_i < y_{i+1}$ compute the horizontal spans that the polygon is intercepting on the line

$$y={y_i + y_{i+1} \over 2}$$
The middle point of any non-empty span is inside the polygon and you can stop the search (note that by construction that point cannot be on an horizontal line). Care as usual must be taken for horizontal segments; for example by considering an edge $(x_a, y_a)-(x_b, y_b)$ intersecting the horizontal line if and only if
$${\rm min}(y_a, y_b) \le y \lt {\rm max}(y_a, y_b)$$
How the horizontal spans are constructed depends on the rule chosen for area definition (even-odd, non-zero winding, positive or negative winding). Note that in the general case (non-simple) polygon there may be no solution (consider the "triangle" built from three aligned points, no point in the plane is "inside").
Also, as usual for practical computer implementation, there can be problems when using floating point values where for example $y_{i} < y_{i+1}$ does NOT imply $y_{i} < {y_{i}+y_{i+1}\over 2} < y_{i+1}$ because, in a computer, the average of two distinct floating point values can be equal to one of the values.
A: Check this link for program + description
http://alienryderflex.com/polygon/
A: Partition your polygon into convex parts. From any part take two non-adjacent vertex $v_1$ and $v_2$ and calc
$$
P = (v_1+v_2)/2
$$
