Actually, it's there in an implicit way. When you multiply two sides represented as vectors that have less than 180° the result is of a different sign than those that have more than 180° ... In fact, you could get away by just summing the angles at each vertex of the polygon (but for those angles that are larger than 180° we'd subtract the angle's value from 180°, thereby obtaining a negative value), and in the end get what you want, which is a sign representing the drawing orientation of the polygon.you talked about reversing things if the angle was more than 180° for a given vertex, yet here you don't mention anything about that at all.
You just assume that all sides are of infinite length, and define them as linear equations, for the moment. The 90° intersection to the point being analyzed will probably lie outside the line's limits, but that is of not consequence. I don't think this method is too computationally demanding. By defining each side as a linear equation, you have m as the slope of that line, and therefore -1/m is the slope of the perpendicular intersecting line. Calculating the intersecting point for that side for the point being analyzed is child's play. What might be a little more demanding for the CPU would be calculating the distances between that point and each and every line (but it just involves a bunch of squares and square roots) and then finding the smallest value. Then again... I can't think of a more efficient way to do it.what about points for which the normal vector to the nearest boundary vector doesn't intersect the boundary segment at all? How do you deal with those?
EDIT: I also think that vector multiplication is far easier to perform, computationally speaking, than finding out the value of each angle at each vertex through trigonometric functions.
Last edited: