本文整理汇总了C++中PointList类的典型用法代码示例。如果您正苦于以下问题:C++ PointList类的具体用法?C++ PointList怎么用?C++ PointList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PointList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GridMap
FrontierList Planner::getFrontiers(GridMap* map, GridPoint start)
{
// Initialization
mFrontierCellCount = 0;
mFrontierCount = 0;
GridMap plan = GridMap(map->getWidth(), map->getHeight());
FrontierList result;
// Initialize the queue with the robot position
Queue queue;
queue.insert(Entry(0, start));
plan.setData(start, VISIBLE);
// Do full search with weightless Dijkstra-Algorithm
while(!queue.empty())
{
// Get the nearest cell from the queue
Queue::iterator next = queue.begin();
int distance = next->first;
GridPoint point = next->second;
queue.erase(next);
// Add neighbors
bool isFrontier = false;
PointList neighbors = getNeighbors(point, false);
char c = 0;
for(PointList::const_iterator cell = neighbors.begin(); cell < neighbors.end(); cell++)
{
if(map->getData(*cell,c) && c == UNKNOWN)
{
plan.setData(*cell, OBSTACLE);
isFrontier = true;
break;
}
if(map->getData(*cell, c) && c == VISIBLE &&
plan.getData(*cell, c) && c == UNKNOWN)
{
queue.insert(Entry(distance+1, *cell));
plan.setData(*cell, VISIBLE);
}
}
if(isFrontier)
{
result.push_back(getFrontier(map, &plan, point));
}
}
// Set result message and return the point list
if(result.size() > 0)
{
mStatus = SUCCESS;
sprintf(mStatusMessage, "Found %d frontiers with %d frontier cells.", mFrontierCount, mFrontierCellCount);
}else
{
mStatus = NO_GOAL;
sprintf(mStatusMessage, "No reachable frontiers found.");
}
return result;
}
示例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: slidePiece
void Puzzle::slidePiece(int x1, int y1, int x2, int y2) {
int count;
PointList slidePoints;
slidePoints.resize(320);
x1 += _pieceInfo[_puzzlePiece].offX;
y1 += _pieceInfo[_puzzlePiece].offY;
count = pathLine(slidePoints, 0, Point(x1, y1),
Point(x2 + _pieceInfo[_puzzlePiece].offX, y2 + _pieceInfo[_puzzlePiece].offY));
if (count > 1) {
int factor = count / 4;
_sliding = true;
if (!factor)
factor++;
for (int i = 1; i < count; i += factor) {
_slidePointX = slidePoints[i].x;
_slidePointY = slidePoints[i].y;
_vm->_render->drawScene();
_vm->_system->delayMillis(10);
}
_sliding = false;
}
_pieceInfo[_puzzlePiece].curX = x2;
_pieceInfo[_puzzlePiece].curY = y2;
}
示例4: getOtherBombermans
PointList Board::getOtherBombermans() const {
PointList rslt;
rslt.splice(rslt.end(), findAll(Element(LL("OTHER_BOMBERMAN"))));
rslt.splice(rslt.end(), findAll(Element(LL("OTHER_BOMB_BOMBERMAN"))));
rslt.splice(rslt.end(), findAll(Element(LL("OTHER_DEAD_BOMBERMAN"))));
return rslt;
}
示例5: ShootRay
Vector ShootRay (Reta R, double Relative) {
PointList *P;
Point *hit;
Vector Target;
Vector color;
Vector Normal;
Vector Zero (0,0,0);
Reta S;
if (Relative<reflection)
return Zero;
RaysShooted++;
P=new PointList;
scene->Intersect (R,P);
hit=P->First ();
if (hit!=NULL) {
Target=R.O+R.R*hit->t;
Normal=hit->owner->Normal (Target);
color=lightlist->Shade (Target,Normal,scene);
delete P;
if (hit->owner->surface->GetKs()!=0.0) {
S.O=Target+Normal*epsilon;
S.R=R.R-Normal*(R.R*Normal)*2.0;
return
hit->owner->surface->Apply
(color,ShootRay (S,Relative*hit->owner->surface->GetKs()));
}
else
return hit->owner->surface->Apply (color,Zero);
}
else {
delete P;
return Zero;
}
}
示例6: analyze
double AverageIgnoreNullAnalysis::analyze(const PointList &values) const
{
if(values.isEmpty())
{
return 0;
}
const double sum = AbstractAnalysis::listSum(values);
int length = 0;
foreach(const Point value, values.points())
{
if(value != 0)
{
length++;
}
}
if(length == 0)
{
return 0.0;
}
const double result = sum / static_cast<double>(length);
return result;
}
示例7: draw_hand_trace
void draw_hand_trace(sf::RenderWindow& window,
const PointList& pointList,
const sf::Color& color,
const float depthScale)
{
if (pointList.size() < 2) { return; }
const float thickness = 4;
auto it = pointList.begin();
astra::Vector2i previousPoint = *it;
while (it != pointList.end())
{
const astra::Vector2i currentPoint = *it;
++it;
const sf::Vector2f p1((previousPoint.x + .5f) * depthScale,
(previousPoint.y + .5f) * depthScale);
const sf::Vector2f p2((currentPoint.x + .5f) * depthScale,
(currentPoint.y + .5f) * depthScale);
previousPoint = currentPoint;
window.draw(sfLine(p1, p2, color, thickness));
}
}
示例8:
void Dataset<D, ELEM_TYPE>::load(const PointList& newPoints)
{
// Pre-allocate memory in one sys call
m_points.reserve(m_points.size() + newPoints.size());
// Append given points to end of current point list
m_points.insert(m_points.end(), newPoints.begin(), newPoints.end());
}
示例9: RenderCallback
void RenderCallback()
{
// Clear buffers
glClearColor(1.0f,1.0f,1.0f,1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPointSize(1.0);
glColor3f(0,0,0);
glLineWidth(2.0f);
int i, j;
glBegin(GL_LINES);
//渲染凸多边形P
for( i = gN - 1, j = 0 ; j < gN ; i = j, j += 1 )
{
glVertex2f(gP[i].x,gP[i].y);
glVertex2f(gP[j].x,gP[j].y);
}
//渲染凸多边形Q
for( i = gM - 1, j = 0 ; j < gM ; i = j, j += 1 )
{
glVertex2f(gQ[i].x,gQ[i].y);
glVertex2f(gQ[j].x,gQ[j].y);
}
PointList::iterator it;
for( it = gInterList.begin() ; it != gInterList.end() ; it ++ )
{
glVertex2f((*it).x,(*it).y - 20);
glVertex2f((*it).x,(*it).y + 20);
}
glEnd();
glutSwapBuffers();
}
示例10: copy_block
bool copy_block(Tile* tiles, const Block* block) {
const p2i& p = block->position;
int xp = (p.x - START_X + SQUARE_SIZE / 2) / SQUARE_SIZE;
int yp = (p.y - START_Y + SQUARE_SIZE / 2) / SQUARE_SIZE;
if (is_block_available(tiles, xp, yp)) {
for (int i = 0; i < 4; ++i) {
int cx = xp + MARK_STEPS[i * 2];
int cy = yp + MARK_STEPS[i * 2 + 1];
uint32_t idx = get_tiles_index(cx, cy);
Tile& t = tiles[idx];
t.state.set(BIT_MARKED);
t.color = block->colors[i];
PointList list;
check(tiles, cx, cy, -1, list, true);
list.add(cx, cy);
if (list.size() > 2) {
//LOG << "connected";
t.state.set(BIT_COHERENT);
for (size_t j = 0; j < list.size(); ++j) {
const p2i& p = list.get(j);
//LOG << j << " = " << p.x << " " << p.y;
set_state(tiles, p.x, p.y, BIT_COHERENT);
}
}
}
determineEdges(tiles);
return true;
}
else {
//LOG << "Block is not available";
}
return false;
}
示例11: vectorFromEigenArray
T_Point vectorFromEigenArray(const PointList& array)
{
T_Point res;
for(int i =0;i<array.cols();++i)
res.push_back(array.col(i));
return res;
}
示例12: isIntersectsPointPolygon
bool CollisionManager::isIntersectsPointPolygon(ICollisionHull* point, ICollisionHull* polygon)
{
PointCollisionHull* pointCH = dynamic_cast<PointCollisionHull*>(point);
PoligonCollisionHull* poligonCH = dynamic_cast<PoligonCollisionHull*>(polygon);
Vector3 position = pointCH->getPosition();
PointList points = poligonCH->getPoints();
int i0, i1;
float A, B, C, D;
Vector3 P0, P1;
for(int i = 0; i < points.size(); i++)
{
i0 = i;
i1 = (i == (points.size() - 1)) ? 0 : i + 1;
P0 = points[i0];
P1 = points[i1];
A = P0._y - P1._y;
B = P1._x - P0._x;
C = (P0._x * P1._y) - (P1._x * P0._y);
D = (A * position._x) + (B * position._y) + C;
if(D > 0)
{
return false;
}
}
return true;
}
示例13: 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));
}
示例14: willBeExplored
void Planner::addReading(Pose p)
{
PointList points = willBeExplored(p);
for(PointList::iterator i = points.begin(); i < points.end(); ++i)
{
mCoverageMap->setData(*i, VISIBLE);
}
}
示例15: setCoverageMap
void Planner::setCoverageMap(PointList points, char value)
{
PointList::iterator i;
for(i = points.begin(); i < points.end(); i++)
{
mCoverageMap->setData(*i, value);
}
}