bool CanPass(TMap const & map, Cell const & start, Direction const dir) { Cell finish = start.GetNeibor(dir); if (!IsValidCell(map, finish)) return false; if (IsDirectionOpen(GetCellType(map, start), dir) && IsDirectionOpen(GetCellType(map, finish), GetOppositeDirection(dir))) return true; return false; }
void Highlighter::highlightCells() { assert(m_renderer && m_selection.visualization && !m_selection.indices.empty()); auto dataSet = m_selection.visualization->colorMappingInputData(m_selection.visOutputPort); if (!dataSet) { return; } const auto index = m_selection.indices.front(); // extract picked triangle and create highlighting geometry // create two shifted polygons to work around occlusion auto selection = dataSet->GetCell(index); // this is probably a glyph or the like; we don't have an implementation for that in the moment if (!selection || selection->GetCellType() == VTK_VOXEL) { return; } m_impl->highlightCell(*selection); emit geometryChanged(); }
int Map::GetNumOfTypeInOrthogonal(int x,int y,int radius,CellType type) { int numOfTypes = 0; for(int sx = x - radius; sx <= x + radius; sx++) { if( (sx != x) && GetCellType(sx,y) == type ) numOfTypes++; } for(int sy = y - radius; sy <= y + radius; sy++) { if( (sy != y) && GetCellType(x,sy) == type ) numOfTypes++; } return numOfTypes; }
bool IsStraight(Car const & car, std::vector<Cell> const & path, int N, Game const & game, World const & world) { bool bStrait = false; if (path.size() >= N + 1) { double target4X = (path[N].m_x + 0.5) * game.getTrackTileSize(); double target4Y = (path[N].m_y + 0.5) * game.getTrackTileSize(); if (car.getAngleTo(target4X, target4Y) < 20*PI/180) { bStrait = true; TileType curType = GetCellType(world.getTilesXY(), GetCell(car, game)); for (size_t i =1; i < N; ++i) if (curType != GetCellType(world.getTilesXY(), path[i])) bStrait = false; } } return bStrait; }
Vec2i Map::GetDirectionOfTypeInOrthogonal(int x,int y,int radius,CellType type) { Vec2i direction(0,0); for(int sx = x - radius; sx <= x + radius; sx++) { if( (sx != x) && GetCellType(sx,y) == type ) return direction = Vec2i(sx-x,0); } for(int sy = y - radius; sy <= y + radius; sy++) { if( (sy != y) && GetCellType(x,sy) == type ) return Vec2i(0,sy-y); } return direction; }
int Map::GetNumOfTypeNearBy(int x,int y,int radius,CellType type) { int numOfTypes = 0; for(int sx = x - radius; sx <= x + radius; sx++) { for(int sy = y - radius; sy <= y + radius; sy++) { if( (sx != x && sy != y) && GetCellType(sx,sy) == type ) numOfTypes++; } } return numOfTypes; }
void VtkMappedMeshImpl::GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) { const MeshLib::Element* const elem = (*_elements)[cellId]; const unsigned numNodes(elem->getNNodes()); const MeshLib::Node* const* nodes = (*_elements)[cellId]->getNodes(); ptIds->SetNumberOfIds(numNodes); for (unsigned i(0); i < numNodes; ++i) ptIds->SetId(i, nodes[i]->getID()); if(GetCellType(cellId) == VTK_WEDGE) { for (unsigned i=0; i<3; ++i) { const unsigned prism_swap_id = ptIds->GetId(i); ptIds->SetId(i, ptIds->GetId(i+3)); ptIds->SetId(i+3, prism_swap_id); } } else if(GetCellType(cellId) == VTK_QUADRATIC_WEDGE) { std::array<vtkIdType, 15> ogs_nodeIds; for (unsigned i=0; i<15; ++i) ogs_nodeIds[i] = ptIds->GetId(i); for (unsigned i=0; i<3; ++i) { ptIds->SetId(i, ogs_nodeIds[i+3]); ptIds->SetId(i+3, ogs_nodeIds[i]); } for (unsigned i=0; i<3; ++i) ptIds->SetId(6+i, ogs_nodeIds[8-i]); for (unsigned i=0; i<3; ++i) ptIds->SetId(9+i, ogs_nodeIds[14-i]); ptIds->SetId(12, ogs_nodeIds[9]); ptIds->SetId(13, ogs_nodeIds[11]); ptIds->SetId(14, ogs_nodeIds[10]); } }
bool Document::ContainsCode(Address const& rAddress) const { return GetCellType(rAddress) == Cell::InstructionType; }