Oops.
This is another problem, buildings generally have the same number of floors on each side. Easy enough to just trim off the extra floors on any wall that got too tall, but what about uneven floor heights?
There are a number of easy, direct solutions. I could just clamp everything to the average floor height, that wouldn't be too bad. Simulated annealing might have a better option though. For each level (equivalent floors on all sides) match the heights of the floors on one of the floors already there. Its about the same as picking one side and matching all the others to it, but with more possible combinations. The point of simulated annealing is to optimize something, so lets minimize cost. Most elements are designed to look a certain way, stitching or squashing them make them look wrong. So measuring deformation per-element is a good place to start for cost.
On loading each element I can store its aspect ratio and measure the normalized change from that ration after the element has been altered. It might make sense at this point to exclude the fill element used to take up whatever slack is left at the ends of each floor so that corners match. These elements are supposed to be so simple that some scaling is not noticeable. Regardless, the sum of the normalized distortion of all the elements gives a cost for the building. With a little more experimenting and some hard coded exclusions of situations I know cause problems I got some good looking buildings out of each run.
No comments:
Post a Comment