List<PathCommand> commands = new ArrayList<PathCommand>();
commands.add(new MoveTo(x1, y1));
commands.add(new LineTo(x2, y2));
// Solves mysterious clipping bug with IE
if (Math.abs(x1 - x3) <= 0.01 && Math.abs(y1 - y3) <= 0.01) {
commands.add(new EllipticalArc(endRho, endRho, 0, flag, 1, x4, y4));
commands.add(new ClosePath());
} else {
commands.add(new EllipticalArc(endRho, endRho, 0, flag, 1, x4, y4));
commands.add(new LineTo(x3, y3));
commands.add(new EllipticalArc(startRho, startRho, 0, flag, 0, x1, y1));
commands.add(new ClosePath());
}
return commands;
}