Well the sum of the angles doesn’t necessarily have to equal exactly 360 degrees, as long as its 270-360 it’s fine.
I was actually thinking of a way this could be improved to create the entire road map too. Not sure how it will actually turn out though but with some set params i think it might be ok.
So lets say we start out with a square. We generate a spline for that with 90 degree angles. We then store those 4 points in an array with each of the 4 points having an “unoccupied flag”.
We then do a loop to go from each point and use the 360 rotation method.(the loop is valid on all with false on the “unoccupied flag”)
Starting from the first point we can get the direction vector of the incoming and outgoing and know that we have 270 degrees to work with. So we do our random distance outwards and the random angle between 30-90 and stop when it gets >=270.(Or a random maximum so that we get more right angles potentially,depending what kind of roads you want)
Rather than generating the full spline again this time though we actually go and find the closest spline point to the first new spline point. That becomes our starting point for the 2nd road segment. Then we trace along the rest of the spline points in order until we get to the last 1. Then it’s the same deal with the last. Rather than join it back to it’s first point, we go and find the closest spline point again (ignoring it’s own spline) and make that the end point for it. We don’t bother to create a closed spline because it will get the illusion that its a closed spline by joining up with the first 1. Now whichever spline points we have used as the first and last on this become marked as "occupied"and we then jump to the next unoccupied 1 and do the new spline again.
For the joining on the first and last 1s we probably want to clamp the angle again and only look for closest within that angle etc. And then make sure it’s not occupied, but this could probably be enhanced to handle maximum number of connections maybe.
I might have a crack at this later today if I get a chance but I wont be back on it until Monday most likely