• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ratio函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ratio函数的典型用法代码示例。如果您正苦于以下问题:C++ ratio函数的具体用法?C++ ratio怎么用?C++ ratio使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ratio函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: QObject

ApplicationInfo::ApplicationInfo(QObject *parent): QObject(parent)
{

    m_isMobile = false;
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(Q_OS_BLACKBERRY)
    m_isMobile = true;
#endif

#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
    m_platform = Linux;
#elif defined(Q_OS_WIN)
    m_platform = Windows;
#elif defined(Q_OS_MAC)
    m_platform = MacOSX;
#elif defined(Q_OS_ANDROID)
    m_platform = Android;
#elif defined(Q_OS_IOS)
    m_platform = Ios;
#elif defined(Q_OS_BLACKBERRY)
    m_platform = Blackberry;
#endif

    QRect rect = qApp->primaryScreen()->geometry();
    m_ratio = m_isMobile ? qMin(qMax(rect.width(), rect.height())/800. , qMin(rect.width(), rect.height())/520.) : 1;
    m_sliderHandleWidth = getSizeWithRatio(70);
    m_sliderHandleHeight = getSizeWithRatio(87);
    m_sliderGapWidth = getSizeWithRatio(100);
    m_isPortraitMode = m_isMobile ? rect.height() > rect.width() : false;
    m_hMargin =  m_isPortraitMode ? 20 * ratio() : 50 * ratio();
    m_applicationWidth = m_isMobile ? rect.width() : 1120;

    if (m_isMobile)
        connect(qApp->primaryScreen(), SIGNAL(physicalSizeChanged(QSizeF)), this, SLOT(notifyPortraitMode()));
}
开发者ID:amanica,项目名称:GCompris-qt,代码行数:34,代码来源:ApplicationInfo.cpp


示例2: ratio

void ApplicationInfo::setIsPortraitMode(const bool newMode)
{
    if (m_isPortraitMode != newMode) {
        m_isPortraitMode = newMode;
        m_hMargin = m_isPortraitMode ? 20 * ratio() : 50 * ratio();
        emit portraitModeChanged();
        emit hMarginChanged();
    }
}
开发者ID:amanica,项目名称:GCompris-qt,代码行数:9,代码来源:ApplicationInfo.cpp


示例3: SYNC

  void InlineCacheRegistry::print_stats(STATE) {
    SYNC(state);
    int total = 0;
    std::vector<int> sizes(cTrackedICHits + 1);

    int overflow = 0;

    for(CacheHash::iterator hi = caches_.begin();
        hi != caches_.end();
        ++hi) {
      for(CacheVector::iterator vi = hi->second.begin();
          vi != hi->second.end();
          ++vi) {
        InlineCache* ic = *vi;
        int seen = ic->classes_seen();
        if(ic->seen_classes_overflow() > 0) {
          total++;
          overflow++;
        } else if(seen > 0) {
          total++;
          sizes[seen]++;
        }
      }
    }

    std::cerr << "IC Stats:\n";
    for(int i = 1; i < cTrackedICHits + 1; i++) {
      std::cerr << " " << i << ": " << sizes[i] << " "
                << ratio(sizes[i], total) << "%\n";
    }

    std::cerr << cTrackedICHits << "+: " << overflow << " "
              << ratio(overflow, total) << "%\n";

    // print out the mega-morphic ones
    std::cerr << "\nMegamorphic call sites:\n";

    for(CacheHash::iterator hi = caches_.begin();
        hi != caches_.end();
        ++hi) {
      for(CacheVector::iterator vi = hi->second.begin();
          vi != hi->second.end();
          ++vi) {
        InlineCache* ic = *vi;
        if(ic->seen_classes_overflow() > 0) {
          ic->print(state, std::cerr);
          std::cerr << "location: ";
          ic->print_location(state, std::cerr);
          std::cerr << "\n\n";
        }
      }
    }
  }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:53,代码来源:inline_cache.cpp


示例4: results_compare

