function getColor(x, y, vertices, colors) {
const t = cartesian2barycentric(x, y, vertices);
if (!showOutside && t.some(t => t < 0)) return [255, 255, 255];
return [
Math.floor(colors[0].r * t[0] + colors[1].r * t[1] + colors[2].r * t[2]),
Math.floor(colors[0].g * t[0] + colors[1].g * t[1] + colors[2].g * t[2]),
Math.floor(colors[0].b * t[0] + colors[1].b * t[1] + colors[2].b * t[2]),
];
}