Skip to content

Instantly share code, notes, and snippets.

@bdonlan
Created October 28, 2008 04:33
Show Gist options
  • Save bdonlan/20298 to your computer and use it in GitHub Desktop.
Save bdonlan/20298 to your computer and use it in GitHub Desktop.
StaticQuadTree_Impl::StaticQuadTree_Impl(
const std::vector<std::pair<Region, void *> > &regions
)
{
typedef std::pair<Region, void *> VP;
Region worldRegion;
if (regions.size())
worldRegion = regions[0].first;
std::for_each(regions.begin(), regions.end(),
( var(worldRegion) =
bind(Region::minContainsBoth, var(worldRegion), bind(&VP::first, _1))
));
root = divisions.construct(worldRegion);
std::for_each(regions.begin(), regions.end(),
bind(&StaticQuadTree_Impl::placeRegion,
this,
root,
bind(&VP::first, _1),
bind(&VP::second, _1),
true
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment