Skip to content

use opencv module to make voronoi diagram of isoheights - #2

Merged
patriciogonzalezvivo merged 11 commits into
masterfrom
kk_voronoi
Dec 15, 2015
Merged

patriciogonzalezvivo merged 11 commits into
masterfrom
kk_voronoi

Conversation

@kevinkreiser

Copy link
Copy Markdown
Member

so to properly display buildings without messing up their rooftops its nice to have an isoheight underneath them. @patriciogonzalezvivo added this by computing the brute force voronoi diagram where the cites were the building vertices, if i understand correctly. he mentioned though that the algorithm was very slow for complex scenes.

so here we let opencv do the heavy work. it has methods which likely use a variant of fortunes algorithm to compute the voronoi diagram (and its dual the delaunay triangulation) in O(nlogn) time. this is way faster than brute force.

another nice thing it does is allow us to rasterize the voronoi cells into a png fairly quickly. we do this by exploiting the fact that voronoi cells are always convex.

Comment thread data/terrarium.py Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i add back in +12000?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so... to prevent negative values. right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well i'm not sure about how this is used for rendering but negative values should be fine in theory. at any rate its entirely up to you! the only draw back that I can see is that for the purposes of using the data you'd need to bake that +12000 into any simulations you run. so if you wanted to simulate a meter of sea level rise youd need to draw water at z=12001 instead of at z=1 right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PNGs store negative numbers?

patriciogonzalezvivo added a commit that referenced this pull request Dec 15, 2015
use opencv module to make voronoi diagram of isoheights
@patriciogonzalezvivo
patriciogonzalezvivo merged commit 5eadf47 into master Dec 15, 2015
@patriciogonzalezvivo
patriciogonzalezvivo deleted the kk_voronoi branch December 15, 2015 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants