Greetings! I’m trying to figure out what would be optimized way to create biomes for procedural terrain generation, ending up using voronoi diagrams.

I’ve used this library for voronoi diagrams.

Issue is that library itself doesn’t provide good way of checking if set terrain coordinate is within polygon (Unless I’ve missed it, whole thing is pretty confusing to me).

So I have to run expensive check through every triangle of each polygon to see if it’s within it. On top of that, I’m not sure how to exactly get smooth transition between values without running additional checks through neighboring polygons to see close to the their edges my point is. Whole process slows generation tremendously, even if I was to run it on GPU.

```
public static bool PointInTriangle(Vector2 p, Vector2 p0, Vector2 p1, Vector2 p2)
{
var s = (p0.x - p2.x) * (p.y - p2.y) - (p0.y - p2.y) * (p.x - p2.x);
var t = (p1.x - p0.x) * (p.y - p0.y) - (p1.y - p0.y) * (p.x - p0.x);
if ((s < 0) != (t < 0) && s != 0 && t != 0)
return false;
var d = (p2.x - p1.x) * (p.y - p1.y) - (p2.y - p1.y) * (p.x - p1.x);
return d == 0 || (d < 0) == (s + t <= 0);
}
```

Could there be a better way to go about biomes?