int results_compare(struct ts_results *tsr1, struct ts_results *tsr2)
{
	int i;
	struct ts_plugin_results *tspr1, *tspr2;

	if (!tsr1 || !tsr2) {
		CRITICAL("Null energy result list\n");
		return -1;
	}

	if (tsr1->nr_results != tsr2->nr_results)
		WARNING("There is a different number of results\n");

	tspr1 = tsr1->tspr;
	tspr2 = tsr2->tspr;

	if (!tspr1 || !tspr2) {
		CRITICAL("No plugin results !\n");
		return -1;
	}

	for (i = 0; i < tsr1->nr_results; i++) {

		struct ts_plugin_results *tspr;
		char *name = basename(tsr1->tspr[i].path);

		tspr = results_find(tspr1[i].path, tsr2);
		if (!tspr) {
			WARNING("Failed to find plugin '%s' result to compare\n", name);
			continue;
		}

		DEBUG("'%s': %.0lf / %.0lf usecs\n",
		      name, tspr1[i].duration, tspr->duration);
		DEBUG("'%s': %lf / %lf uJ\n", name, tspr1[i].energy, tspr->energy);

		NOTICE("'%s': %+.2lf%% usecs / %+.2lf%% uJ\n",
		       name, ratio(tspr1[i].duration, tspr->duration),
		       ratio(tspr1[i].energy, tspr->energy));
	}

	DEBUG("Overall time: %.0lf / %.0lf usecs\n",
	      tsr1->duration, tsr2->duration);
	DEBUG("Overall energy: %lf / %lf uJ\n", tsr1->energy, tsr2->energy);

	NOTICE("Overall: %+.2lf%% usecs / %+.2lf%% uJ\n",
	       ratio(tsr1->duration, tsr2->duration),
	       ratio(tsr1->energy, tsr2->energy));

	return 0;
}
开发者ID:dlezcano,项目名称:ts,代码行数:51,代码来源:results.c


示例5: product

/**
 * parameter:
 * @lp1 the left bound of the first bucket
 * @rp1	the right bound of the first bucket
 * @d1 	the distinct value in the first bucket
 * @lp2 the left bound of the second bucket
 * @rp2 the right bound of the second bucket
 * @d2 	the distinct value in the second bucket
 */
unsigned long product(const void *lp1, const void *rp1, const int d1,
		const int c1, const void *lp2, const void *rp2, const int d2,
		const int c2, const column_type *type) {

	double r1 = ratio(lp1, rp1, lp2, rp2, type);
	double r2 = ratio(lp2, rp2, lp1, rp1, type);

	int numDistinctValue1 = d1 * r1;
	int numDistinctValue2 = d2 * r2;

	int numCombination =
			numDistinctValue1 < numDistinctValue2 ?
					numDistinctValue1 : numDistinctValue2;

	return c1 / d1 * c2 / d2 * numCombination;
}
开发者ID:yestodaylee,项目名称:CLAIMS,代码行数:25,代码来源:Estimation.cpp


示例6: ratio

/**
 * assume both lowPara and upperPara is legal
 * lowPara:
 * upperPara:
 * range is used with < and >, instead of =
 * for <=, it decomposed into < and =
 */
unsigned long Estimation::estRangeOper(AttributeID attrID, void *lowPara,
		void *upperPara) {
	unsigned long ret = 0;

	const Histogram *stat = StatManager::getInstance()->getHistogram(attrID);

	Attribute attr =
			Catalog::getInstance()->getTable(attrID.table_id)->getAttribute(
					attrID.offset);
	Operate *op = attr.attrType->operate;

//	column_type* type =
//			Catalog::getInstance()->getTable(attrID.table_id)->getAttribute(
//					attrID.offset).attrType;
//	Operate *op = type->operate;

	double sel = 0;
	for (unsigned i = 0; i < stat->m_bucketCnt - 1; ++i) {

		if ((op->Compare(lowPara, stat->m_staValues1[i]) <= 0)
				&& (op->Compare(stat->m_staValues1[i + 1], upperPara) <= 0)) {
			sel += 1;
			//the lowest value of the bucket is unreachable
			if (op->Equal(lowPara, stat->m_staValues1[i]))
				sel -= 1.0 / stat->m_staNumbers1[i];
		} else {	//intersect
			double r = ratio(stat->m_staValues1[i], stat->m_staValues1[i + 1],
					lowPara, upperPara, attr.attrType);
			sel += r;
		}
	}
	sel = sel / (stat->m_bucketCnt - 1);
	ret = sel * stat->m_staCount;
	return ret;
}
开发者ID:yestodaylee,项目名称:CLAIMS,代码行数:42,代码来源:Estimation.cpp


示例7: QGLWidget

