In my previous post on line segment intersection I introduced the two dimensional cross product as The cross product can also be used to determine if a set of three points make a right turn.

First note that if then the angle between and is strictly less than For example the two vectors Similarly if then the angle between them is strictly greater than In the below image I've shown an example where the three points make a right turn.

To mathematically determine if the points make a right turn we let Then taking the cross product of we have which implies that the angle between them is less than that is they make a right turn.

This method for determining whether the points make a right or left turn is very useful for determining the convex hull of a set of points.

I’ve posted an example webpage, here, where using javascript the lines change color depending on whether the turn is to the right or the left. Please note that the page uses the html5 canvas element so it will not work in internet explorer 7, or 6.