yes it's similar. Mine looks more complicated since i don't invest in translating the polygon at the beginning and try to avoid multiplication and division - if possible.

besides: your algorithms doesn't handle horizontal edges correctly as you can check on this polygon:

	function generate_polygon3() {
		return	[	{ x:-8, y:-4 },	{ x:-6, y:-3 },   { x:-5, y:-3 },   { x:-4, y:-2 },
					{ x:-3, y:-4 },	{ x:-1, y:-2 },   { x: 0, y:-3 },   { x: 2, y:-3 },
					{ x: 3, y:-2 },	{ x: 3, y:-3 },   { x: 4, y:-4 },   { x: 5, y:-3 },
					{ x: 6, y:-4 },	{ x: 7, y:-3 },   { x: 9, y:-3 },   { x:10, y:-4 },
					{ x:12, y:-2 },	{ x: 0, y: 4 },   { x:-4, y: 4 }	];
	}