本文整理汇总了C++中BBox::max方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::max方法的具体用法?C++ BBox::max怎么用?C++ BBox::max使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::max方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compute_edge_rays_tex
void TextureBrick::compute_edge_rays_tex(BBox &bbox)
{
// set up vertices
Point corner[8];
corner[0] = bbox.min();
corner[1] = Point(bbox.min().x(), bbox.min().y(), bbox.max().z());
corner[2] = Point(bbox.min().x(), bbox.max().y(), bbox.min().z());
corner[3] = Point(bbox.min().x(), bbox.max().y(), bbox.max().z());
corner[4] = Point(bbox.max().x(), bbox.min().y(), bbox.min().z());
corner[5] = Point(bbox.max().x(), bbox.min().y(), bbox.max().z());
corner[6] = Point(bbox.max().x(), bbox.max().y(), bbox.min().z());
corner[7] = bbox.max();
// set up edges
tex_edge_[0] = Ray(corner[0], corner[2] - corner[0]);
tex_edge_[1] = Ray(corner[2], corner[6] - corner[2]);
tex_edge_[2] = Ray(corner[4], corner[6] - corner[4]);
tex_edge_[3] = Ray(corner[0], corner[4] - corner[0]);
tex_edge_[4] = Ray(corner[1], corner[3] - corner[1]);
tex_edge_[5] = Ray(corner[3], corner[7] - corner[3]);
tex_edge_[6] = Ray(corner[5], corner[7] - corner[5]);
tex_edge_[7] = Ray(corner[1], corner[5] - corner[1]);
tex_edge_[8] = Ray(corner[0], corner[1] - corner[0]);
tex_edge_[9] = Ray(corner[2], corner[3] - corner[2]);
tex_edge_[10] = Ray(corner[6], corner[7] - corner[6]);
tex_edge_[11] = Ray(corner[4], corner[5] - corner[4]);
}
示例2: calcTick
static std::size_t calcTick(
const Point& point,
const BBox& bbox,
const std::size_t depth)
{
return
std::floor(
(point.z - bbox.min().z) * (1ULL << depth) /
(bbox.max().z - bbox.min().z));
}
示例3: buildBranch
Shape* BVH::buildBranch(Shape** shapes, int shape_size, int axis) {
if (shape_size == 1) {return shapes[0];}
else if (shape_size == 2) {return new BVH(shapes[0], shapes[1]);}
//find midpoint of bbox to use as qsplit pivot
BBox box = shapes[0] -> boundingBox(0.0f, 0.0f);
for (int i = 1; i < shape_size; i++) {
box = surround(box, shapes[i] -> boundingBox(0.0f, 0.0f));
}
Vector3 pivot = (box.max() + box.min()) / 2.0f;
//split according to correct axis
int midpt = QSplit::qsplit(shapes, shape_size, pivot[axis], axis);
//create new bounding volume
Shape* left = buildBranch(shapes, midpt, (axis + 1) % 3);
Shape* right = buildBranch(&shapes[midpt], shape_size - midpt, (axis + 1) %3);
return new BVH(left, right, box);
}
示例4:
inline bool operator==(const BBox& lhs, const BBox& rhs)
{
return lhs.min() == rhs.min() && lhs.max() == rhs.max();
}