Skip to content

Instantly share code, notes, and snippets.

@gonuke
Last active August 29, 2015 14:07
Show Gist options
  • Save gonuke/4129e32ffb9a9e9f9530 to your computer and use it in GitHub Desktop.
Save gonuke/4129e32ffb9a9e9f9530 to your computer and use it in GitHub Desktop.
Range siblings;
Range::iterator cn;
EntityHandle parent;
siblings.clear()
siblings.insert(head);
cn = siblings.begin();
insertion = false;
while (insertion == false && cn != siblings.end()) {
if (point_in_volume(surf->vtx,*cn) == 1) {
siblings = *cn.children();
if (siblings.length() == 0) {
(*cn).insert(surf->vol);
insertion = true;
} else {
parent = *cn;
cn = siblings.begin();
}
} else {
if (point_in_volume(cn->surf->vtx, surf->vol) == 1) {
swap(cn,surf);
cn++;
if ( cn == siblings.end() ) {
parent.insert(surf);
insertion = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment