本文整理汇总了C++中eigen::Vector4d::cwiseMin方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector4d::cwiseMin方法的具体用法?C++ Vector4d::cwiseMin怎么用?C++ Vector4d::cwiseMin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::Vector4d
的用法示例。
在下文中一共展示了Vector4d::cwiseMin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sampler
std::unique_ptr<unsigned char[]> getRaster() {
const unsigned int row_bytes = scene.cam.viewportWidth * 3;
const unsigned int buf_len = scene.cam.viewportHeight * row_bytes;
auto buf = std::unique_ptr<unsigned char[]>(new unsigned char[buf_len]);
const double multFactor = 1 / (1.0 * NUM_AA_SUBPIXELS);
const Eigen::Vector4d maxrgb(255, 255, 255, 0);
tbb::parallel_for(
tbb::blocked_range2d<int, int>(0, scene.cam.viewportHeight, 0,
scene.cam.viewportWidth),
[&](tbb::blocked_range2d<int, int> &r) {
// Support for AA sampler
std::vector<Ray, Eigen::aligned_allocator<Ray>> rays(
NUM_AA_SUBPIXELS, Ray(Eigen::Vector4d(0, 0, 0, 1),
Eigen::Vector4d(1, 0, 0, 0), ID_AIR));
RandomAASampler sampler(scene.cam);
for (int row = r.rows().begin(); row != r.rows().end(); ++row) {
for (int col = r.cols().begin(); col != r.cols().end(); ++col) {
Camera cam(scene.cam);
Eigen::Vector4d color = Eigen::Vector4d::Zero();
// materials stack for refraction
std::array<int, MAX_DEPTH + 1> objStack;
if (!aa) {
Ray ray = cam.constructRayThroughPixel(col, row);
objStack.fill(ID_AIR);
color = getColor(ray, 0, 0, objStack);
} else {
sampler.constructRaysThroughPixel(col, row, rays);
for (int i = 0; i < NUM_AA_SUBPIXELS; ++i) {
objStack.fill(ID_AIR);
color += getColor(rays[i], 0, 0, objStack);
}
color *= multFactor;
}
color = 255 * color;
color = color.cwiseMin(maxrgb);
buf[row * row_bytes + (col * 3)] = color[0];
buf[row * row_bytes + (col * 3) + 1] = color[1];
buf[row * row_bytes + (col * 3) + 2] = color[2];
}
}
});
return buf;
}