From the man page for XFillPolygon
· If shape is Complex, the path may self-intersect. Note that con‐ tiguous coincident points in the path are not treated as self- intersection.
· If shape is Convex, for every pair of points inside the polygon, the line segment connecting them does not intersect the path. If known by the client, specifying Convex can improve performance. If you specify Convex for a path that is not convex, the graphics results are undefined.
· If shape is Nonconvex, the path does not self-intersect, but the shape is not wholly convex. If known by the client, specifying Nonconvex instead of Complex may improve performance. If you specify Nonconvex for a self-intersecting path, the graphics results are undefined.
I am having performance problems with fill XFillPolygon and as the man page suggests the first step I want to take is to specify the correct shape of the Polygon ( I am currently using Complex to be on the safe side).
Is there an effecient algorithm to determine if a polygon (defined by a series of coordinates) is convex, non convex or complex.