One thing you could do is to keep track of the lines between the points on your pInLine and the new offset points. Let's say you have point 1 that has X1Y1 coordinates and the offset to this point is point 1' that has X1'Y1' coordinates. The two points can form a line (which we'll call offset line 1). The next point on your pInLine is point 2 that has X2Y2 coordinates and its offset with coordinates X2'Y2'. This again can form a line, offset line 2. You can see if these two offset lines cross each other. If they intersect, you'll get a bow tie or something screwy. If they don't, you're good and can place that line. It'll slow down your code a lot to check all previous offset lines, but it should help. The shapes might not always be great, so you might want to play with the polygon a bit to get a better shape (maybe densifying it, or adding vertices at turns).
... View more