I need to rotate and translate an irregular polygon so that a chosen edge is on the x-axis and the "inside" of the polygon is above the x-axis.
I know how to translate and rotate a polygon using a transformation matrix on each vertex. What I don't know is how to make sure the polygon after rotation is "sitting on" the x-axis and not "hanging from" the x-axis.
I.e. the chosen edge has one side that is outside of the polygon and one side that is inside of the polygon. I need the side that is inside of the polygon to be above the x-axis and the side that is outside of the polygon to be below the x-axis.
The polygon will never be self-intersecting.
I hope that is clear.