(I'm not 100% sure if the title is the best description, I'll edit if necessary)
I'm trying to create a voronoi region to do a split-screen effect in a game. I'm following the steps outlined in this PDF. As I understand them:
- Find a line running along the midway point between players
- Find the vertices of the intersections of each player's respective lines, bounded by the area in question
- Create a region for each player using the convex hull of those vertices.
I found the algorithms for step 3, where I'm stuck is how to find the vertices of each region. Using this image as an example:
Looking at player C, I worked out that I need to find the intersection point of the A/C line, the B/C line and the D/C line. Easy enough. Where I'm stuck is that if a line hits an edge, then I have to find vertices for where it hits an edge, plus any corners in the region (like the bottom left in this image). But I can't just throw the sides of the region in as lines, because with more than 4 players, a region isn't guaranteed to touch the edge of the screen, so those points would need to be discarded and I'm not sure how to factor that into the process.
If it makes any difference, I'm doing this in C# / Unity.