• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ VertexRange类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1:

PrimitiveRange::PrimitiveRange(PrimitiveType type,
                               const VertexRange& vertexRange):
  m_type(type),
  m_vertexBuffer(nullptr),
  m_indexBuffer(nullptr),
  m_start(0),
  m_count(0),
  m_base(0)
{
  m_vertexBuffer = vertexRange.vertexBuffer();
  m_start = vertexRange.start();
  m_count = vertexRange.count();
}
开发者ID:truongascii,项目名称:Wendy,代码行数:13,代码来源:RenderBuffer.cpp


示例2:

list LinearCartesian1D_Domain::get_vertices()
{
    list vertices;

    typedef LinearCartesian1D_Domain_t                                                        DomainType;
    typedef viennagrid::result_of::element_range<DomainType, viennagrid::vertex_tag>::type    VertexRange;
    typedef viennagrid::result_of::iterator<VertexRange>::type                                VertexIterator;

    VertexRange range = viennagrid::elements(domain);
    for (VertexIterator it = range.begin(); it != range.end(); ++it)
        vertices.append<LinearCartesian1D_Vertex>(LinearCartesian1D_Vertex(*it));

    return vertices;
}
开发者ID:jonancm,项目名称:viennagrid-python,代码行数:14,代码来源:linear.cpp


示例3: VertexIDType

LinearSpherical3D_Vertex LinearSpherical3D_Domain::get_vertex(unsigned int index)
{
    typedef LinearSpherical3D_VertexRange_t                       VertexRange;
    typedef viennagrid::result_of::iterator<VertexRange>::type    VertexIterator;
    typedef LinearSpherical3D_Vertex_t::id_type                   VertexIDType;

    VertexIterator vertex = viennagrid::find_by_id(domain, VertexIDType(index));
    VertexRange range = viennagrid::elements(domain);
    if (vertex == range.end())
    {
        std::stringstream ss;
        ss << "no vertex at index " << index;
        throw std::out_of_range(ss.str());
    }
    return LinearSpherical3D_Vertex(*vertex);
}
开发者ID:jonancm,项目名称:viennagrid-python,代码行数:16,代码来源:linear.cpp


示例4: AddPartialSharedRanges

void AddPartialSharedRanges(Overlap          &  ovrlp,  // out
			    Partition   const&  Prtng,
			    int                 p,
			    Part2Cell   const&  P2C,
			    VertexRange const&  shared_v,
			    FacetRange  const&  shared_f,
			    VtxCorr     const&  vtx_corr,
			    FacetCorr   const&  facet_corr)
{
  // for(int p = 0; p < (int) Prtng.NumOfPartitions(); ++p) {
  typedef typename FacetRange::ElementIterator RgeFacetIterator;
  for(RgeFacetIterator f = shared_f.FirstElement(); ! f.IsDone(); ++f) {
    int q = Prtng.other_partition(*f,p);
    //      if(p > q) { // <---- unsymmetric
    if( (P2C(q) < P2C(p)) || (P2C(p) == P2C(q) && p > q)) { // <---- unsymmetric
      ovrlp[P2C(p)].facets(P2C(q)).shared().push_back(*f);             // local
      if( q < 0)
	ovrlp[P2C(q)].facets(P2C(p)).shared().push_back(facet_corr(*f)); // "remote"
      else
	ovrlp[P2C(q)].facets(P2C(p)).shared().push_back(*f);             // "local"
    }
  }
  // }
  
  PartitionsByVertex<Partition>  PV(Prtng);
  typedef typename PartitionsByVertex<Partition>::PartitionOfVertexIterator VtxPartIterator;
  // for(int p = 0; p < (int) Prtng.NumOfPartitions(); ++p) {
  // CoarseCell P(Prtng.PartCell());
  typedef typename VertexRange::ElementIterator  RgeVertexIterator;
  for(RgeVertexIterator v = shared_v.FirstElement(); ! v.IsDone(); ++v) {
    for(VtxPartIterator qi = PV.begin(*v); qi != PV.end(*v); ++qi) {
      int q = *qi;
      //	if(p > q) { // <---- unsymmetric
      if( (P2C(q) < P2C(p)) || (P2C(p) == P2C(q) && p > q)) { // <---- unsymmetric
	ovrlp[P2C(p)].vertices(P2C(q)).shared().push_back(*v);             // local
	if( q < 0)
	  ovrlp[P2C(q)].vertices(P2C(p)).shared().push_back(vtx_corr(*v));   // "remote"
	else
	  ovrlp[P2C(q)].vertices(P2C(p)).shared().push_back(*v);             // "local"
      }
    }
  }
  // }
}
开发者ID:BackupTheBerlios,项目名称:gral,代码行数:44,代码来源:add-partial-shared.C


示例5: findGlyph

