void CBuilderCAI::ExecutePatrol(Command& c) { if (!owner->unitDef->canPatrol) return; if (c.params.size() < 3) { return; } Command temp(CMD_FIGHT, c.options|INTERNAL_ORDER, c.GetPos(0)); commandQue.push_back(c); commandQue.pop_front(); commandQue.push_front(temp); Command tmpC(CMD_PATROL); eoh->CommandFinished(*owner, tmpC); SlowUpdate(); }
/** * @brief Executes the Patrol command c */ void CMobileCAI::ExecutePatrol(Command &c) { assert(owner->unitDef->canPatrol); if (c.params.size() < 3) { LOG_L(L_ERROR, "Received a Patrol command with less than 3 params on %s in MobileCAI", owner->unitDef->humanName.c_str()); return; } Command temp(CMD_FIGHT, c.options | INTERNAL_ORDER, c.GetPos(0)); commandQue.push_back(c); commandQue.pop_front(); commandQue.push_front(temp); Command tmpC(CMD_PATROL); eoh->CommandFinished(*owner, tmpC); ExecuteFight(temp); }
void QtCalculator::readSettings() { QColor tmpC(189, 255, 180); QColor blackC(0,0,0); KConfig *config = KGlobal::config(); config->setGroup("CalcPlugin"); kcalcdefaults.forecolor = config->readColorEntry("ForeColor", &blackC); kcalcdefaults.backcolor = config->readColorEntry("BackColor", &tmpC); #ifdef HAVE_LONG_DOUBLE kcalcdefaults.precision = config->readNumEntry("precision", (int)14); #else kcalcdefaults.precision = config->readNumEntry("precision", (int)10); #endif kcalcdefaults.fixedprecision = config->readNumEntry("fixedprecision", (int)2); kcalcdefaults.fixed = config->readBoolEntry("fixed", false); kcalcdefaults.style = config->readNumEntry("style", (int)0); kcalcdefaults.beep = config->readBoolEntry("beep", true); }
void ScColorEngine::getShadeColorRGB(const ScColor& color, const ScribusDoc* doc, RGBColor& rgb, double level) { if (color.getColorModel() == colorModelCMYK) { CMYKColor cmyk; getShadeColorCMYK(color, doc, cmyk, level); ScColor tmpC(cmyk.c, cmyk.m, cmyk.y, cmyk.k); getRGBValues(tmpC, doc, rgb); } else if (color.getColorModel() == colorModelRGB) { HSVColorF hsv; RGBColorF rgbF; color.getRawRGBColor(&rgbF); rgbF.toHsv(hsv); hsv.s = hsv.s * (level / 100.0); hsv.v = 1.0 - (1.0 - hsv.v) * (level / 100.0); hsv.toRgb(rgb); //We could also compute rgb shade using rgb directly /*rgb.r = 255 - ((255 - color.m_values[0]) * level / 100); rgb.g = 255 - ((255 - color.m_values[1]) * level / 100); rgb.b = 255 - ((255 - color.m_values[2]) * level / 100);*/ } else if (color.getColorModel() == colorModelLab) { ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans; double inC[3]; inC[0] = 100 - (100 - color.m_L_val) * (level / 100.0); inC[1] = color.m_a_val * (level / 100.0); inC[2] = color.m_b_val * (level / 100.0); quint16 outC[3]; trans.apply(inC, outC, 1); rgb.r = outC[0] / 257; rgb.g = outC[1] / 257; rgb.b = outC[2] / 257; } }
void ScColorEngine::getShadeColorRGB(const ScColor& color, const ScribusDoc* doc, RGBColor& rgb, double level) { if (color.getColorModel() == colorModelCMYK) { CMYKColor cmyk; getShadeColorCMYK(color, doc, cmyk, level); ScColor tmpC(cmyk.c, cmyk.m, cmyk.y, cmyk.k); getRGBValues(tmpC, doc, rgb); } else if (color.getColorModel() == colorModelRGB) { int h, s, v, snew, vnew; QColor tmpR(color.CR, color.MG, color.YB); tmpR.getHsv(&h, &s, &v); snew = qRound(s * level / 100.0); vnew = 255 - qRound(((255 - v) * level / 100.0)); tmpR.setHsv(h, snew, vnew); tmpR.getRgb(&rgb.r, &rgb.g, &rgb.b); //We could also compute rgb shade using rgb directly /*rgb.CR = 255 - ((255 - color.CR) * level / 100); rgb.MG = 255 - ((255 - color.MG) * level / 100); rgb.YB = 255 - ((255 - color.YB) * level / 100);*/ } else if (color.getColorModel() == colorModelLab) { ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans; double inC[3]; inC[0] = color.L_val * (level / 100.0); inC[1] = color.a_val; inC[2] = color.b_val; quint16 outC[3]; trans.apply(inC, outC, 1); rgb.r = outC[0] / 257; rgb.g = outC[1] / 257; rgb.b = outC[2] / 257; } }
void ScColorEngine::getShadeColorRGB(const ScColor& color, const ScribusDoc* doc, RGBColor& rgb, double level) { if (color.getColorModel() == colorModelCMYK) { CMYKColor cmyk; getShadeColorCMYK(color, doc, cmyk, level); ScColor tmpC(cmyk.c, cmyk.m, cmyk.y, cmyk.k); getRGBValues(tmpC, doc, rgb); } else { int h, s, v, snew, vnew; QColor tmpR(color.CR, color.MG, color.YB); tmpR.getHsv(&h, &s, &v); snew = qRound(s * level / 100.0); vnew = 255 - qRound(((255 - v) * level / 100.0)); tmpR.setHsv(h, snew, vnew); tmpR.getRgb(&rgb.r, &rgb.g, &rgb.b); //We could also compute rgb shade using rgb directly /*rgb.CR = 255 - ((255 - color.CR) * level / 100); rgb.MG = 255 - ((255 - color.MG) * level / 100); rgb.YB = 255 - ((255 - color.YB) * level / 100);*/ } }
void SlidingReducedOrderObserver::process() { DEBUG_BEGIN("void SlidingReducedOrderObserver::process()\n"); if (!_pass) { DEBUG_PRINT("First pass \n "); _pass = true; //update the estimate using the first value of y, such that C\hat{x}_0 = y_0 const SiconosVector& y = _sensor->y(); _e->zero(); prod(*_C, *_xHat, *_e); *_e -= y; SiconosVector tmpV(_DS->n()); SimpleMatrix tmpC(*_C); for (unsigned int i = 0; i < _e->size(); ++i) tmpV(i) = (*_e)(i); tmpC.SolveByLeastSquares(tmpV); *(_xHat) -= tmpV; *(_DS->x()) -= tmpV; _DS->initMemory(1); _DS->swapInMemory(); DEBUG_EXPR(_DS->display(););
void CBoxProxyView::drawUnitAxes() { // 实线部分 glPointSize(1.0f); glBegin(GL_POINTS); for (int i=0;i<points.size();i++) { Vector3d tmpP=points.at(i); Vector3d tmpC=pColors.at(i); //glColor3f(tmpC(2)/255,tmpC(1)/255,tmpC(0)/255); if (gettingDepth) { glVertexAttrib4d(ColorPos,tmpC(2)/255,tmpC(1)/255,tmpC(0)/255,0.0); glVertexAttrib4d(VertexPos,tmpP(0),tmpP(1),tmpP(2),1.0); } else glColor3f(tmpC(2)/255,tmpC(1)/255,tmpC(0)/255); glVertex3f(tmpP(0),tmpP(1),tmpP(2)); } glEnd(); }