Convex Hull algorithm. Working on making a Convex Hull algorithm. I need to figure out how to iterate the remaining points to find the shortest angle as marked below in the picture. I am not very good with trigonometry - though I have been trying to learn online, just not finding an example of this angle because I don't understand how to get the sides based on a coordinate points reference system. I can find the bottom most point and start working counter-clock-wise from there. I will be doing this in a programming language (.Net) so I am looking for the math for the angles. 

Research for Convex Hull

Thanks for some guidance.

 A: You can do this by taking the previous line segment as a vector, and comparing it against a vector from the end point to the other remaining points.
I have a program that does this, the output is similar to:

The code finds the point with the smallest y coordinate (in red). This is definitely in the convex hull, as are the left-most, right-most and base-y points. We go counter-clockwise, and to begin with we create an initial vector from the red point going east. Then we test each vector from the red point to every other point, and find the angle between the two vectors. The smallest angle gives the new line segment we want.
Then we use this new line segment as the 'control vector', and test for the angle between this vector and all the others (ignoring the red point).
My code is here:

Khan Academy

but be warned, it's not fully functional yet! It works most of the time, it could potentially fail if the convex hull has too many points in it, and it stops halfway round, and starts again, because the 'heading()' function seems to get confused!
