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


C++ PointList::push_back方法代码示例

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


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

示例1: get_endpoints

void SplineTrack::get_endpoints(PointList& output) const
{
   output.push_back(origin);

   if (abs(delta.x) > 0 || abs(delta.y) > 0)
      output.push_back(
         make_point(origin.x + delta.x, origin.y + delta.y));
}
开发者ID:ChuanonlyGame,项目名称:traingame,代码行数:8,代码来源:SplineTrack.cpp

示例2: Face

/**
 * Calculates the points where the meshes merge.
 * @param   MeshList    * meshList  The list of meshes whose points must be calculated.
 */
void
Polyhedron::getPoints(MeshList * meshList)
{
	MeshList::iterator	i1, i2, i3;
    PointList vert; /* Set a Vertices list. */
	PointList::iterator vit;
	Point	* temp;

    /* Going through the list of meshes and calculating the vertices of the polyhedron. */
	for (i1 = meshList->begin(); i1 != meshList->end(); i1++) {
        vert.clear();
		for (i2 = meshList->begin(); i2 != meshList->end(); i2++) {
			for (i3 = meshList->begin(); i3 != meshList->end(); i3++) {
                /* Getting the vertices of the face only if all the meshes are different. */
                if (i1 != i2 && i1 != i3 && i2 != i3) {
    				temp = Mesh::intersection(*(*i1), *(*i2), *(*i3));
	    			if (temp != NULL) {
		    			vert.push_back(temp);
                        vertices.push_back(temp);
                    }
                }
			}
		}
        faces.push_back(new Face(&vertices, &(*i1)->normal));
	}
    getOrigin();
}
开发者ID:fenixGames,项目名称:GEngine,代码行数:31,代码来源:geometry3D.cpp

示例3: transform

void transform(const PointList& in,PointList& out,const osg::Matrix& matrix)
{
    for(PointList::const_iterator itr=in.begin();
        itr!=in.end();
        ++itr)
    {
        out.push_back(Point(itr->first,itr->second * matrix));
    }
}
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:9,代码来源:ShadowVolumeOccluder.cpp

示例4: handleDual

void handleDual(Segment_2 s, std::vector<PointList>& polylines)
{
        Point_2 ss = s.source();
        Point_2 st = s.target();
        PointList points;
        points.push_back(ss);
        points.push_back(st);
        polylines.push_back(points);
}
开发者ID:AmbatiRao,项目名称:swp12,代码行数:9,代码来源:handle-dual-disamb.c

示例5: AppendLineToRing

/*!
  \brief Add linestring to a ring (private)

  \param[in,out] papoRing list of rings
  \param poLine pointer to linestring to be added to a ring 

  \return TRUE on success
  \return FALSE on failure
*/
bool IVFKDataBlock::AppendLineToRing(PointListArray *papoRing, const OGRLineString *poLine, bool bNewRing)
{
    OGRPoint *poFirst, *poLast;
    OGRPoint *poFirstNew, *poLastNew;

    OGRPoint  pt;
    PointList poList;

    /* OGRLineString -> PointList */
    for (int i = 0; i < poLine->getNumPoints(); i++) {
        poLine->getPoint(i, &pt);
        poList.push_back(pt);
    }

    /* create new ring */
    if (bNewRing) {
        papoRing->push_back(new PointList(poList));
        return TRUE;
    }
    
    poFirstNew = &(poList.front());
    poLastNew  = &(poList.back());
    for (PointListArray::const_iterator i = papoRing->begin(), e = papoRing->end();
         i != e; ++i) {
        PointList *ring = (*i);
        poFirst = &(ring->front());
        poLast  = &(ring->back());
        if (!poFirst || !poLast || poLine->getNumPoints() < 2)
            return FALSE;

        if (poFirstNew->Equals(poLast)) {
            /* forward, skip first point */
            ring->insert(ring->end(), poList.begin()+1, poList.end());
            return TRUE;
        }
        
        if (poFirstNew->Equals(poFirst)) {
            /* backward, skip last point */
            ring->insert(ring->begin(), poList.rbegin(), poList.rend()-1);
            return TRUE;
        }
        
        if (poLastNew->Equals(poLast)) {
            /* backward, skip first point */
            ring->insert(ring->end(), poList.rbegin()+1, poList.rend());
            return TRUE;
        }
        
        if (poLastNew->Equals(poFirst)) {
            /* forward, skip last point */
            ring->insert(ring->begin(), poList.begin(), poList.end()-1);
            return TRUE;
        }
    }

    return FALSE;
}
开发者ID:sylvainallard,项目名称:gdal,代码行数:66,代码来源:vfkdatablock.cpp