MyWidget::MyWidget(QGLWidget *parent)
  : QGLWidget(QGLFormat(), parent)
{

  setMouseTracking(true);

  setPaletteBackgroundColor(QColor(255,255,255));

  setstatus();

  menu = new QMenuBar(this, "Menu bar");
  file = new QPopupMenu( this , "file");
  save = new QPopupMenu( this , "save");
  placement = new QPopupMenu( this , "placement");
  options = new QPopupMenu( this , "options");
  view = new QPopupMenu( this , "viewing");
  save->insertItem( "Save &eps file", this, SLOT(savedepsfile()), CTRL+Key_E );
  save->insertItem( "Save &stl file", this, SLOT(savedstlfile()), CTRL+Key_S );
  file->insertItem( "&Load", this, SLOT(openedfile()), CTRL+Key_L );
  generate_id = placement->insertItem( "&Generate", &p, SLOT(generate()), CTRL+Key_G );
  generatefirst_id = placement->insertItem( "Generate &First", &p, SLOT(generateFirst()), CTRL+Key_F );
  generatenext_id = placement->insertItem( "Generate &Next", &p, SLOT(generateNext()), CTRL+Key_N );
  generateten_id = placement->insertItem( "Next &ten streamlines", &p, SLOT(generateTen()), CTRL+Key_T );
  generateresume_id = placement->insertItem( "&Resume the placement", &p, SLOT(generateAll()), CTRL+Key_C );
  clear_id = placement->insertItem( "&Clear", &p, SLOT(purge()), CTRL+Key_M );
  drawstl_id = view->insertItem( "&Draw streamlines", &p, SLOT(draw_stl()), CTRL+Key_D );
  drawpq_id = view->insertItem( "Draw &queue elements", &p, SLOT(draw_pq()), CTRL+Key_Q );
  drawtr_id = view->insertItem( "Draw t&riangulation", &p, SLOT(draw_tr()), CTRL+Key_R );
  drawbc_id = view->insertItem( "Draw &biggest circle", &p, SLOT(draw_bc()), CTRL+Key_B );
  addimage_id = placement->insertItem( "&Image", this, SLOT(openedimage()), CTRL+Key_I );
  options->insertItem( "Density...", &p, SLOT(density()));
  options->insertItem( "Saturation ration...", &p, SLOT(ratio()));
  options->insertItem( "Sampling step...", &p, SLOT(sampling()));
  options->insertItem( "Integrating step...", &p, SLOT(integrating()));
  placement->insertItem( "&Options ", options );
  save_id = file->insertItem( "&Save", save );
  menu->insertItem( "&File", file );
  menu->insertItem( "&Placement", placement );
  view_id = menu->insertItem( "&View ", view );
  file->insertItem( "&Quit", qApp, SLOT(quit()), ALT+Key_F4 );

  // desable all generator menu items
  placement->setItemEnabled(generate_id, false);
  placement->setItemEnabled(generatefirst_id, false);
  placement->setItemEnabled(generatenext_id, false);
  placement->setItemEnabled(generateten_id, false);
  placement->setItemEnabled(generateresume_id, false);
  placement->setItemEnabled(clear_id, false);

  menu->setItemEnabled(view_id, false);

  placement->setItemEnabled(addimage_id, false);
  file->setItemEnabled(save_id, false);


  connect(this, SIGNAL(fileloaded(const QString &)), &p, SLOT(load(const QString &)));
  connect(this, SIGNAL(imageloaded(const QString &)), &p, SLOT(image(const QString &)));
  connect(&p, SIGNAL(optionschanged()), this, SLOT(updatestatus()));

}
开发者ID:Fox-Heracles,项目名称:cgal,代码行数:60,代码来源:streamlines.cpp


示例8: ratio

void RELabel::renderAtWithShadow(const REFloat32 x, const REFloat32 y)
{
	if (_font) 
	{
		RERenderDevice * device = RERenderDevice::defaultDevice();
		RESize ratio(_font->getCharsScaleRatio());
		if (_frame.height != 0.0f) 
		{
			ratio.height *= (_textInsets.adjustedRect(_frame).height / _frame.height);
		}
		REFloat32 penX = x;
		const REFloat32 bottomY = y + _font->getHeight() - _textInsets.bottom - _textInsets.top;
		for (REUInt32 i = 0; i < _chars.count(); i++) 
		{
			RETTFFontChar * fontChar = _chars[i];
			penX += ((ratio.width * fontChar->offsetX) * _charsSpaceRatio);
			const REFloat32 penY = bottomY - (ratio.height * fontChar->offsetY);
			const REFloat32 width = (ratio.width * fontChar->width);
			const REFloat32 height = (ratio.height * fontChar->height);
			device->renderRect(RERect(penX + _shadowOffset.x, penY + _shadowOffset.y, width, height),
							   _shadowColor, 
							   fontChar->textureFrame, 
							   fontChar->texture);
			device->renderRect(RERect(penX, penY, width, height),
							   _textColor, 
							   fontChar->textureFrame, 
							   fontChar->texture);
			penX += (ratio.width * fontChar->advanceX);
		}
	}
}
开发者ID:OlehKulykov,项目名称:re-sdk,代码行数:31,代码来源:RELabel.cpp


示例9: doTask5B

void doTask5B()
{
	int a;
	int b;
	int x;
	int y;
	scanf("%d %d %d %d", &a, &b, &x, &y);

	Fraction monitor(a, b);
	//monitor.reduce();

	Fraction ratio(x, y);
	//ratio.reduce();

	while (monitor != ratio && !monitor.isEmpty()) {
		if (monitor.getValue() > ratio.getValue()) {
			monitor.setNumerator(ratio.getValue() * monitor.getDenominator());
			//monitor.reduce();
		} else {
			monitor.setDenominator(monitor.getNumerator() / ratio.getValue());
			//monitor.reduce();
		}
	}

	if (monitor.isEmpty()) {
		printf("0 0\n");
	} else {
		printf("%d %d\n", monitor.getNumerator(), monitor.getDenominator());
	}

	//auto stop = 0;
	//scanf("%d", &stop);
}
开发者ID:mulder93,项目名称:zepto_algorithm,代码行数:33,代码来源:b_monitor.cpp


示例10: ratio

// drives wheels with differential based on angle
void wheels::drive(int angle, int speed) {
    int left;
    int right;
    
    if (angle > 0) {
        right  = speed;
        left   = speed * ratio(angle); //max angle here is +45 left goes 1/4 as fast
    } else {
        left   = speed;
        right  = speed * ratio(angle); //"max" angle here is -45 _CHANGE
    }

    driveWheels(left, right);
    
    return;
}
开发者ID:bSkwared,项目名称:asee2016,代码行数:17,代码来源:wheels.cpp


示例11: ratio

void REGUIApplication::onClickOnScreenEnd(const REFloat32 screenX, const REFloat32 screenY)
{
	if (_userActionViews.count() && _renderDevice) 
	{
		RESize ratio(_renderDevice->screenToRenderSizeRatio());
		
		const REFloat32 x = ratio.width * screenX;
		const REFloat32 y = ratio.height * screenY;
		
		for (REUInt32 i = 0; i < _userActionViews.count(); i++) 
		{
			_userActionViews[i]->userActionClickDidEnd(_lastUserClickPos.x, _lastUserClickPos.y, x, y);
		}
		
		if (_isLastUserClickMoving)
		{
			_isLastUserClickMoving = 0;
			
			if ((fabs(_lastUserClickPos.x - x) > 0.0) || (fabs(_lastUserClickPos.y - y) > 0.0))
			{
				for (REUInt32 i = 0; i < _userActionViews.count(); i++) 
				{
					_userActionViews[i]->userActionClickMovingDidEnd(_lastUserClickPos.x, _lastUserClickPos.y, x, y);
				}
			}
		}
	}
}
开发者ID:OlehKulykov,项目名称:re-sdk,代码行数:28,代码来源:REGUIApplication.cpp


示例12: ratio

void steering::drive(int angle, int speed) {
    int left;
    int right;
    if (angle > 0) {
        left  = speed;
        right = speed * ratio(angle);
    } else {
        right = speed;
        left  = speed/ratio(angle);
    }

    analogWrite(PWMR, right);
    analogWrite(PWML, left);

    return;
}
开发者ID:bSkwared,项目名称:asee2016,代码行数:16,代码来源:steering.cpp


示例13: main

int main(int argc, char ** argv) {
  char buffer[BUFFER_SIZE] = { 0 };
  char comp[BUFFER_SIZE] = { 0 };
  char out[BUFFER_SIZE] = { 0 };
  int count = 0;
  double ratios = 0;
  double rat = 0;
  int inlen, complen, outlen;

  while (fgets(buffer, BUFFER_SIZE, stdin) != NULL) {
    char *end = strchr(buffer, '\n');
    if (end != NULL)
      *end = '\0';
    else
      break;

    inlen = strlen(buffer);
    complen = shoco_compress(buffer, 0, comp, BUFFER_SIZE);
    outlen = shoco_decompress(comp, complen, out, BUFFER_SIZE);
    rat = ratio(inlen, complen);
    if (complen != 0) {
      ++count;
      ratios += rat;
    }
    if ((argc > 1) && ((strcmp(argv[1], "-v") == 0) || (strcmp(argv[1], "--verbose") == 0))) {
      print(buffer, rat);
    }
    assert(inlen == outlen);
    assert(strcmp(buffer, out) == 0);
  }
  printf("Number of compressed strings: %d, average compression ratio: %d%%\n", count, percent(ratios / count));
  return 0;
}
开发者ID:Ed-von-Schleck,项目名称:shoco,代码行数:33,代码来源:test_input.c


示例14: logRatio

 DiracDeterminantBase::ValueType DiracDeterminantBase::logRatio(ParticleSet& P, int iat,
     ParticleSet::ParticleGradient_t& dG, 
     ParticleSet::ParticleLaplacian_t& dL) {
   //THIS SHOULD NOT BE CALLED
   ValueType r=ratio(P,iat,dG,dL);
   return LogValue = evaluateLogAndPhase(r,PhaseValue);
 }
开发者ID:digideskio,项目名称:qmcpack,代码行数:7,代码来源:DiracDeterminantBase.cpp


示例15: decode

int64_t decode(void *buffer, size_t size, int64_t sum)
{
    unsigned int i;
    C(table_t) foobarcontainer;
    FooBar(vec_t) list;
    FooBar(table_t) foobar;
    Bar(struct_t) bar;
    Foo(struct_t) foo;

    foobarcontainer = C(as_root(buffer));
    sum += C(initialized(foobarcontainer));
    sum += StringLen(C(location(foobarcontainer)));
    sum += C(fruit(foobarcontainer));
    list = C(list(foobarcontainer));
    for (i = 0; i < FooBar(vec_len(list)); ++i) {
        foobar = FooBar(vec_at(list, i));
        sum += StringLen(FooBar(name(foobar)));
        sum += FooBar(postfix(foobar));
        sum += (int64_t)FooBar(rating(foobar));
        bar = FooBar(sibling(foobar));
        sum += (int64_t)Bar(ratio(bar));
        sum += Bar(size(bar));
        sum += Bar(time(bar));
        foo = Bar(parent(bar));
        sum += Foo(count(foo));
        sum += Foo(id(foo));
        sum += Foo(length(foo));
        sum += Foo(prefix(foo));
    }
    return sum + 2 * sum;
}
开发者ID:heibao,项目名称:flatcc,代码行数:31,代码来源:benchflatcc.c


示例16: ratioChanged

void Box2DGearJoint::setRatio(float _ratio)
{
    if (qFuzzyCompare(_ratio,ratio()))
        return;
    mGearJointDef.ratio = _ratio;
    if (mGearJoint)
        mGearJoint->SetRatio(_ratio);
    emit ratioChanged();
}
开发者ID:ElderOrb2k8,项目名称:qml-box2d,代码行数:9,代码来源:box2dgearjoint.cpp


示例17: QObject

ApplicationInfo::ApplicationInfo(QObject *parent): QObject(parent)
{

    m_isMobile = false;
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(Q_OS_BLACKBERRY)
    m_isMobile = true;
#endif

#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
    m_platform = Linux;
#elif defined(Q_OS_WIN)
    m_platform = Windows;
#elif defined(Q_OS_MAC)
    m_platform = MacOSX;
#elif defined(Q_OS_ANDROID)
    m_platform = Android;
#elif defined(Q_OS_IOS)
    m_platform = Ios;
#elif defined(Q_OS_BLACKBERRY)
    m_platform = Blackberry;
#endif

    QRect rect = qApp->primaryScreen()->geometry();
//    m_ratio = 2;
//    m_ratio = 2.56;
    m_ratio = m_isMobile ? qMin(qMax(rect.width(), rect.height())/800. , qMin(rect.width(), rect.height())/520.) : 1;
    m_sliderHandleWidth = getSizeWithRatio(70);
    m_sliderHandleHeight = getSizeWithRatio(87);
    m_sliderGapWidth = getSizeWithRatio(100);
    m_isPortraitMode = m_isMobile ? rect.height() > rect.width() : false;
    m_hMargin =  m_isPortraitMode ? 20 * ratio() : 50 * ratio();
    m_applicationWidth = m_isMobile ? rect.width() : 1120;

    if (m_isMobile)
        connect(qApp->primaryScreen(), SIGNAL(physicalSizeChanged(QSizeF)), this, SLOT(notifyPortraitMode()));

    // Get all symbol fonts to remove them
    QFontDatabase database;
    m_excludedFonts = database.families(QFontDatabase::Symbol);

    // Get fonts from rcc
    const QStringList fontFilters = {"*.otf", "*.ttf"};
    m_fontsFromRcc = QDir(":/gcompris/src/core/resource/fonts").entryList(fontFilters);
}
开发者ID:24ark,项目名称:GCompris-qt,代码行数:44,代码来源:ApplicationInfo.cpp


示例18: rect

        void Dial::paintEvent(QPaintEvent *e)
        {
            auto && _rect = rect();
            QPointF _center = _rect.center();

            double   _r = radius() - radius() / 50.0;
            QPainter _p(this);
            _p.setRenderHint(QPainter::Antialiasing);
            _p.setBrush(colorSet().button());
            _p.setPen(hasFocus() ? QPen(colorSet().dark(),
                                        radius() / 50.0) : Qt::NoPen);

            _p.drawEllipse(_center, _r, _r);

            QPainterPath _ellipsePath, _piePath;
            _ellipsePath.addEllipse(_center, _r,        _r);
            _ellipsePath.addEllipse(_center, _r * 0.75, _r * 0.75);
            auto && _pieRect = _ellipsePath.boundingRect().adjusted(-2, -2, 2, 2);

            _p.setBrush(
                hasFocus() ?
                colorSet().highlight() :
                colorSet().dark());

            QPainterPath _arc(_center);
            _arc.arcTo(_pieRect, -90, -ratio() * 360);
            _arc.lineTo(_center);
            _arc.closeSubpath();

            _piePath = _arc & _ellipsePath;
            _p.drawPath(_piePath);

            if (showTicks())
            {
                mixin_range_type::for_each_step([&](int _step, double i,
                                                    bool _isPage)
                {
                    _p.setPen(QPen(i >= mixin_range_type::value() ?
                                   colorSet().shadow() :
                                   colorSet().windowText(), 1));
                    paintTick(_p, i, _isPage ? 0.25 : 0.125);
                });
            }

            _p.setPen(QPen(colorSet().shadow(), _r / 50.0));
            paintTick(_p, mixin_range_type::value(), 0.333);
            paintTick(_p, 0.0,                       0.25);


            // Draw big letter in the middle
            _p.setPen(QPen(QColor("#3d3d3d"), 2));
            QFont _font = font();
            _font.setPixelSize(_r);
            _p.setFont(_font);
            _p.drawText(_rect, Qt::AlignCenter, letter_);
        }
开发者ID:cr8tr,项目名称:omnidome,代码行数:56,代码来源:Dial.cpp


示例19: ratio

void steering::drive(int angle, int speed) {
  int left;
  int right;
  if (angle > 0) {
    left  = speed;
    right = speed * ratio(angle);
  } else {
    right = speed;
    left  = speed/ratio(angle);
  }

  analogWrite(PWMR, right);
  analogWrite(PWML, left);

        if (millis()%1000 == 0) {
  Serial.println(right);
  Serial.println(left);
        }
}
开发者ID:bSkwared,项目名称:asee2016,代码行数:19,代码来源:steering.cpp


示例20: assert

	//------------------------------------------------------------------------------------
	void D3D11RenderSystem::AddResizableTexture( D3D11Texture* pTexture )
	{
		assert(m_mapTexNeedResize.find(pTexture) == m_mapTexNeedResize.end() && "This texture already added!");

		VEC2 ratio(pTexture->GetWidth() / (float)m_wndWidth, pTexture->GetHeight() / (float)m_wndHeight);

		m_mapTexNeedResize.insert(std::make_pair(pTexture, ratio));

		pTexture->AddRef();
	}
开发者ID:mavaL,项目名称:NeoEngine,代码行数:11,代码来源:D3D11RenderSystem.cpp



注:本文中的ratio函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rational函数代码示例发布时间:2022-05-30
下一篇:
C++ rates函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap