您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vc函数代码示例

51自学网 2021-06-03 09:34:49
  C++
这篇教程C++ vc函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中vc函数的典型用法代码示例。如果您正苦于以下问题:C++ vc函数的具体用法?C++ vc怎么用?C++ vc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了vc函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_cell_on_cell_iterator

bool test_cell_on_cell_iterator(G const& g, ::std::ostream & out, GT){  typedef GT gt;  typedef typename gt::CellIterator        CellIterator;  typedef typename gt::CellOnCellIterator  CellOnCellIterator;  for(CellIterator c(g); ! c.IsDone(); ++c) {    int v_cnt = 0;    for(CellOnCellIterator vc(*c); ! vc.IsDone(); ++vc, ++v_cnt) {      ;    }    REQUIRE_ALWAYS(v_cnt == (int)(*c).NumOfCells(),                    "v_cnt = " << v_cnt << " != c.NumOfCells() = "                    << (*c).NumOfCells() << '/n',1);    CellOnCellIterator v;    v = (*c).FirstCell();    CellOnCellIterator w = v;    for( ; !v.IsDone(); ++v, ++w) {      REQUIRE_ALWAYS( ( v ==  w), "Iterators differ!/n",1);      REQUIRE_ALWAYS( (*v == *w), "Iterator values differ!/n",1);    }    REQUIRE_ALWAYS( (w.IsDone()), "", 1);    REQUIRE_ALWAYS( (v == w), "Past-the-end iterators differ!/n", 1);      if((*c).NumOfCells() > 0) {      v = (*c).FirstCell();      w = v;      ++v;      for( ; !v.IsDone(); ++v, ++w)         REQUIRE_ALWAYS( (*v != *w), "Iterators point to same cell!/n",1);    }  }  return true;}
开发者ID:BackupTheBerlios,项目名称:gral,代码行数:35,


示例2: test_none

