/** * aran_solver3d_get_bounds: * @solver: an #AranSolver3d. * @lbound: bbox lower bound. * @ubound: bbox upper bound. * * Gets the bounding box for the associated #VsgPRTree3d. */ void aran_solver3d_get_bounds (AranSolver3d *solver, VsgVector3d *lbound, VsgVector3d *ubound) { g_return_if_fail (solver != NULL); vsg_prtree3d_get_bounds (solver->prtree, lbound, ubound); }
static void random_fill (VsgPRTree3d *tree, guint np) { gint i; VsgVector3d *pt; Sphere *c; VsgVector3d lb, ub; GRand *rand = g_rand_new_with_seed (_random_seed); vsg_prtree3d_get_bounds (tree, &lb, &ub); for (i=0; i< np; i++) { gdouble x1, x2, y1, y2, z1, z2, r; x1 = g_rand_double_range (rand, lb.x, ub.x); y1 = g_rand_double_range (rand, lb.y, ub.y); z1 = g_rand_double_range (rand, lb.z, ub.z); x2 = g_rand_double_range (rand, lb.x, ub.x); y2 = g_rand_double_range (rand, lb.y, ub.y); z2 = g_rand_double_range (rand, lb.z, ub.z); r = g_rand_double_range (rand, 0., 0.1); if (i%_flush_interval == 0) vsg_prtree3d_migrate_flush (tree); if (i%sz != rk) continue; if (i % 10000 == 0 && _verbose) g_printerr ("%d: insert %dth point\n", rk, i); pt = pt_alloc (TRUE, NULL); pt->x = x1; pt->y = y1; pt->z = z1; vsg_prtree3d_insert_point (tree, pt); if (_put_regions) { c = rg_alloc (TRUE, NULL); c->center.x = x2; c->center.y = y2; c->center.z = z2; c->radius = r; vsg_prtree3d_insert_region (tree, c); } /* g_printerr ("%d: %d\n", rk, i); */ } vsg_prtree3d_migrate_flush (tree); g_rand_free (rand); }
static void _exterior_points (VsgPRTree3d *tree) { VsgVector3d lb, ub; VsgVector3d *pt; if (_verbose) g_printerr ("%d: exterior points\n", rk); vsg_prtree3d_get_bounds (tree, &lb, &ub); pt = pt_alloc (TRUE, NULL); pt->x = ub.x+rk+1.; pt->y = ub.y+rk+1.; pt->z = ub.z+rk+1.; vsg_prtree3d_insert_point (tree, pt); vsg_prtree3d_migrate_flush (tree); if (_verbose) g_printerr ("%d: exterior points ok\n", rk); }