Those 2 white points represent the bounding box. The representation of my voronoi diagram is just a list of polygons that are sorted either clockwise or counterclockwise around the site. I’ve come up with a few ideas on how to clip those polygons to the box, but they all have failed for one reason or another. The most frequent reason they fail is because I need to have the corner of the box in the polygon if they intersect 2 different edges. I’ve come up with a few ideas I’m sure will work (generalized convex/convex clipping algorithm that compares all edges to all edges), but it just feels like a bit much for what feels like a simple problem. I was wondering if anyone has any ideas for clipping the polygon to the bounding box that I’m just overlooking.

Can you place your polygon corners at the edges of the bounding box first, then calculate inwards from those points? That way they wouldn’t have to be aligned with the corners.
If you pick a random # of points per side as well as random positions of the points on each side that should give you a rectangle with the diagram inside.

One solution would be to treat the bounding box as a combination of four lines and look at it from a top-down two-dimensional perspective (basically from the camera’s point of view). For every line in the Voronoi diagram, you can check if it has an intersection with a line from the bounding box (ax + b = bx + c). If they intersect, you know where that point is and you can stop the diagram line from there.