Last active
August 29, 2015 13:57
-
-
Save andsve/9544437 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
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