Is there an exploitable relationship between the angles of AB and AC in a triangle when moving point A?

99 Views Asked by At

I'm writing software to dynamically create a random, generated world (civ-esque), populate it with settlements, and draw roads between them. It would be relatively easy to draw roads like this:

However, what I really want is a more "efficient" way of building roads. Something like this:

I appreciate that there must be a relationship between the length of line a and the angles at point x, but I just don't see it. Can anybody help?

Edit: I'm thinking we fix angle BxC at an arbitrary value, perhaps even chosen randomly between a range of values at computation-time to give each intersection some variety.

1

There are 1 best solutions below

0
On BEST ANSWER

I'm guessing you care more about giving some variety to road layout than absolute shortest distance (in which case use Arthur's answer), so how about this:

Connect BC, then connect A to midpoint(BC). Let the length of line $a = A/2 \pm 20\%$, this will give you point x. Then randomly vary the angle of a $\pm 20$ degrees or so, and create lines xC and xB.

This might prove simpler than your idea of fixing BxC, depending on how you are coding things up.