本文整理汇总了C++中CBvert_list::size方法的典型用法代码示例。如果您正苦于以下问题:C++ CBvert_list::size方法的具体用法?C++ CBvert_list::size怎么用?C++ CBvert_list::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBvert_list
的用法示例。
在下文中一共展示了CBvert_list::size方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: chain_path
bool
OVERSKETCH::match_substrip(CPIXEL_list& pts, CBvert_list& chain, EdgeStrip& strip)
{
err_adv(debug, "OVERSKETCH::match_substrip:");
if (!chain.forms_chain()) {
err_adv(debug, " non-chain");
return false;
}
const double MAX_DIST = 8;
PIXEL_list chain_path(chain.wpts());
int k0 = get_near_index(chain_path, pts.front(), MAX_DIST);
int k1 = get_near_index(chain_path, pts.back(), MAX_DIST);
if (!(0 <= k0 && k0 < (int)chain.size() && 0 <= k1 && k1 < (int)chain.size())) {
err_adv(debug, " bad k0/k1: %d/%d", k0, k1);
return false;
} if (k0 == k1) {
err_adv(debug, " bad k0/k1: %d == %d", k0, k1);
return false;
}
make_strip(chain, k0, k1, strip);
return true;
}
示例2: lines
inline void
show_yardstick(CBvert_list& verts, double yardstick)
{
vector<Wline> lines(verts.size());
for (Bvert_list::size_type i=0; i<verts.size(); i++)
lines[i] = Wline(verts[i]->loc(), verts[i]->norm()*yardstick);
GL_VIEW::draw_lines(lines, Color::yellow, 0.8, 1, false);
}
示例3: ret
inline Bvert_list
copy_verts(CBvert_list& verts, LMESHptr mesh)
{
Bvert_list ret(verts.size());
for (Bvert_list::size_type i=0; i<verts.size(); i++) {
ret.push_back(mesh->add_vertex(verts[i]->loc()));
}
return ret;
}
示例4: interp
inline void
show_verts(CBvert_list& verts, int size, CCOLOR& c0, CCOLOR& c1)
{
if (verts.empty())
return;
if (verts.size() == 1)
show_vert(verts[0], size, c0);
// ramp the colors
double di = 1.0/(verts.size()-1);
for (Bvert_list::size_type i=0; i<verts.size(); i++)
show_vert(verts[i], size, interp(c0, c1, i*di));
}
示例5:
inline void
update_verts(CBvert_list& verts)
{
// helper for LMESH::update_subdivision(CBface_list& faces)
for (Bvert_list::size_type i=0; i<verts.size(); i++)
((Lvert*)verts[i])->update_subdivision();
}
示例6: pow
inline void
add_shading(CBvert_list& verts, Wvec l, CCOLOR& col, double s = 1.0)
{
// normalize the "light" vector:
l = l.normalized();
for (size_t i=0; i<verts.size(); i++) {
double a = pow(max(l * verts[i]->norm(), 0.0), s);
if (a > 0)
verts[i]->set_color(interp(verts[i]->color(), col, a), 1);
}
}
示例7: assert
inline void
define_offsets(
CBvert_list& verts,
CVertMapper& tmap,
CVertMapper& bmap,
CWvec& n,
Primitive* p
)
{
assert(tmap.is_valid() && bmap.is_valid());
for (Bvert_list::size_type i=0; i<verts.size(); i++) {
define_offset(verts[i], tmap, bmap, n, p);
}
}
示例8: assert
inline void
get_parents(CBvert_list& verts, Bvert_list& vp, Bedge_list& ep)
{
// Helper method used below in get_parents();
// from the given list of vertices, return the parent
// simplices in two lists: one of Lverts, one of Ledges.
if (verts.empty())
return;
assert(dynamic_pointer_cast<LMESH>(verts.mesh()));
for (Bvert_list::size_type i=0; i<verts.size(); i++)
add_p((Lvert*)verts[i], vp, ep);
}
示例9: assert
bool
OVERSKETCH::apply_offsets(CBvert_list& sil_verts, const vector<double>& sil_offsets)
{
// XXX - preliminary...
assert(sil_verts.size() == sil_offsets.size());
// Expand region around oversketched silhouette verts.
// XXX - Should compute the one-ring size, not use "3"
Bface_list region = sil_verts.one_ring_faces().n_ring_faces(3);
// Find the minimum distance to the silhouette verts from the
// outer boundary of the region
Wpt_list sil_path = sil_verts.pts();
double R = min_dist(region.get_boundary().verts().pts(), sil_path);
Bvert_list region_verts = region.get_verts();
Wpt_list new_locs = region_verts.pts();
vector<double> offsets;
for (Bvert_list::size_type i=0; i<region_verts.size(); i++) {
Wpt foo;
int k = -1;
double d = sil_path.closest(region_verts[i]->loc(), foo, k);
if (k < 0 || k >= (int)sil_offsets.size()) {
err_adv(debug, "OVERSKETCH::apply_offsets: error: can't find closest");
continue;
}
double s = swell_profile(d/R);
double h = sil_offsets[k] * s;
// err_adv(debug, " d: %f, d/R: %f, s: %f", d, d/R, s);
offsets.push_back(h);
new_locs[i] += region_verts[i]->norm()*h;
// WORLD::show(region_verts[i]->loc(), new_locs[i], 1);
}
// now apply new locs
// FIT_VERTS_CMDptr cmd = make_shared<FIT_VERTS_CMD>(region_verts, new_locs);
SUBDIV_OFFSET_CMDptr cmd = make_shared<SUBDIV_OFFSET_CMD>(region_verts, offsets);
cmd->doit();
WORLD::add_command(cmd);
return true;
}
示例10: assert
SubdivUpdater::SubdivUpdater(LMESHptr m, CBvert_list& verts) :
_parent(nullptr)
{
// Screened in SubdivUpdater::create():
assert(m && m == verts.mesh());
_mesh = m;
_verts = verts;
// Get bbases, add to inputs
_inputs = Bbase::find_owners(verts).bnodes();
if (debug) {
err_msg("SubdivUpdater::SubdivUpdater:");
cerr << " "; print_dependencies();
err_msg(" level %d, %d verts, %d boss memes",
m->subdiv_level(), verts.size(),
Bbase::find_boss_vmemes(verts).size());
}
// If not covered, create parent
if (!Bbase::is_covered(verts)) {
// Get parent verts list
Bvert_list parents = LMESH::get_subdiv_inputs(verts);
// If non-empty create parent SubdivUpdater
if (!parents.empty()) {
// Create parent subdiv updater on parent verts
// and add to _inputs
_parent = create(parents);
_inputs += _parent;
}
}
hookup();
}
示例11: Bvert_list
Bvert_list
LMESH::get_subdiv_inputs(CBvert_list& verts)
{
static bool debug = Config::get_var_bool("DEBUG_LMESH_SUBDIV_INPUTS",false);
// Given a set of vertices from the same LMESH, return
// the vertices of the parent LMESH that affect the
// subdivision locations of the given vertices.
// Require verts share common LMESH
// XXX - could relax this, provided we test each Bvert
// to ensure it is really an Lvert.
if (!dynamic_pointer_cast<LMESH>(verts.mesh()))
return Bvert_list();
// Get direct parent vertices and edges
Bvert_list vp; // vertex parents
Bedge_list ep; // edge parents
get_parents(verts, vp, ep);
err_adv(debug, "%d verts: parents: %d verts, %d edges",
verts.size(), vp.size(), ep.size());
// Clear flags of all adjacent faces
clear_face_flags(vp);
ep.clear_flag02();
// Put all adjacent faces into a list
Bface_list faces = get_q_faces(vp);
err_adv(debug, "parent faces from verts: %d", faces.size());
try_append(faces, ep.get_primary_faces());
err_adv(debug, "parent faces from edges too: %d", faces.size());
// Pull out the vertices:
return faces.get_verts();
}
示例12:
inline void
set_base_colors(CBvert_list& verts, CCOLOR& col)
{
for (size_t i=0; i<verts.size(); i++)
verts[i]->set_color(col, 1);
}
示例13: clear
bool
BvertGrid::build(
CBvert_list& bottom, // bottom row
CBvert_list& top, // top row
CBvert_list& left, // left column
CBvert_list& right // right column
)
{
// Vertices of bottom and top run left to right.
// On the left and right they run bottom to top.
// Check everything is righteous:
if (bottom.size() < 2 ||
bottom.size() != top.size() ||
left.size() < 2 ||
left.size() != right.size() ||
bottom.front() != left.front() ||
bottom.back() != right.front() ||
top.front() != left.back() ||
top.back() != right.back() ||
!bottom.same_mesh() ||
!top.same_mesh() ||
!left.same_mesh() ||
!right.same_mesh() ||
bottom.mesh() == nullptr) {
err_msg("BvertGrid::build: can't deal with CRAP input");
std::ostream_iterator<Bvert*> err_it (std::cerr, ", ");
cerr << "bottom: ";
std::copy(bottom.begin(), bottom.end(), err_it);
cerr << endl;
cerr << "top: ";
std::copy(top.begin(), top.end(), err_it);
cerr << endl;
cerr << "left: ";
std::copy(left.begin(), left.end(), err_it);
cerr << endl;
cerr << "right: ";
std::copy(right.begin(), right.end(), err_it);
cerr << endl;
return false;
}
// Wipe the old:
clear();
// Build the new...
// bottom row:
_grid.push_back(bottom);
BMESHptr m = bottom.mesh(); assert(m);
// Internal rows:
for (Bvert_list::size_type j=1; j<left.size()-1; j++) {
Bvert_list row; // vertices for row j
row.push_back(left[j]); // add first vertex for row j
for (Bvert_list::size_type i=1; i<bottom.size()-1; i++)
row.push_back(m->add_vertex()); // add internal vertices
row.push_back(right[j]); // add last vertex for row j
_grid.push_back(row);
}
// top row:
_grid.push_back(top);
// Now compute cached values:
cache();
return true;
}