{
const context = DOM.context2d(width, 500);
context.beginPath();
d3.Delaunay.from(points).render(context);
context.stroke();
context.save();
context.beginPath();
context.setLineDash([3, 3]);
context.strokeStyle = "brown";
context.lineWidth = 1.5;
context.moveTo(...points[0]);
context.lineTo(...points[2]);
context.stroke();
context.restore();
context.fillText("Delaunay triangulation", 20, 20);
context.translate(width / 2, 0);
context.beginPath();
constrained.render(context);
context.stroke();
context.save();
context.beginPath();
context.strokeStyle = "brown";
context.lineWidth = 1.5;
for (const [a, b] of constrains) {
context.moveTo(...points[a]);
context.lineTo(...points[b]);
}
context.stroke();
context.fillText("Constrained triangulation", 20, 20);
return context.canvas;
}