示例6: removeDuplicates

PointList Board::removeDuplicates(PointList lst) const {
	PointList res;
	for (auto pt : lst) {
		if (std::find(res.begin(), res.end(), pt) == res.end()) {
			res.push_back(pt);
		}
	}
	return res;
}
开发者ID:vic-trouble,项目名称:snake,代码行数:9,代码来源:Board.cpp

示例7: findAll

PointList Board::findAll(Element el) const {
	PointList rslt;
	for (auto i = 0; i < size*size; ++i) {
		Point pt = xyl.getXY(i);
		if (isAt(pt.getX(), pt.getY(), el)) {
			rslt.push_back(pt);
		}
	}
	return rslt;
}
开发者ID:vic-trouble,项目名称:snake,代码行数:10,代码来源:Board.cpp

示例8: getFutureBlasts

PointList Board::getFutureBlasts() const {
	PointList bombs = getBombs();
	bombs.splice(bombs.end(), findAll(Element(LL("OTHER_BOMB_BOMBERMAN"))));
	bombs.splice(bombs.end(), findAll(Element(LL("BOMB_BOMBERMAN"))));

	PointList rslt;
	PointList walls = getWalls();
	for (auto bmb : bombs) {
		rslt.push_back(bmb);
		PointList bombSurrs = bmb.getSurrounds(size);
		for (auto surr : bombSurrs) {
			if (std::find(walls.begin(), walls.end(), surr) == walls.end()) {
				rslt.push_back(surr);
			}
		}
	}

	return removeDuplicates(rslt);
}
开发者ID:vic-trouble,项目名称:snake,代码行数:19,代码来源:Board.cpp

示例9: drawPolygon

//-----------------------------------------------------------------------------
void CDrawContext::drawPolygon (const CPoint* pPoints, int32_t numberOfPoints, const CDrawStyle drawStyle)
{
	assert (numberOfPoints < 0);
	PointList list (static_cast<uint32_t> (numberOfPoints));
	for (int32_t i = 0; i < numberOfPoints; i++)
	{
		list.push_back (pPoints[i]);
	}
	drawPolygon (list, drawStyle);
}
开发者ID:UIKit0,项目名称:vstgui,代码行数:11,代码来源:cdrawcontext.cpp

示例10: getNeighbors

PointList Planner::getNeighbors(GridPoint p, bool diagonal) const
{
	PointList neighbors;
	GridPoint n;
	
	n.x = p.x-1 ; n.y = p.y   ; neighbors.push_back(n);
	n.x = p.x   ; n.y = p.y-1 ; neighbors.push_back(n);
	n.x = p.x+1 ; n.y = p.y   ; neighbors.push_back(n);
	n.x = p.x   ; n.y = p.y+1 ; neighbors.push_back(n);
	
	if(diagonal)
	{
		n.x = p.x-1 ; n.y = p.y-1 ; neighbors.push_back(n);
		n.x = p.x-1 ; n.y = p.y+1 ; neighbors.push_back(n);
		n.x = p.x+1 ; n.y = p.y-1 ; neighbors.push_back(n);
		n.x = p.x+1 ; n.y = p.y+1 ; neighbors.push_back(n);
	}
	return neighbors;
}
开发者ID:rock-planning,项目名称:planning-exploration,代码行数:19,代码来源:Planner.cpp

示例11: handleDual

void handleDual(Segment_2 s, std::vector<PointList>& polylines)
{
        Point_2 ss = s.source();
        Point_2 st = s.target();
        std::cerr << "segment " << ss << " " << st << std::endl; // str << s;
        PointList points;
        points.push_back(ss);
        points.push_back(st);
        polylines.push_back(points);
}
开发者ID:AmbatiRao,项目名称:swp12,代码行数:10,代码来源:create_polygons.cpp

示例12: copyVertexListToPointList

