//============================================================== tensor EightNode_Brick_u_p::getGaussPts(void) { int dimensions1[] = {Num_TotalGaussPts,Num_Dim}; tensor Gs(2, dimensions1, 0.0); int dimensions2[] = {Num_Nodes}; tensor shp(1, dimensions2, 0.0); double r = 0.0; double s = 0.0; double t = 0.0; int i, j, where; int GP_c_r, GP_c_s, GP_c_t; for( GP_c_r = 0 ; GP_c_r < Num_IntegrationPts; GP_c_r++ ) { r = pts[GP_c_r]; for( GP_c_s = 0 ; GP_c_s < Num_IntegrationPts; GP_c_s++ ) { s = pts[GP_c_s]; for( GP_c_t = 0 ; GP_c_t < Num_IntegrationPts; GP_c_t++ ) { t = pts[GP_c_t]; where = (GP_c_r*Num_IntegrationPts+GP_c_s)*Num_IntegrationPts+GP_c_t; shp = shapeFunction(r,s,t); for (i=0; i<Num_Nodes; i++) { const Vector& T_Crds = theNodes[i]->getCrds(); for (j=0; j<Num_Dim; j++) { Gs.val(where+1, j+1) += shp.cval(i+1) * T_Crds(j); } } } } } return Gs; }
int main() { int n; cout << " Input number of basic points: "; cin >> n; Extpair p(0,100),shp(280,330); bpoint bp(0,0,.5,0,0,.5); matrix rotr(cos(2*PI/n),-sin(2*PI/n),sin(2*PI/n),cos(2*PI/n)); int psize=n; fractal f,g; (f.basicpoints).clear(); (g.basicpoints).clear(); for(int i=0; i<psize; i++) { bp.point=p+shp; (f.basicpoints).push_back(bp); p=rotr.MultRow(p); } //vector< vector<bpoint> > memofr; //memofr.clear(); f.build(10); vector<fractal> input; input.push_back(f); input.push_back(f); input.push_back(f); input.push_back(f); //printtops_out(input,.000001); f.writetops(.000001); //f.writetops_int(.000001); }
const Shape & shapeWithRotation(ShapeType type, size_t rotation) { static std::map<ShapeType, std::vector<Shape>> allShapes_s; if (! allShapes_s.size()) { Shape shp(1,1); // To initialize shapes, we abuse the structure a bit by creating a map // of the segment indexes + 1 where the ShapeType would usually be. // The genShapes function will transform this into a valid shape // with proper tile data. shp = { { 0,0,0,0 }, { 1,2,3,0 }, { 0,4,0,0 }, { 0,0,0,0 } }; allShapes_s.insert(genShapes(ShapeType::TBone, shp, 1, 1, 4)); shp = { { 0,0,0,0 }, { 1,2,3,0 }, { 0,0,4,0 }, { 0,0,0,0 } }; allShapes_s.insert(genShapes(ShapeType::RightHook, shp, 1, 1, 4)); shp = { { 0,0,0,0 }, { 1,2,0,0 }, { 0,3,4,0 }, { 0,0,0,0 } }; allShapes_s.insert(genShapes(ShapeType::LeftStair, shp, 0, 0, 2)); shp = { { 0,0,0,0 }, { 0,1,2,0 }, { 0,3,4,0 }, { 0,0,0,0 } }; allShapes_s.insert(genShapes(ShapeType::Square, shp, 0, 0, 1)); shp = { { 0,0,0,0 }, { 0,3,4,0 }, { 1,2,0,0 }, { 0,0,0,0 } }; allShapes_s.insert(genShapes(ShapeType::RightStair, shp, 0, 0, 2)); shp = { { 0,0,0,0 }, { 2,3,4,0 }, { 1,0,0,0 }, { 0,0,0,0 } }; allShapes_s.insert(genShapes(ShapeType::LeftHook, shp, 1, 1, 4)); shp = { { 0,0,0,0 }, { 1,2,3,4 }, { 0,0,0,0 }, { 0,0,0,0 } }; allShapes_s.insert(genShapes(ShapeType::Bar, shp, 0, 0, 2)); } auto & rsv = allShapes_s.at(type); return rsv.at(rotation % rsv.size()); }
void CVContourDetail::searchFile() { QString uri = QFileDialog::getOpenFileName( this, tr("Importa contorno regione"), Core::CVSettings::get(CV_PATH_SEARCH).toString(), "(*.shp)" ); if (!uri.isEmpty()) { QFileInfo shp(uri); Core::CVSettings::set(CV_PATH_SEARCH, shp.absolutePath()); importAll(QStringList() << shp.absolutePath() + QDir::separator() + shp.baseName()); } }
void Sprite::show() { SprExt *e; e = _ext; e->_x0 = e->_x1; e->_y0 = e->_y1; e->_b0 = e->_b1; e->_x1 = _x; e->_y1 = _y; e->_b1 = shp(); if (!_flags._hide) { if (_flags._xlat) e->_b1->xShow(e->_x1, e->_y1); else e->_b1->show(e->_x1, e->_y1); } }
void Map::draw(sf::RenderTarget &_target, sf::RenderStates _states) const { sf::CircleShape shp(25, 6); shp.setOutlineThickness(2.0f); shp.setOutlineColor(sf::Color::White); const double radius = std::ceil(std::sqrt(3) * 25); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { auto &place = fields[i][j]; shp.setPosition(hex_position(radius, i, j)); int r = 255, g = 255, b = 255, a = 255, k = -1; if (agent_view) { k = agent_view->know_of(Vec2(i, j)); a = (k > 0) * 155 + 100; if (k) { r = 176; g = 226; b = 255; } } if (k == 4) { shp.setFillColor(sf::Color(220, 220, 220, 255)); } if (k == 3) { shp.setFillColor(sf::Color(173, 255, 47, 255)); } else if (k == 2) { shp.setFillColor(sf::Color(255, 140, 0, 255)); } else if (place == Field::Blocked) { shp.setFillColor(sf::Color(190, 190, 190, a)); } else if (place == Field::Empty) { shp.setFillColor(sf::Color(r, g, b, a)); } else if (place == Field::Food) { shp.setFillColor(sf::Color(106, 196, 49, a)); } else if (place == Field::Danger) { shp.setFillColor(sf::Color(224, 38, 38, a)); } else if (place == Field::Water) { shp.setFillColor(sf::Color(49, 123, 196, a)); } else if (place == Field::Population) { shp.setFillColor(sf::Color(176, 86, 232, a)); } _target.draw(shp, _states); } } }
void Sprite::show(uint16 pg) { Graphics::Surface *a = _vga->_page[1]; _vga->_page[1] = _vga->_page[pg & 3]; shp()->show(_x, _y); _vga->_page[1] = a; }