zznewclear13 / City_Generator

This is a python program for generating random cities and is still under development.
MIT License
1 stars 0 forks source link

Help needed for understanding #1

Open febrilebrain opened 2 years ago

febrilebrain commented 2 years ago

Hello,

First of all, I'd like to request your permission to use and modify your code. It's quite useful for my master's thesis. Secondly, could you explain why you are making the distinction in the assignment of directions in getOriginalDirection (lines 28-38) in direction.py? What is the purpose of connectionInt?

Thank you very much

zznewclear13 commented 2 years ago

Hi,

This repository is under MIT License, which means you can do almost everyting with those code as long as you mentioned me or this repository. And it's my pleasure to offer you any help.

I wrote this several years ago, and some of it's implementation are not well designed (can even have some bugs). I use randomDecision to pick next path for a vertex: follow it's original direction, perpendicular to it's original direction, or both. For example, in [[np.array(mainDirection),1], [-np.array(mainDirection),-1]], np.array(mainDirection) merely stores it's new direction, I need a connectionInt to help me identify whether it is following it's original direction or perpendicular direction, in this case '1' for original direction ('-2' for reverse perpendicular direction).

As for procedural city generation, I recommend you reading josauder's procedural_city_generation. He wrote a documentation which I think might be a good reference for city generation.

Good luck!

febrilebrain commented 2 years ago

Thanks a lot. I have a few more questions.

zznewclear13 commented 2 years ago
  1. Those are user selected images (which means I drew them in Photoshop).
  2. Please see this blog, I adopted the way he generates random points. In those input images, I use darker color to represent higher density of roads, and generate more random points in darker area.
  3. Sorry I can't quite remeber bugs, otherwise I would have fixed them. 😅
febrilebrain commented 2 years ago

Thanks again. There's also another thing, in case you remember: When I plot verticesNext using plotlines in the loop vs plotting verticesAll outside, there is some disparity in the connections. I can't quite figure out why that is. Shouldn't verticesAll contain all the connections? output_1 output_2

zznewclear13 commented 2 years ago

Sorry, I really cannot remeber the details. Maybe those verticesNext were not merged to verticesAll?