Skip to content

Instantly share code, notes, and snippets.

@andsve
Last active Aug 29, 2015
Embed
What would you like to do?
--[[
http://people.ee.ethz.ch/~pascmu/documents/procedural_modeling_of_cities__siggraph2001.pdf
]]
--[[
from: http://www.newton64.ca/blog/?p=747#7472
initialize priority queue Q with a single entry: r(0, r0, q0)
initialize segment list S to empty
until Q is empty
pop smallest r(ti, ri, qi) from Q (i.e., smallest ‘t’)
accepted = localConstraints(&r)
if (accepted) {
add segment(ri) to S
foreach r(tj, rj, qj) produced by globalGoals(ri, qi)
add r(ti + 1 + tj, rj, qj) to Q
}
]]
local R = function( ti, ri, qi ) return { t = ti, r = ri, q = qi } end
local Q = { R( 0, ??, ?? ) }
local S = {}
local r = Q:pop()
do
accepted = localConstraints( r )
if (accepted) then
S:add( r )
local potential_rs = globalGoals( r.r, r.q )
for _,v in pairs(potential_rs) do
Q:add( v )
end
end
-- pop new potential road with smallest 't'
r = Q:pop()
while (r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment