const Circle Circle::operator++() { setRadius(radius() + 1); return *this; }
CrawlerUnit::CrawlerUnit(AI *ai) : DefenseUnit(ai) { setRadius(1); setArmor(3); setCost(7); }
Sphere::Sphere(Vector3& center, float radius) { setCenter(center); setRadius(radius); updateBoundingBox(); }
MineUnit::MineUnit(AI *ai) : DefenseUnit(ai) { setRadius(80); setArmor(1); setCost(3); }
BridgeUnit::BridgeUnit(AI *ai) : DefenseUnit(ai) { setRadius(1); setArmor(3); setCost(1); }
Bullet::Bullet() { setRadius(4); setName("bullet"); }
AntiAirUnit::AntiAirUnit(AI *ai) : DefenseUnit(ai) { setRadius(190); setArmor(3); setCost(1); }
void OsiCircle::setCircle ( const CvPoint & rCenter , int rRadius ) { setCenter(rCenter) ; setRadius(rRadius) ; }
void radarStateClass::update(sf::RenderWindow& window) { sf::Event event; while(window.pollEvent(event)) { if(event.type == sf::Event::Closed) { window.close(); return; } else if(event.type == sf::Event::KeyPressed) { if(event.key.code == sf::Keyboard::Tab) { stopScan(); global::activeGameStateStack->pop(); return; } } } ++currentFrame; if(currentFrame > numberOfWaitFrame) { currentFrame = 0; } if(currentFrame == 0) { for(auto circleIte = listOfCircle.begin(); circleIte != listOfCircle.end(); ) { if(circleIte->getOutlineThickness() < maxThickness) { circleIte->setOutlineThickness(circleIte->getOutlineThickness() + 1); if(circleIte->getOutlineThickness() >= maxThickness) { circleIte->setFillColor(sf::Color::Transparent); } } else { circleIte->setRadius(circleIte->getRadius() + 0.1); } if(circleIte->getRadius() > maxRadius) { listOfCircle.erase(circleIte++); continue; } circleIte->setOrigin(circleIte->getRadius(), circleIte->getRadius()); ++circleIte; } } if(scannerTimer.getElapsedTime().asSeconds() > timeBetweenScan && inScan == false) { startScan(); } if(inScan == true) { moveScannerAndScan(); } global::activeGameStateStack->oldUpdate(window); }
Circle Circle::operator=(double d) { setRadius(d); return *this; }
void Circle::makeResize(bool isIncrease) { double radius = getRadius(); radius += isIncrease ? 1.0f : -1.0f; setRadius(radius); }
const Circle Circle::operator+=(const Circle& c) { setRadius(radius() + c.radius()); return *this; }
const Circle Circle::operator+=(double d) { setRadius(radius() + d); return *this; }
const Circle Circle::operator++(int dummy) { Circle temp=*this; setRadius(radius() + 1); return temp; }
/* @param x, y, radius value @inherits from Point2D sets the value of radius */ Circle::Circle(int x, int y, double radiusValue) :Point2D(x, y){ setRadius(radiusValue); }
void CrossfallEditorTool::initToolWidget() { QGridLayout *toolLayout = new QGridLayout; // ButtonGroup // // // A button group so only one button can be checked at a time QButtonGroup *toolGroup = new QButtonGroup; connect(toolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int))); // Tools // // QPushButton *toolButton; int row = -1; // button row toolButton = new QPushButton(tr("Select")); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TCF_SELECT); // button, id toolButton->setChecked(true); // toolButton = new QPushButton(tr("Move Section")); // toolButton->setCheckable(true); // toolLayout->addWidget(toolButton, ++row, 0); // toolGroup->addButton(toolButton, ODD::TCF_MOVE); // button, id toolButton = new QPushButton(tr("Add Section")); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TCF_ADD); // button, id toolButton = new QPushButton(tr("Del Section")); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TCF_DEL); // button, id QLabel *radiusLabel = new QLabel("Smooth Radius:"); radiusEdit_ = new QDoubleSpinBox(); radiusEdit_->setAlignment(Qt::AlignRight | Qt::AlignVCenter); radiusEdit_->setRange(0.01, 1000000.0); radiusEdit_->setValue(2000.0); radiusEdit_->setMinimumWidth(80.0); radiusEdit_->setMaximumWidth(80.0); toolLayout->addWidget(radiusLabel, ++row, 0); toolLayout->addWidget(radiusEdit_, ++row, 0); connect(radiusEdit_, SIGNAL(editingFinished()), this, SLOT(setRadius())); // Finish Layout // // toolLayout->setRowStretch(++row, 1); // row 3 fills the rest of the availlable space toolLayout->setColumnStretch(1, 1); // column 1 fills the rest of the availlable space // Widget/Layout // // ToolWidget *toolWidget = new ToolWidget(); toolWidget->setLayout(toolLayout); toolManager_->addToolBoxWidget(toolWidget, tr("Crossfall Editor")); connect(toolWidget, SIGNAL(activated()), this, SLOT(activateEditor())); // Ribbon // // ToolWidget *ribbonWidget = new ToolWidget(); //ribbonWidget-> Ui::CrossfallRibbon *ui = new Ui::CrossfallRibbon(); ui->setupUi(ribbonWidget); QButtonGroup *ribbonToolGroup = new QButtonGroup; connect(ribbonToolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int))); ribbonToolGroup->addButton(ui->crossfallSelect, ODD::TSE_SELECT); ribbonToolGroup->addButton(ui->crossfallAdd, ODD::TSE_ADD); ribbonToolGroup->addButton(ui->crossfallDelete, ODD::TSE_DEL); //ribbonToolGroup->addButton(ui->elevationSmooth, ODD::TSE_SMOOTH); connect(ui->radiusEdit, SIGNAL(editingFinished()), this, SLOT(setRadius())); toolManager_->addRibbonWidget(ribbonWidget, tr("Crossfall")); connect(ribbonWidget, SIGNAL(activated()), this, SLOT(activateEditor())); }
Particle::Particle(Particle &p) { init(p.getPosition(), p._mass, p._drag); _isFixed = p._isFixed; setBounce(p._bounce); setRadius(p._radius); }
// copied from openframeworks superfast blur and modified void applyTo(QImage &mask, const QColor &color, int radius) { if (radius < 1 || mask.isNull()) return; setSize(mask.size()); setRadius(radius); const int w = s.width(); const int h = s.height(); uchar *a = valpha.data(); const uchar *inv = vinv.constData(); int *min = vmin.data(); int *max = vmax.data(); const int xmax = mask.width()-1; for (int x=0; x<w; ++x) { min[x] = qMin(x + radius + 1, xmax); max[x] = qMax(x - radius, 0); } const uchar *c_bits = mask.constBits()+3; uchar *it = a; for (int y=0; y<h; ++y, c_bits += (mask.width() << 2)) { int sum = 0; for(int i=-radius; i<=radius; ++i) sum += c_bits[qBound(0, i, xmax) << 2]; for (int x=0; x<w; ++x, ++it) { sum += c_bits[min[x] << 2]; sum -= c_bits[max[x] << 2]; *it = inv[sum]; } } const int ymax = mask.height()-1; for (int y=0; y<h; ++y){ min[y] = qMin(y + radius + 1, ymax)*w; max[y] = qMax(y - radius, 0)*w; } uchar *bits = mask.bits(); const double coef = color.alphaF(); const double r = color.redF()*coef; const double g = color.greenF()*coef; const double b = color.blueF()*coef; const uchar *c_it = a; for (int x=0; x<w; ++x, ++c_it){ int sum = 0; int yp = -radius*w; for(int i=-radius; i<=radius; ++i, yp += w) sum += c_it[qMax(0, yp)]; uchar *p = bits + (x << 2); for (int y=0; y<h; ++y, p += (xmax << 2)){ const uchar a = inv[sum]; if (p[3] < 255) { *p++ = a*b; *p++ = a*g; *p++ = a*r; *p++ = a*coef; } else { p += 4; } sum += c_it[min[y]]; sum -= c_it[max[y]]; } } }
void Pathway::setPathway(std::size_t numOfPoints, vec_type const points[], float r, bool closedCycle) { path_.setPath(numOfPoints, points, closedCycle); setRadius(r); }
Cylinder::Cylinder(){ setRadius(1); setHeight(1); }
ShieldUnit::ShieldUnit(AI *ai) : DefenseUnit(ai) { setRadius(170); setArmor(3); setCost(7); }
Cylinder::Cylinder(double radius, double height) { setRadius(radius); setHeight(height); }
TowerUnit::TowerUnit(AI *ai) : DefenseUnit(ai) { setRadius(1); setArmor(3); setCost(1); }
f2CircleShape::f2CircleShape(float32 radius) { init(1.0f); setRadius(radius); }
EnergyUnit::EnergyUnit(AI *ai) : DefenseUnit(ai) { setRadius(1); setArmor(5); setCost(7); }
// Other methods void Particle::update(){ // main method that controls all necessary movement // attraction and repulsion float dy = (ofGetWindowHeight() - ofGetMouseY()) - getY(); float dx = ofGetMouseX() - getX(); if (getAttract() && !getRepel()){ float desired = atan2(dy,dx); float angdiff = desired-getAngle(); if ((angdiff > 0 && abs(angdiff) <= PI) || (angdiff < 0 && abs(angdiff) > PI)){ setAngle(getAngle() + getAlpha()); } else if ((angdiff > 0 && abs(angdiff)>PI) || (angdiff < 0 && abs(angdiff) <= PI)){ setAngle(getAngle() - getAlpha()); } // if (desired+getAlpha()>getAngle() && desired-getAlpha()<getAngle()){ // setSpeed(getSpeed()+getFlow()); // } // else { // if (getSpeed()>ORBITAL_FACTOR*getFlow()){ // setSpeed(getSpeed()-getFlow()); // } // } } else if (getRepel() && !getAttract() && sqrt(pow(dy,2) + pow(dx,2)) <= BARRIER){ float desired = atan2(dy,dx) > 0 ? atan2(dy,dx) - PI : atan2(dy,dx) + PI; float angdiff = desired - getAngle(); if ((angdiff > 0 && abs(angdiff) <= PI) || (angdiff < 0 && abs(angdiff) > PI)){ setAngle(getAngle() + getAlpha()); } else if ((angdiff > 0 && abs(angdiff) > PI) || (angdiff < 0 && abs(angdiff) <= PI)){ setAngle(getAngle() - getAlpha()); } // if (desired+getAlpha()>getAngle() && desired-getAlpha()<getAngle()){ // setSpeed(getSpeed()+getFlow()); // } // else { // if (getSpeed()>ORBITAL_FACTOR*getFlow()){ // setSpeed(getSpeed()-getFlow()); // } // } } else if (getAttract() && getRepel()){ if (getSpeed() > 0){ setSpeed(getSpeed() - getFlow()); } } // life if (getAlive()){ setAngle(getAngle() + ofRandomf() * getAlpha()); setSpeed(getSpeed() + ofRandomf() * getFlow()); setRadius(getRadius() + ofRandomf() * RADIUS_NOISE); } // bounds if (getX() > ofGetWindowWidth() - getRadius() || getX() < getRadius()){ setAngle(-getAngle() + PI); } if (getY() > ofGetWindowHeight() - getRadius() || getY() < getRadius()){ setAngle(-getAngle()); } // position + motion position += velocity; // color float r = getAttract() && getRepel() ? getColor().r + 1 : (getSpeed()/MAX_SPEED) * 255; float g = getAttract() ? getColor().g + 1 : (getY()/ofGetWindowHeight()) * 255; float b = getRepel() ? getColor().b + 1 : (1-getY()/ofGetWindowHeight()) * 255; setColor(r,g,b); }
Cheerio::Cheerio() : StaticObject(){ setRadius(0.6f); };
bool Circle::setCircle( const Vector2D &pos, float dR ){ setCenter( pos ); return setRadius( dR ); }
Particle::Particle(Point pos, double m) :position(pos),velocity(0,0), mass(m), radius(setRadius()) { }
PieChart1::PieChart1(float radius,const Point3D& center, float endRadius,string fileName): DataParser(fileName) { setRadius(radius); setCenter(center); this->endRadius = endRadius; }