当前位置: 首页>>代码示例>>C++>>正文


C++ IndexVector类代码示例

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


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

示例1: removeIndex

void
Selection::removeIndex (const IndexVector &indices)
{
    IndexVector::const_iterator it;
    for(it = indices.begin(); it != indices.end(); ++it)
        removeIndex(*it);
}
开发者ID:sibaoli,项目名称:RPCP,代码行数:7,代码来源:selection.cpp

示例2:

IndexVector::IndexVector(const IndexVector &rhs){
		_length=rhs.length();
		if(_length>0) {
			_data = new int[_length];
			memcpy(_data,rhs.data(),_length*sizeof(int) );
		}	else{
			_data=0;
		}
}
开发者ID:MazenAli,项目名称:HPC_FLENS,代码行数:9,代码来源:Vector.cpp

示例3:

osg::Vec3f TriangleMeshSmoother::cumulateTriangleNormals(const IndexVector& triangles) const {
    osg::Vec3f normal;
    normal.set(0.f, 0.f, 0.f);
    for(IndexVector::const_iterator triangle = triangles.begin() ; triangle != triangles.end() ; ++ triangle) {
        const Triangle& t = _graph->triangle(*triangle);
        normal += (t._normal * t._area);
    }
    return normal;
}
开发者ID:MORTAL2000,项目名称:OpenSceneGraph,代码行数:9,代码来源:TriangleMeshSmoother.cpp

示例4: sparse

IGL_INLINE void igl::sparse(
  const IndexVector & I,
  const IndexVector & J,
  const ValueVector & V,
  Eigen::SparseMatrix<T>& X)
{
  size_t m = (size_t)I.maxCoeff()+1;
  size_t n = (size_t)J.maxCoeff()+1;
  return igl::sparse(I,J,V,m,n,X);
}
开发者ID:thedrakes,项目名称:libigl,代码行数:10,代码来源:sparse.cpp

示例5: buildIndices

	IndexVector buildIndices(const std::string& expr, Iterator begin, Iterator end) const {
		IndexVector indices;

		for (Iterator i = begin; i != end; ++i) {
			if (expr.empty() || i->matches(expr)) {
				indices.push_back(std::distance(begin, i));
			}
		}

		return indices;
	}
开发者ID:andrey-nakin,项目名称:nettcl2d,代码行数:11,代码来源:network.hpp

示例6: children

/*!
 * \brief children Populate a children list for the given contour. No control is made.
 * \param _hierarchy OpenCV contour hierarchy used to find children.
 * \param _parentIndex Index in _hierarchy of the given contour. _parentIndex must exist in _hierarchy.
 * \param _children Output list of the found children.
 * \return number of children.
 */
void ContourManager::children(const Hierarchy & _hierarchy, int _parentIndex, IndexVector & _children)
{
    _children.clear();

    int currentChild = _hierarchy[_parentIndex][HIERARCHY_INDEX_FIRST_CHILD];//First child

    while (currentChild >= 0)
    {
        _children.push_back(currentChild);

        currentChild = _hierarchy[currentChild][HIERARCHY_INDEX_NEXT];
    }//while (currentChild >= 0)
}//children
开发者ID:broija,项目名称:subdetection,代码行数:20,代码来源:contourmanager.cpp

示例7: replaceVertexIndexInTriangles

void TriangleMeshSmoother::replaceVertexIndexInTriangles(const IndexVector& triangles, unsigned int oldIndex, unsigned int newIndex) {
    for(IndexVector::const_iterator tri = triangles.begin() ; tri != triangles.end() ; ++ tri) {
        Triangle& triangle = _graph->triangle(*tri);
        if(triangle.v1() == oldIndex) {
            triangle.v1() = newIndex;
        }
        else if(triangle.v2() == oldIndex) {
            triangle.v2() = newIndex;
        }
        else if(triangle.v3() == oldIndex) {
            triangle.v3() = newIndex;
        }
    }
}
开发者ID:MORTAL2000,项目名称:OpenSceneGraph,代码行数:14,代码来源:TriangleMeshSmoother.cpp

示例8: while

  void
  AdjacencyRansac::InvalidateQueryIndices(IndexVector &query_indices)
  {
    if (query_indices.empty())
      return;
    // Figure out the points with those query indices
    std::sort(query_indices.begin(), query_indices.end());
    IndexVector::iterator end = std::unique(query_indices.begin(), query_indices.end());
    query_indices.resize(end - query_indices.begin());

    IndexVector indices_to_remove;
    indices_to_remove.reserve(query_indices_.size());
    IndexVector::const_iterator iter = query_indices.begin();
    BOOST_FOREACH(unsigned int index, valid_indices_){
    unsigned int query_index = query_indices_[index];
    if (query_index < *iter)
    continue;
    // If the match has a keypoint in the inliers, remove the match
    while ((iter != end) && (query_index > *iter))
    ++iter;
    if (query_index == *iter)
    {
      indices_to_remove.push_back(index);
      continue;
    }

    if (iter == end)
    break;
  }
开发者ID:edgarriba,项目名称:tod,代码行数:29,代码来源:adjacency_ransac.cpp

示例9: IndexVector

void RemoveUnusedStructField::handleOneRecordDecl(const RecordDecl *RD,
                                                  const RecordDecl *BaseRD,
                                                  const FieldDecl *FD,
                                                  unsigned int Idx)
{
  IndexVector *BaseIdxVec = RecordDeclToField[BaseRD];
  if (!BaseIdxVec)
    return;

  IndexVector *NewIdxVec = RecordDeclToField[RD];
  if (!NewIdxVec) {
    NewIdxVec = new IndexVector();
    RecordDeclToField[RD] = NewIdxVec;
  }
  NewIdxVec->push_back(Idx);
  FieldToIdxVector[FD] = BaseIdxVec;
}
开发者ID:annulen,项目名称:creduce,代码行数:17,代码来源:RemoveUnusedStructField.cpp

示例10: testInterleavedSortingWithPops

    void testInterleavedSortingWithPops()
    {
        DPQ dpq;

        IndexVector idVector;

        const Index MAXI( 101 );
        for( int n( MAXI-1 ); n != 0  ; n-=2 )
        {
            const Index id( dpq.push( n ) );

            if( n == 12 || n == 46 )
            {
                idVector.push_back( id );
            }
        }

        dpq.pop( idVector.back() );
        idVector.pop_back();

        BOOST_CHECK_EQUAL( MAXI/2 -1, dpq.getSize() );

        BOOST_CHECK( dpq.checkConsistency() );

        for( int n( MAXI ); n != -1  ; n-=2 )
        {
            const Index id( dpq.push( n ) );

            if( n == 17 || n == 81 )
            {
                idVector.push_back( id );
            }
        }

        for( typename IndexVector::const_iterator i( idVector.begin() );
             i != idVector.end(); ++i )
        {
            dpq.pop( *i );
        }

        BOOST_CHECK( dpq.checkConsistency() );
        BOOST_CHECK_EQUAL( MAXI-4, dpq.getSize() );

        int n( 0 );
        while( ! dpq.isEmpty() )
        {
            ++n;
            if( n == 12 || n == 46 || n == 17 || n == 81 )
            {
                continue;
            }
            BOOST_CHECK_EQUAL( n, dpq.getTop() );
            dpq.popTop();
        }

        BOOST_CHECK_EQUAL( MAXI, Index( n ) );

        BOOST_CHECK( dpq.isEmpty() );
        BOOST_CHECK( dpq.checkConsistency() );
    }
开发者ID:ecell,项目名称:ecell3,代码行数:60,代码来源:DynamicPriorityQueue_test.cpp

示例11: testSimpleSortingWithPops

    void testSimpleSortingWithPops()
    {
        DPQ dpq;

        IndexVector idVector;

        const Index MAXI( 100 );
        for( int n( MAXI ); n != 0  ; --n )
        {
            Index id( dpq.push( n ) );
            if( n == 11 || n == 45 )
            {
                idVector.push_back( id );
            }
        }

        BOOST_CHECK( dpq.checkConsistency() );

        BOOST_CHECK_EQUAL( MAXI, dpq.getSize() );

        for( typename IndexVector::const_iterator i( idVector.begin() );
             i != idVector.end(); ++i )
        {
            dpq.pop( *i );
        }

        BOOST_CHECK_EQUAL( MAXI - 2, dpq.getSize() );

        int n( 0 );
        while( ! dpq.isEmpty() )
        {
            ++n;
            if( n == 11 || n == 45 )
            {
                continue; // skip
            }
            BOOST_CHECK_EQUAL( int( n ), dpq.getTop() );
            dpq.popTop();
        }

        BOOST_CHECK_EQUAL( MAXI, Index( n ) );

        BOOST_CHECK( dpq.isEmpty() );
        BOOST_CHECK( dpq.checkConsistency() );
    }
开发者ID:ecell,项目名称:ecell3,代码行数:45,代码来源:DynamicPriorityQueue_test.cpp

示例12:

void
AdjacencyList::node_neighbors(const int& local_index,
                              IndexVector& global_neighbor_indexes) const
{
  BOOST_ASSERT(local_index < p_adjacency.size());
  global_neighbor_indexes.clear();
  std::copy(p_adjacency[local_index].begin(), p_adjacency[local_index].end(),
            std::back_inserter(global_neighbor_indexes));

}
开发者ID:Anastien,项目名称:GridPACK,代码行数:10,代码来源:adjacency_list.cpp

示例13: glGetIntegerv

void
Select2DTool::end (int x, int y, BitMask modifiers, BitMask)
{
  if (!cloud_ptr_)
    return;
  final_x_ = x;
  final_y_ = y;
  display_box_ = false;
  // don't select anything if we don't have a selection box.
  if ((final_x_ == origin_x_) || (final_y_ == origin_y_))
    return;

  GLint viewport[4];
  glGetIntegerv(GL_VIEWPORT,viewport);
  IndexVector indices;
  GLfloat project[16];
  glGetFloatv(GL_PROJECTION_MATRIX, project);

  Point3DVector ptsvec;
  cloud_ptr_->getDisplaySpacePoints(ptsvec);
  for(size_t i = 0; i < ptsvec.size(); ++i)
  {
    Point3D pt = ptsvec[i];
    if (isInSelectBox(pt, project, viewport))
      indices.push_back(i);
  }

  if (modifiers & SHFT)
  {
    selection_ptr_->addIndex(indices);
  }
  else if (modifiers & CTRL)
  {
    selection_ptr_->removeIndex(indices);
  }
  else
  {
    selection_ptr_->clear();
    selection_ptr_->addIndex(indices);
  }
  cloud_ptr_->setSelection(selection_ptr_);
}
开发者ID:PointCloudLibrary,项目名称:pcl,代码行数:42,代码来源:select2DTool.cpp

示例14: Table

postTable::postTable (OpenTypeFile &aFont, MemoryBlockPtr memory) : Table (aFont)
{
	MemoryPen pen (memory);
	version = pen.readFixed();
	if (version != 0x00020000 && version != 0x00030000)
		throw Exception ("Unsupported table version: " + String (version, 16));
	italicAngle = pen.readFixed();
	underlinePosition = pen.readFWord();
	underlineThickness = pen.readFWord();
	isFixedPitch = pen.readULong();
	minMemType42 = pen.readULong();
	maxMemType42 = pen.readULong();
	minMemType1 = pen.readULong();
	maxMemType1 = pen.readULong();

	if (version == 0x00020000) {
		// Read glyph names
		UShort glyphNum = pen.readUShort();
		typedef vector<UShort> IndexVector;
		IndexVector glyphNameIndices;
		glyphNameIndices.reserve (glyphNum);
		UShort i;
		for (i = 0; i < glyphNum; i++)
			glyphNameIndices.push_back (pen.readUShort());

		vector<String> extraNames;
		IndexVector::iterator index;
		for (index = glyphNameIndices.begin(); index != glyphNameIndices.end(); index ++) {
			if (*index < MACINTOSH_SET_SIZE)
				postNames.push_back (macGlyphs [*index]);
			else {
				UShort extraIndex = *index - MACINTOSH_SET_SIZE;
				while (extraNames.size() <= extraIndex) {
					Byte nameLength = pen.readByte();
					extraNames.push_back (pen.readString (nameLength));
				}
				postNames.push_back (extraNames [extraIndex]);
			}
		}
	}
}
开发者ID:kennytm,项目名称:tticomp,代码行数:41,代码来源:OTpostTable.cpp

示例15:

void
TopologyGraph::dumpBoundary(const IndexVector& boundary, const std::string& filename)
{
    if (boundary.empty())
        return;
    
    osg::Vec3Array* v = new osg::Vec3Array();

    for (IndexVector::const_iterator i = boundary.begin(); i != boundary.end(); ++i)
    {
        const Index& index = *i;
        v->push_back(osg::Vec3(index->x(), index->y(), 0));
    }

    osg::ref_ptr<osg::Geometry> g = new osg::Geometry();
    g->setVertexArray(v);
    g->addPrimitiveSet(new osg::DrawArrays(GL_LINE_LOOP, 0, v->size()));
    g->addPrimitiveSet(new osg::DrawArrays(GL_POINTS, 0, v->size()));
    g->getOrCreateStateSet()->setAttributeAndModes(new osg::Point(3));
    osgDB::writeNodeFile(*(g.get()), filename);
}
开发者ID:JD31,项目名称:osgearth,代码行数:21,代码来源:TopologyGraph.cpp


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