For paths and polygons you should just implement the 2d Path API
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRende...
context.moveTo(x,y);
context.lineTo(x,y);
context.closePath();