// copyVertexListToPointList a vector for Vec3 into a vector of Point's.
void copyVertexListToPointList(const VertexList& in,PointList& out)
{
    out.reserve(in.size());
    for(VertexList::const_iterator itr=in.begin();
        itr!=in.end();
        ++itr)
    {
        out.push_back(Point(0,*itr));
    }
}
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:11,代码来源:ShadowVolumeOccluder.cpp

示例13: get_height_locked

void SplineTrack::get_height_locked(PointList& output) const
{
   for (int x = min(0, delta.x); x <= max(0, delta.x) + 1; x++) {
      for (int y = min(0, delta.y); y <= max(0, delta.y) + 1; y++) {

         PointI p = make_point(x, y);
         if (point_in_polygon(bounds, point_cast<float>(p)))
            output.push_back(p + origin);
      }
   }
}
开发者ID:ChuanonlyGame,项目名称:traingame,代码行数:11,代码来源:SplineTrack.cpp

示例14: clip

// clip the convex hull 'in' to plane to generate a clipped convex hull 'out'
// return true if points remain after clipping.
unsigned int clip(const Plane& plane,const PointList& in, PointList& out,unsigned int planeMask)
{
    std::vector<float> distance;
    distance.reserve(in.size());
    for(PointList::const_iterator itr=in.begin();
        itr!=in.end();
        ++itr)
    {
        distance.push_back(plane.distance(itr->second));
    }

    out.clear();

    for(unsigned int i=0;i<in.size();++i)
    {
        unsigned int i_1 = (i+1)%in.size(); // do the mod to wrap the index round back to the start.
        
        if (distance[i]>=0.0f)
        {
            out.push_back(in[i]);
            
            
            if (distance[i_1]<0.0f)
            {
                unsigned int mask = (in[i].first & in[i_1].first) | planeMask;
                float r = distance[i_1]/(distance[i_1]-distance[i]);
                out.push_back(Point(mask,in[i].second*r+in[i_1].second*(1.0f-r)));
            }
        
        }
        else if (distance[i_1]>0.0f)
        {
            unsigned int mask = (in[i].first & in[i_1].first) | planeMask;
            float r = distance[i_1]/(distance[i_1]-distance[i]);
            out.push_back(Point(mask,in[i].second*r+in[i_1].second*(1.0f-r)));
        }
    }
    
    return out.size();
}
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:42,代码来源:ShadowVolumeOccluder.cpp

示例15: readTotalstationSurveyFile

ScreenCalibrator::PointList ScreenCalibrator::readTotalstationSurveyFile(const char* fileName,const char* tag) const
	{
	/* Open the CSV input file: */
	IO::TokenSource tok(Vrui::openFile(fileName));
	tok.setPunctuation(",\n");
	tok.setQuotes("\"");
	tok.skipWs();
	
	/* Read point records until the end of file: */
	PointList result;
	unsigned int line=2;
	while(!tok.eof())
		{
		/* Read the point coordinates: */
		Point p;
		for(int i=0;i<3;++i)
			{
			if(i>0)
				{
				tok.readNextToken();
				if(!tok.isToken(","))
					Misc::throwStdErr("MeasureEnvironment::MeasureEnvironment: Format error in input file %s",fileName);
				}
			p[i]=Scalar(atof(tok.readNextToken()));
			}
			
		tok.readNextToken();
		if(!tok.isToken(","))
			Misc::throwStdErr("MeasureEnvironment::MeasureEnvironment: Format error in input file %s",fileName);
		
		/* Read the point tag: */
		tok.readNextToken();
		if(tok.isCaseToken(tag))
			{
			/* Store the point: */
			result.push_back(p);
			}
		
		tok.readNextToken();
		if(!tok.isToken("\n"))
			Misc::throwStdErr("MeasureEnvironment::MeasureEnvironment: Format error in input file %s",fileName);
		
		++line;
		}
	
	/* Cull duplicate points from the point list: */
	size_t numDupes=cullDuplicates(result,Scalar(0.05));
	if(numDupes>0)
		std::cout<<"ScreenCalibrator::readTotalstationSurveyFile: "<<numDupes<<" duplicate points culled from input file"<<std::endl;
	
	return result;
	}
开发者ID:jrevote,项目名称:Vrui,代码行数:52,代码来源:ScreenCalibrator.cpp


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