void Font::drawText(vec2 pen, vec4 color, const char* text)
{
  uint vertexCount = 0;

  // Realize vertices for glyphs
  {
    const size_t length = std::strlen(text);
    m_vertices.resize(length * 6);

    for (const char* c = text;  *c != '\0'; )
    {
      const uint32 codepoint = utf8::next<const char*>(c, text + length);
      const Glyph* glyph = findGlyph(codepoint);
      if (!glyph)
      {
        glyph = findGlyph(0xfffd);
        if (!glyph)
          continue;
      }

      pen = round(pen);

      if (all(greaterThan(glyph->size, vec2(0.f))))
      {
        const Rect pa(pen + glyph->bearing - vec2(0.5f), glyph->size);
        const Rect ta(glyph->offset + vec2(0.5f), glyph->size);

        m_vertices[vertexCount + 0].texcoord = ta.position;
        m_vertices[vertexCount + 0].position = pa.position;
        m_vertices[vertexCount + 1].texcoord = ta.position + vec2(ta.size.x, 0.f);
        m_vertices[vertexCount + 1].position = pa.position + vec2(pa.size.x, 0.f);
        m_vertices[vertexCount + 2].texcoord = ta.position + ta.size;
        m_vertices[vertexCount + 2].position = pa.position + pa.size;

        m_vertices[vertexCount + 3] = m_vertices[vertexCount + 2];
        m_vertices[vertexCount + 4].texcoord = ta.position + vec2(0.f, ta.size.y);
        m_vertices[vertexCount + 4].position = pa.position + vec2(0.f, pa.size.y);
        m_vertices[vertexCount + 5] = m_vertices[vertexCount + 0];

        vertexCount += 6;
      }

      pen += vec2(glyph->advance, 0.f);
    }
  }

  if (!vertexCount)
    return;

  VertexRange range = m_context.allocateVertices(vertexCount,
                                                 Vertex2ft2fv::format);
  if (range.isEmpty())
  {
    logError("Failed to allocate vertices for text drawing");
    return;
  }

  range.copyFrom(m_vertices.data());

  m_pass.setUniformState(m_colorIndex, color);
  m_pass.apply();

  m_context.render(PrimitiveRange(TRIANGLE_LIST, range));
}
开发者ID:elmindreda,项目名称:Nori,代码行数:64,代码来源:Font.cpp


示例6: main


//.........这里部分代码省略.........
  //! [polyhedralizer-segment]

  //! [polyhedralizer-lsf]
  for ( vector<RoundPlane*>::iterator
          it = roundPlanes.begin(), itE = roundPlanes.end();
        it != itE; ++it )
    {
      NaivePlaneComputer& computer = (*it)->first;
      RealVector normal;
      double mu = LSF( normal, computer.begin(), computer.end() );
      (*it)->third = make_pair( normal, mu );
    }
  //! [polyhedralizer-lsf]

  //! [polyhedralizer-projection]
  map<Surfel, RealPoint> coordinates;
  for ( map<Surfel,RoundPlane*>::const_iterator
          it = v2plane.begin(), itE = v2plane.end();
        it != itE; ++it )
    {
      Surfel v = it->first;
      RoundPlane* rplane = it->second;
      Point p = ks.sKCoords( v );
      RealPoint rp( (double)p[ 0 ]/2.0, (double)p[ 1 ]/2.0, (double)p[ 2 ]/2.0 );
      double mu = rplane->third.second;
      RealVector normal = rplane->third.first;
      double lambda = mu - rp.dot( normal );
      coordinates[ v ] = rp + lambda*normal;
    }
  typedef vector<Surfel> SurfelRange;
  map<Surfel, RealPoint> new_coordinates;
  for ( ConstIterator it = digSurf.begin(), itE= digSurf.end(); it != itE; ++it )
    {
      Surfel s = *it;
      SurfelRange neighbors;
      back_insert_iterator<SurfelRange> writeIt = back_inserter( neighbors );
      digSurf.writeNeighbors( writeIt, *it );
      RealPoint x = RealPoint::zero;
      for ( SurfelRange::const_iterator its = neighbors.begin(), itsE = neighbors.end();
            its != itsE; ++its )
        x += coordinates[ *its ];
      new_coordinates[ s ] = x / neighbors.size();
    }
  //! [polyhedralizer-projection]

  //! [polyhedralizer-MakeMesh]
  typedef unsigned int Number;
  typedef Mesh<RealPoint> MyMesh;
  typedef MyMesh::MeshFace MeshFace;
  typedef MyDigitalSurface::FaceSet FaceSet;
  typedef MyDigitalSurface::VertexRange VertexRange;
  map<Surfel, Number> index;   // Numbers all vertices.
  Number nbv = 0;
  MyMesh polyhedron( true );
  // Insert all projected surfels as vertices of the polyhedral surface.
  for ( ConstIterator it = digSurf.begin(), itE= digSurf.end(); it != itE; ++it )
    {
      polyhedron.addVertex( new_coordinates[ *it ] );
      index[ *it ] = nbv++;
    }
  // Define faces of the mesh. Outputs closed faces.
  FaceSet faces = digSurf.allClosedFaces();
  for ( typename FaceSet::const_iterator itf = faces.begin(), itf_end = faces.end();
        itf != itf_end; ++itf )
    {
      MeshFace mface( itf->nbVertices );
      VertexRange vtcs = digSurf.verticesAroundFace( *itf );
      int i = 0;
      for ( typename VertexRange::const_iterator itv = vtcs.begin(), itv_end = vtcs.end();
            itv != itv_end; ++itv )
        {
          mface[ i++ ] = index[ *itv ];
        }
      polyhedron.addFace( mface, Color( 255, 243, 150, 255 ) );
    }
  //! [polyhedralizer-MakeMesh]

  //! [polyhedralizer-visualization]
  typedef Viewer3D<Space,KSpace> MyViewer3D;
  MyViewer3D viewer( ks );
  viewer.show();
  bool isOK = polyhedron >> "test.off";
  bool isOK2 = polyhedron >> "test.obj";
  viewer << polyhedron;
  viewer << MyViewer3D::updateDisplay;
  application.exec();
  //! [polyhedralizer-visualization]

  //! [polyhedralizer-freeMemory]
  for ( vector<RoundPlane*>::iterator
          it = roundPlanes.begin(), itE = roundPlanes.end();
        it != itE; ++it )
    delete *it;
  //! [polyhedralizer-freeMemory]

  if (isOK && isOK2)
    return 0;
  else
    return 1;
}
开发者ID:151706061,项目名称:DGtal,代码行数:101,代码来源:polyhedralizer.cpp



注:本文中的VertexRange类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VertexSE2类代码示例发布时间:2022-05-31
下一篇:
C++ VertexPointXYZ类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap