Using angular and HTML5 canvas to calculate sides and angles