In the end it took significantly more time to write about it then to actually do it, but the dot product approach seems to work.