本文整理汇总了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));
}
示例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();
}
示例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));
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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));
}
}
示例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);
}
}
}
示例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();
}
示例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;
}