static void build_area_table(BSPHERE_TREE **Elements, int a, int b, DBL *areas) { int i, imin, dir; DBL r2; VECTOR C; if (a < b) { imin = a; dir = 1; } else { imin = b; dir = -1; } Assign_Vector(C, Elements[a]->C); r2 = Elements[a]->r2; for (i = a; i != (b + dir); i += dir) { merge_spheres(C, &r2, C, r2, Elements[i]->C, Elements[i]->r2); areas[i-imin] = r2; } }
void mininode_group::update_dirty() { miniv3d center; double radius; unsigned int s=get_links(); // clear bounding sphere bound_center=miniv3d(0,0,0); bound_radius=0.0; // get bounding sphere get_bsphere(center,radius); // merge bounding sphere with children for (unsigned int i=0; i<s; i++) { mininode *link=get_link(i); // get child group mininode_group *child_group=dynamic_cast<mininode_group *>(link); if (child_group) { miniv3d child_center; double child_radius; child_group->get_bsphere(child_center,child_radius); // merge with child bounding sphere if (child_radius>0.0) if (radius>0.0) merge_spheres(center,radius, child_center,child_radius); else { center=child_center; radius=child_radius; } } } bound_center=center; bound_radius=radius; }
static void recompute_bound(BSPHERE_TREE *Node) { short i; DBL r2; VECTOR C; Assign_Vector(C, Node->Node[0]->C); r2 = Node->Node[0]->r2; for (i = 1; i < Node->Entries; i++) { merge_spheres(C, &r2, C, r2, Node->Node[i]->C, Node->Node[i]->r2); } Assign_Vector(Node->C, C); Node->r2 = r2; }
static void recompute_bound(BSPHERE_TREE *Node) { short i; DBL r2; Vector3d C; C = Node->Node[0]->C; r2 = Node->Node[0]->r2; for (i = 1; i < Node->Entries; i++) { merge_spheres(C, &r2, C, r2, Node->Node[i]->C, Node->Node[i]->r2); } Node->C = C; Node->r2 = r2; }