void test_none(){//  Note: The literal values here are tested against directly, careful if you change them:    int some_numbers[] = { 1, 5, 0, 18, 1 };    std::vector<int> vi(some_numbers, some_numbers + 5);    std::list<int>   li(vi.begin(), vi.end ());        int some_letters[] = { 'a', 'q', 'n', 'y', 'n' };    std::vector<char> vc(some_letters, some_letters + 5);        BOOST_CHECK ( ba::none_of_equal ( vi,                                  100 ));    BOOST_CHECK ( ba::none_of       ( vi,                       is_<int> ( 100 )));    BOOST_CHECK ( ba::none_of_equal ( vi.begin(),     vi.end(),            100 ));    BOOST_CHECK ( ba::none_of       ( vi.begin(),     vi.end(), is_<int> ( 100 )));    BOOST_CHECK (!ba::none_of_equal ( vi,                                    1 ));    BOOST_CHECK (!ba::none_of       ( vi,                       is_<int> (   1 )));    BOOST_CHECK (!ba::none_of_equal ( vi.begin(),     vi.end(),              1 ));    BOOST_CHECK (!ba::none_of       ( vi.begin(),     vi.end(), is_<int> (   1 )));    BOOST_CHECK ( ba::none_of_equal ( vi.end(),       vi.end(),              0 ));    BOOST_CHECK ( ba::none_of       ( vi.end(),       vi.end(), is_<int> (   0 )));//   5 is not in { 0, 18, 1 }, but 1 is    BOOST_CHECK ( ba::none_of_equal ( vi.begin() + 2, vi.end(),              5 ));    BOOST_CHECK ( ba::none_of       ( vi.begin() + 2, vi.end(), is_<int> (   5 )));    BOOST_CHECK (!ba::none_of_equal ( vi.begin() + 2, vi.end(),              1 ));    BOOST_CHECK (!ba::none_of       ( vi.begin() + 2, vi.end(), is_<int> (   1 )));//  18 is not in { 1, 5, 0 }, but 5 is    BOOST_CHECK ( ba::none_of_equal ( vi.begin(),     vi.begin() + 3,            18 ));    BOOST_CHECK ( ba::none_of       ( vi.begin(),     vi.begin() + 3, is_<int> ( 18 )));    BOOST_CHECK (!ba::none_of_equal ( vi.begin(),     vi.begin() + 3,             5 ));    BOOST_CHECK (!ba::none_of       ( vi.begin(),     vi.begin() + 3, is_<int> (  5 )));        BOOST_CHECK ( ba::none_of_equal ( vc,             'z' ));    BOOST_CHECK ( ba::none_of       ( vc, is_<char> ( 'z' )));    BOOST_CHECK (!ba::none_of_equal ( vc,             'a' ));    BOOST_CHECK (!ba::none_of       ( vc, is_<char> ( 'a' )));    BOOST_CHECK (!ba::none_of_equal ( vc,             'n' ));    BOOST_CHECK (!ba::none_of       ( vc, is_<char> ( 'n' )));    BOOST_CHECK ( ba::none_of_equal ( vi.begin(), vi.begin(),   1 ));    BOOST_CHECK ( ba::none_of_equal ( vc.begin(), vc.begin(), 'a' ));    BOOST_CHECK ( ba::none_of       ( vi.begin(), vi.begin(), is_<int>  (   1 )));    BOOST_CHECK ( ba::none_of       ( vc.begin(), vc.begin(), is_<char> ( 'a' )));    BOOST_CHECK ( ba::none_of_equal ( li,                                  100 ));    BOOST_CHECK ( ba::none_of       ( li,                       is_<int> ( 100 )));    BOOST_CHECK ( ba::none_of_equal ( li.begin(),     li.end(),            100 ));    BOOST_CHECK ( ba::none_of       ( li.begin(),     li.end(), is_<int> ( 100 )));        std::list<int>::iterator l_iter = li.begin ();    l_iter++; l_iter++; l_iter++;    BOOST_CHECK ( ba::none_of_equal ( li.begin(), l_iter,            18 ));    BOOST_CHECK ( ba::none_of       ( li.begin(), l_iter, is_<int> ( 18 )));    BOOST_CHECK (!ba::none_of       ( li.begin(), l_iter, is_<int> (  5 )));}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:60,


示例3: main

/** [Example] */int main(int argc, char *argv[]) {    // Start server  ib::fast_server< ib::image > is;  is.set_max_pending_outbound(100);  is.startup("tcp://127.0.0.1:6000");     // Open video device  cv::VideoCapture vc(0);  if (!vc.isOpened()) {    std::cerr << "Failed to open capture device" << std::endl;  }    cv::Mat cv_img;  // While more images are available ...  while (vc.grab() && vc.retrieve(cv_img))   {    // Convert image    ib::image ib_img;    ib::cvt_image(cv_img, ib_img, ib::copy_mem());    // Publish to all connected clients    is.publish(ib_img);  }    return 0;}
开发者ID:rickesh,项目名称:image-babble,代码行数:29,


示例4: Gouraud_Shading

/** * * Points are in world coordinates */void Gouraud_Shading(face *f, object_copy *obj,		vector<light> *lights, camera *camera, int xres, int yres, color **grid,		float **depth_grid, MatrixXd *perspective, MatrixXd *inv_cam) {	point *a = &(obj->points[f->vertices.index1-1]);	color colora = lighting(a,				&(obj->normals[f->normals.index1-1]),				obj, lights, camera);	point *b = &(obj->points[f->vertices.index2-1]);	color colorb = lighting(b,				&(obj->normals[f->normals.index2-1]),				obj, lights, camera);	point *c = &(obj->points[f->vertices.index3-1]);	color colorc = lighting(c,				&(obj->normals[f->normals.index3-1]),				obj, lights, camera);	point ndca = to_NDC(a, perspective, inv_cam);	point ndcb = to_NDC(b, perspective, inv_cam);	point ndcc = to_NDC(c, perspective, inv_cam);	Vector3d va(ndca.x, ndca.y, ndca.z);	Vector3d vb(ndcb.x, ndcb.y, ndcb.z);	Vector3d vc(ndcc.x, ndcc.y, ndcc.z);	Vector3d cross = (vc - vb).cross(va - vb);	// ignore if pointing away from camera or if face is outside NDC box	if (cross(2) >= 0 && is_in_box(&ndca) && is_in_box(&ndcb) && is_in_box(&ndcc))		raster_triangle(&ndca, &ndcb, &ndcc, colora, colorb, colorc, xres, yres, grid, depth_grid);}
开发者ID:enwrought,项目名称:cs171a,代码行数:35,


示例5: test16

 void test16(void) {     vector<string> vc(2);     vc.front() = "hi";          cout << vc.front() << '|' << vc.back() << endl; }
开发者ID:CCJY,项目名称:coliru,代码行数:7,


示例6: surface

QVector<QVector3D> SurfaceItem::vertices() const{    QSize size = surface()->size();    qreal w = (m_height * size.width()) / size.height();    qreal h = m_height;    QVector3D pos = m_pos + m_normal * m_depthOffset;    QVector2D center(pos.x(), pos.z());    QVector3D perp = QVector3D::crossProduct(QVector3D(0, 1, 0), m_normal);    QVector2D delta = w * QVector2D(perp.x(), perp.z()).normalized() / 2;    qreal scale = qMin(1.0, m_time.elapsed() * 0.002);    qreal top = m_pos.y() + h * 0.5 * scale;    qreal bottom = m_pos.y() - h * 0.5 * scale;    QVector2D left = center - delta * scale;    QVector2D right = center + delta * scale;    QVector3D va(left.x(), top, left.y());    QVector3D vb(right.x(), top, right.y());    QVector3D vc(right.x(), bottom, right.y());    QVector3D vd(left.x(), bottom, left.y());    QVector<QVector3D> result;    result << va << vb << vc << vd;    return result;}
开发者ID:paulolav,项目名称:mazecompositor,代码行数:31,


示例7: main

// runs the raytrace over all tests and saves the corresponding imagesint main(int argc, char** argv) {        // test that glfw and glew are linked properly    uiloop();    message("GLFW and GLEW seem to work/n/n");        // test max_component function    vec3f v(1,2,-3);    float max_val = max_component(v);    message("Result of max_component: %f/n", max_val);        // test sum of three vectors    vec3f va(1,0,0);    vec3f vb(0,4,0);    vec3f vc(0,0,2);    vec3f vabc = sum_three(va, vb, vc);    message("Result of sum_three: %s/n", tostring(vabc).c_str());        // test sum of vectors    vector<vec3f> vs = {        {3.14,1.5,2.7},        {2.71,8.2,8.2},        {1.61,8.0,3.4},        {1.41,4.2,1.4},    };    vec3f vsum = sum_many(vs);    message("Result of sum_many: %s/n", tostring(vsum).c_str());    message("/nThis message indicates a successful build!/n/n");    return 0;}
开发者ID:HanyuX,项目名称:Dart-Graphics-Assign00,代码行数:33,


示例8: ci

T0* ci(int id, T0* o, se_position position) {  /*    Check Id for reference target.  */  if ( vc(o,position) != NULL) {    if ( id == (o->id) ) {      return o;    }    else {#ifdef SE_EXCEPTIONS      internal_exception_handler(System_level_type_error);#else      int l = se_position2line(position);      int c = se_position2column(position);      int f = se_position2path_id(position);      se_print_bad_target(SE_ERR,id,o,l,c,f);      se_print_run_time_stack();      se_print_bad_target(SE_ERR,id,o,l,c,f);#ifdef SE_SEDB      sedb_break(se_dst,0);#else      exit(EXIT_FAILURE);#endif#endif    }  }  return o;}
开发者ID:Imhotup,项目名称:Liberty,代码行数:29,


示例9: drawTexturedPolyhedron

void drawTexturedPolyhedron(carve::mesh::MeshSet<3> *poly,                            carve::interpolate::FaceVertexAttr<tex_t> &fv_tex,                            carve::interpolate::FaceAttr<GLuint> &f_tex_num) {  glEnable(GL_TEXTURE_2D);  glColor4f(1.0f, 1.0f, 1.0f, 1.0f);  GLUtesselator *tess = gluNewTess();  gluTessCallback(tess, GLU_TESS_BEGIN, (GLUTessCallback)glBegin);  gluTessCallback(tess, GLU_TESS_VERTEX_DATA, (GLUTessCallback)tess_vertex);  gluTessCallback(tess,  GLU_TESS_END, (GLUTessCallback)glEnd);  for (carve::mesh::MeshSet<3>::face_iter i = poly->faceBegin(); i != poly->faceEnd(); ++i) {    carve::mesh::MeshSet<3>::face_t *f = *i;    std::vector<vt_t> vc(f->nVertices());    bool textured = true;    for (carve::mesh::MeshSet<3>::face_t::edge_iter_t e = f->begin(); e != f->end(); ++e) {      vc[e.idx()].x = g_scale * (e->vert->v.x + g_translation.x);      vc[e.idx()].y = g_scale * (e->vert->v.y + g_translation.y);      vc[e.idx()].z = g_scale * (e->vert->v.z + g_translation.z);      if (fv_tex.hasAttribute(f, e.idx())) {        tex_t t = fv_tex.getAttribute(f, e.idx());        vc[e.idx()].u = t.u;        vc[e.idx()].v = t.v;      } else {        textured = false;      }    }    if (textured) {      GLuint tex_num = f_tex_num.getAttribute(f, 0);      glEnable(GL_TEXTURE_2D);      glBindTexture(GL_TEXTURE_2D, tex_num);      glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);      glColor4f(1.0f, 1.0f, 1.0f, 1.0f);    } else {      glColor4f(0.5f, 0.6f, 0.7f, 1.0f);    }    glNormal3dv(f->plane.N.v);    gluTessBeginPolygon(tess, (void *)&textured);    gluTessBeginContour(tess);    for (size_t j = 0; j != vc.size(); ++j) {      gluTessVertex(tess, (GLdouble *)&vc[j], (GLvoid *)&vc[j]);    }    gluTessEndContour(tess);    gluTessEndPolygon(tess);  }  gluDeleteTess(tess);  glDisable(GL_TEXTURE_2D);}
开发者ID:ManojRollo,项目名称:carve,代码行数:60,


示例10: test_offset_curve

void test_offset_curve(double const &offset) {    const double dx = 0.01;    const double r = (1.0 + offset);    std::vector<double> pos, off_pos;    const size_t max_i = 1000;    for (size_t i = 0; i <= max_i; ++i) {        double x = M_PI * double(i) / max_i;        pos.push_back(-std::cos(x)); pos.push_back(std::sin(x));        off_pos.push_back(-r * std::cos(x)); off_pos.push_back(r * std::sin(x));    }    fake_path path(pos), off_path(off_pos);    mapnik::vertex_cache vc(path), off_vc(off_path);    vc.reset(); vc.next_subpath();    off_vc.reset(); off_vc.next_subpath();    while (vc.move(dx)) {        double mpos = vc.linear_position();        double moff_pos = off_vc.position_closest_to(vc.current_position());        {            mapnik::vertex_cache::scoped_state s(off_vc);            off_vc.move(moff_pos);            auto eps = (1.001 * offset);            auto actual = dist(vc.current_position(), off_vc.current_position());            REQUIRE(actual < eps);        }        REQUIRE(std::abs((mpos / vc.length()) - (moff_pos / off_vc.length())) < 1.0e-3);    }}
开发者ID:CartoDB,项目名称:mapnik,代码行数:31,


示例11: step

    void step()    {        boost::scoped_ptr<            typename multi_particle_container_type::transaction_type>                tx(pc_.create_transaction());        typedef typename multi_particle_container_type::transaction_type::particle_id_pair_generator particle_id_pair_generator;        typedef typename multi_particle_container_type::transaction_type::particle_id_pair_and_distance_list particle_id_pair_and_distance_list;        last_reaction_setter rs(*this);        volume_clearer vc(*this);        BDPropagator<traits_type> ppg(            *tx, *main_.network_rules(), main_.rng(),            base_type::dt_,            1 /* FIXME: dissociation_retry_moves */, &rs, &vc,            make_select_first_range(pc_.get_particles_range()));        last_event_ = NONE;        while (ppg())        {            if (last_reaction_)            {                last_event_ = REACTION;                break;            }        }    }
开发者ID:YukiSakamoto,项目名称:epdp,代码行数:26,


示例12: test_s_shaped_curve

void test_s_shaped_curve(double const &offset) {    const double dx = 0.01;    const double r = (1.0 + offset);    const double r2 = (1.0 - offset);    std::vector<double> pos, off_pos;    const size_t max_i = 1000;    for (size_t i = 0; i <= max_i; ++i) {        double x = M_PI * double(i) / max_i;        pos.push_back(-std::cos(x) - 1); pos.push_back(std::sin(x));        off_pos.push_back(-r * std::cos(x) - 1); off_pos.push_back(r * std::sin(x));    }    for (size_t i = 0; i <= max_i; ++i) {        double x = M_PI * double(i) / max_i;        pos.push_back(-std::cos(x) + 1); pos.push_back(-std::sin(x));        off_pos.push_back(-r2 * std::cos(x) + 1); off_pos.push_back(-r2 * std::sin(x));    }    fake_path path(pos), off_path(off_pos);    mapnik::vertex_cache vc(path), off_vc(off_path);    vc.reset(); vc.next_subpath();    off_vc.reset(); off_vc.next_subpath();    while (vc.move(dx)) {        double moff_pos = off_vc.position_closest_to(vc.current_position());        {            mapnik::vertex_cache::scoped_state s(off_vc);            off_vc.move(moff_pos);            REQUIRE(dist(vc.current_position(), off_vc.current_position()) < (1.002 * offset));        }    }}
开发者ID:CartoDB,项目名称:mapnik,代码行数:33,


示例13: vc

VoxelCube HeightNoise::noise(int dim, int offset[3], int octaves, float frequency, float amplitude, int seed){	VoxelCube vc(dim);	m_perlin = new Perlin(octaves, frequency, amplitude, seed);		for(int i = 0; i < dim; i++)	{		for(int j = 0; j < dim; j++)		{			float value = m_perlin->Get((i+offset[0])/(float)dim, (j+offset[2])/(float)dim);			value +=      m_perlin->Get((i+offset[0])/(float)dim*2, (j+offset[2])/(float)dim*2) * 0.5;			value +=      m_perlin->Get((i+offset[0])/(float)dim*4, (j+offset[2])/(float)dim*4) * 0.5 * 0.5;			value +=      m_perlin->Get((i+offset[0])/(float)dim*8, (j+offset[2])/(float)dim*8) * 0.5 * 0.5 * 0.5;						value = value * 0.5 + 0.5;						if(value > 1.0)				value = 1.0;			else if(value < 0.0)				value = 0.0;						for(int k = 0; k < dim*value; k++)			{				vc.set(i, k, j, 255);			}						for(int k = dim*value; k < dim; k++)			{				vc.set(i, k, j, 0);			}		}	}		return vc;}
开发者ID:larsendt,项目名称:4830project,代码行数:35,


示例14: Phong_Shading

void Phong_Shading(face *f, object_copy *obj,	vector<light> *lights, camera *camera, int xres, int yres, color **grid,	float **depth_grid, MatrixXd *perspective, MatrixXd *inv_cam) {	// TODO: implement	point *a = &(obj->points[f->vertices.index1-1]);	point *normal_a = &(obj->normals[f->normals.index1-1]);	point *b = &(obj->points[f->vertices.index2-1]);	point *normal_b = &(obj->normals[f->normals.index2-1]);	point *c = &(obj->points[f->vertices.index3-1]);	point *normal_c = &(obj->normals[f->normals.index3-1]);	point ndca = to_NDC(a, perspective, inv_cam);	point ndcb = to_NDC(b, perspective, inv_cam);	point ndcc = to_NDC(c, perspective, inv_cam);	Vector3d va(ndca.x, ndca.y, ndca.z);	Vector3d vb(ndcb.x, ndcb.y, ndcb.z);	Vector3d vc(ndcc.x, ndcc.y, ndcc.z);	Vector3d cross = (vc - vb).cross(va - vb);	// ignore if pointing away from camera or if face is outside NDC box	if (cross(2) >= 0) // && is_in_box(&ndca) && is_in_box(&ndcb) && is_in_box(&ndcc))		raster_triangle_Phong(&ndca, &ndcb, &ndcc, a, b, c, normal_a, normal_b,				normal_c, obj, lights, camera, xres, yres, grid, depth_grid, perspective, inv_cam);}
开发者ID:enwrought,项目名称:cs171a,代码行数:27,


示例15: vc

voidOcclusionQueryVisitor::addOQN( osg::Node& node ){    VertexCounter vc( _occluderThreshold );    node.accept( vc );    if (vc.exceeded())    {        // Insert OQN(s) above this node.        unsigned int np = node.getNumParents();        while (np--)        {            osg::Group* parent = dynamic_cast<osg::Group*>( node.getParent( np ) );            if (parent != NULL)            {                osg::ref_ptr<osg::OcclusionQueryNode> oqn = new osg::OcclusionQueryNode();                oqn->addChild( &node );                parent->replaceChild( &node, oqn.get() );                oqn->setName( getNextOQNName() );                // Set all OQNs to use the same query StateSets (instead of multiple copies                //   of the same StateSet) for efficiency.                oqn->setQueryStateSet( _state.get() );                oqn->setDebugStateSet( _debugState.get() );            }        }    }}
开发者ID:joevandyk,项目名称:osg,代码行数:27,


万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。