I want to triangulate a bounded 2D area in order to interpolate the colors, but unfortunately I'm not a clever mathematician, so I could need some clever idea.
Let's have a look at this sample:
The area is bounded by a series of 2D-points, and there is some special point C that is not outside of the bounded area.
I started out with a bounded area like on the left, so when following the points of the border clockwise, I could set up triangles A starting at C (point 1) and continuing with points 2 and 3 (each vertex also has a color property, and inside the triangle I can interpolate linearly). The final triangle was composed of both end points and the "center" point C.
The algorithms seems to work because the curvature of the border is the same as the "direction of movement" (sorry, I cannot express it better in mathematics' words).
However when looking at the right example building triangles the same way (like (1, 2, 3)), the triangles $A_1$ cross border area, also resulting in incorrect interpolation.
So my idea was to select a point 4 on the border (but which exactly?) to build triangles $A_2$ like (2, 3, 4), but I don't know which condition to use, and more importantly how to compute the condition efficiently.
So what I have is an array of 2D points with a color attribute (like RGB) and some reference point C (also with a color attribute). (I picked C to be one corner of the triangles, because it seemed just handy to do so.)
So what algorithm would you suggest? The algorithm should need only one pass through the array of points, preferably.
One obvious solution might be using a "dynamic C", but I have to idea how to pick it, specifically as I would not know the color of it without interpolating from other points.