本文整理汇总了C++中eigen::VectorXi::setLinSpaced方法的典型用法代码示例。如果您正苦于以下问题:C++ VectorXi::setLinSpaced方法的具体用法?C++ VectorXi::setLinSpaced怎么用?C++ VectorXi::setLinSpaced使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::VectorXi
的用法示例。
在下文中一共展示了VectorXi::setLinSpaced方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cell_faces
//.........这里部分代码省略.........
if (cell_labels[std::get<0>(neighbor)] == 0) {
cell_labels[std::get<0>(neighbor)] = curr_label * -1;
Q.push(std::get<0>(neighbor));
parents[std::get<0>(neighbor)] = curr_idx;
} else {
if (cell_labels[std::get<0>(neighbor)] !=
curr_label * -1) {
std::cerr << "Odd cell cycle detected!" << std::endl;
auto path = trace_parents(curr_idx);
path.reverse();
auto path2 = trace_parents(std::get<0>(neighbor));
path.insert(path.end(),
path2.begin(), path2.end());
for (auto cell_id : path) {
std::cout << cell_id << " ";
std::stringstream filename;
filename << "cell_" << cell_id << ".ply";
save_cell(filename.str(), cell_id);
}
std::cout << std::endl;
}
assert(cell_labels[std::get<0>(neighbor)] == curr_label * -1);
}
}
}
}
}
}
#endif
size_t outer_facet;
bool flipped;
Eigen::VectorXi I;
I.setLinSpaced(num_faces, 0, num_faces-1);
igl::copyleft::cgal::outer_facet(V, F, I, outer_facet, flipped);
const size_t outer_patch = P[outer_facet];
const size_t infinity_cell = per_patch_cells(outer_patch, flipped?1:0);
Eigen::VectorXi patch_labels(num_patches);
const int INVALID = std::numeric_limits<int>::max();
patch_labels.setConstant(INVALID);
for (size_t i=0; i<num_faces; i++) {
if (patch_labels[P[i]] == INVALID) {
patch_labels[P[i]] = labels[i];
} else {
assert(patch_labels[P[i]] == labels[i]);
}
}
assert((patch_labels.array() != INVALID).all());
const size_t num_labels = patch_labels.maxCoeff()+1;
Eigen::MatrixXi per_cell_W(num_cells, num_labels);
per_cell_W.setConstant(INVALID);
per_cell_W.row(infinity_cell).setZero();
std::queue<size_t> Q;
Q.push(infinity_cell);
while (!Q.empty()) {
size_t curr_cell = Q.front();
Q.pop();
for (const auto& neighbor : cell_adjacency[curr_cell]) {
size_t neighbor_cell, patch_idx;
bool direction;
std::tie(neighbor_cell, direction, patch_idx) = neighbor;
if ((per_cell_W.row(neighbor_cell).array() == INVALID).any()) {
per_cell_W.row(neighbor_cell) = per_cell_W.row(curr_cell);
示例2: cell_faces
//.........这里部分代码省略.........
std::cerr << "Odd cell cycle detected!" << std::endl;
auto path = trace_parents(curr_idx);
path.reverse();
auto path2 = trace_parents(std::get<0>(neighbor));
path.insert(path.end(),
path2.begin(), path2.end());
for (auto cell_id : path) {
std::cout << cell_id << " ";
std::stringstream filename;
filename << "cell_" << cell_id << ".ply";
save_cell(filename.str(), cell_id);
}
std::cout << std::endl;
}
// Do not fail when odd cycle is detected because the resulting
// integer winding number field, although inconsistent, may still
// be used if the problem region is local and embedded within a
// valid volume.
//assert(cell_labels[std::get<0>(neighbor)] == curr_label * -1);
}
}
}
}
}
#ifdef PROPAGATE_WINDING_NUMBER_TIMING
std::cout << "check for odd cycle: " << tictoc() << std::endl;
#endif
}
#endif
size_t outer_facet;
bool flipped;
Eigen::VectorXi I;
I.setLinSpaced(num_faces, 0, num_faces-1);
igl::copyleft::cgal::outer_facet(V, F, I, outer_facet, flipped);
#ifdef PROPAGATE_WINDING_NUMBER_TIMING
std::cout << "outer facet: " << tictoc() << std::endl;
#endif
const size_t outer_patch = P[outer_facet];
const size_t infinity_cell = per_patch_cells(outer_patch, flipped?1:0);
Eigen::VectorXi patch_labels(num_patches);
const int INVALID = std::numeric_limits<int>::max();
patch_labels.setConstant(INVALID);
for (size_t i=0; i<num_faces; i++) {
if (patch_labels[P[i]] == INVALID) {
patch_labels[P[i]] = labels[i];
} else {
assert(patch_labels[P[i]] == labels[i]);
}
}
assert((patch_labels.array() != INVALID).all());
const size_t num_labels = patch_labels.maxCoeff()+1;
Eigen::MatrixXi per_cell_W(num_cells, num_labels);
per_cell_W.setConstant(INVALID);
per_cell_W.row(infinity_cell).setZero();
std::queue<size_t> Q;
Q.push(infinity_cell);
while (!Q.empty()) {
size_t curr_cell = Q.front();
Q.pop();
for (const auto& neighbor : cell_adjacency[curr_cell]) {
size_t neighbor_cell, patch_idx;
bool direction;