Search code examples
algorithmdictionarypolygonpoints

algorithms or generators or examples road lanes/ and networks


I want to generate roads for race-car game, for example

(x = 0, y = 0), (x = 0, y = 5), (x = 0, y = 10) ... (x = 0, y = 100) its vertical lane.

(x = 0, y = 0), (x = 5, y = 0), (x = 10, y = 0) its horizontal lane.

I need examples of big lane (500 points for example) with turns and bands. It's very hard manually generate every band and smooth turn of the road. If any generator/examples/algorithm to do it simpler? I want to have a set of points forming a line of the road (the points are sequentially connected, one after another)


Solution

  • Your points definition can stay relatively short. If it's only a question of smooth rendering then you may use something like bezier surface to render smoothly curved surfaces from points definition.

    There are also variations to curved surfaces, e.g. NURBS. Check out this opengl tutorial to render NURBS surface (of course it depends on what you use; which framework etc. if it's only about pure algorithm then bezier curves are still valid though).