本文整理汇总了C++中aabb::split_aabb方法的典型用法代码示例。如果您正苦于以下问题:C++ aabb::split_aabb方法的具体用法?C++ aabb::split_aabb怎么用?C++ aabb::split_aabb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aabb
的用法示例。
在下文中一共展示了aabb::split_aabb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_sah_cost
/* get cost of sah(surface area heuristic) method for certain plane */
double get_sah_cost(double plane, aabb &voxel, int num_left, int num_right)
{
aabb voxel_left, voxel_right;
voxel.split_aabb(dim, plane, voxel_left, voxel_right);
double sa_left = voxel_left.get_surface_area();
double sa_right = voxel_right.get_surface_area();
double sa_union = voxel.get_surface_area();
return get_cost(sa_left / sa_union, sa_right / sa_union, num_left, num_right);
}
示例2: kdtree
/* build kd-tree */
kdtree::kdtree(aabb &voxel, vector<primitive*> &pris, int depth, kdtree* parent)
{
parent_kdtree = parent;
left_kdtree = right_kdtree = NULL;
bbox = voxel;
/* end criteria; make this leaf */
if (depth > maximum_depth || pris.size() < 1)
{
primitives = pris;
}
/* general case: determine whether and how to devide current voxel */
else
{
double cost_asleaf = cost_i * pris.size();
cost_min = 1E100;
for (dim = 0; dim < 3; dim++)
{
get_best_plane(pris, voxel);
}
/* internal node; divide further */
if (cost_min < cost_asleaf)
{
vector<primitive*> left_pris, right_pris;
classify_primitives(pris, best_plane, left_pris, right_pris);
aabb left_voxel, right_voxel;
voxel.split_aabb(best_dim, best_plane, left_voxel, right_voxel);
left_kdtree = new kdtree(left_voxel, left_pris, depth + 1, this);
right_kdtree = new kdtree(right_voxel, right_pris, depth + 1, this);
}
/* leaf; division end */
else
{
primitives = pris;
}
}
}