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

C++ ri函数代码示例

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

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



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

示例1: ci

		void Polynomial::print() {
			int n = ci.rows();
			std::cout << "P(x) = ";
			if (n == 0) {
				std::cout << "?" << std::endl;
			} else {
				for (int i = n - 1; i >= 0; i--) {
					if (i > 0) {
						std::cout << ci(i) << " + ";
					} else {
						std::cout << ci(i);
					}
					if (i > 0) {
						if (ri(i) == 0) {
							std::cout << "x * ";
						} else {
							std::cout << "(x - " << ri(i) << ") * ";
						}
						if (i > 1) std::cout << "( ";
					}
				}
				for (int i = n - 1; i > 1; i--) {
					std::cout << " )";
				}
				std::cout << std::endl;
			}
		}
开发者ID:Tythos,项目名称:cuben,代码行数:27,代码来源:Fund.cpp


示例2: ri

//------------------------------------------------------------------------------
void
Canvas::DrawAnnulus(int x, int y,
                    unsigned inner_r, unsigned outer_r,
                    Angle start, Angle end)
  {
  QPainterPath p;
  QRectF ri(x - inner_r, y - inner_r, 2 * inner_r, 2 * inner_r);
  QRectF ro(x - outer_r, y - outer_r, 2 * outer_r, 2 * outer_r);
  // Draw the inner radius of the annulus.
  p.arcMoveTo(ri, start.Degrees());
  p.arcTo(ri, start.Degrees(), end.Degrees() - start.Degrees());
  if (start != end)
    { // Only draw the end caps when needed.
    // The currentPosition() will be at the end of the inner circle. Draw
    // one side of the annulus.
    // \todo This doesn't work because Angle(360) != Angle(0)!
    double xx = (outer_r - inner_r) * cos(end.Radians()) +
                p.currentPosition().rx();
    double yy = (outer_r - inner_r) * -sin(end.Radians()) +
                p.currentPosition().ry();
    p.lineTo(xx, yy);
    }
  else
    p.arcMoveTo(ro, end.Degrees());  // Set up for the outer circle.
  // The currentPosition() will be at the 'end' of the outer circle. Draw the
  // outer to the start.
  p.arcTo(ro, end.Degrees(), start.Degrees() - end.Degrees());
  if (start != end)
    {// And close it off to finish up.
    p.closeSubpath();
    }
  this->pushObject(p, this->pen(), this->brush());
  }
开发者ID:Exadios,项目名称:YCSoar,代码行数:34,代码来源:Canvas.cpp


示例3: ri

float Animal_Wild_Flee::postCondition()
{
    /*
     * Fleeing from an approaching player has the following postconditions:
     * - There is no character in flight range.
     * - There is an character attacking us.
     * - Our owner has come in range.
     *
     */

    if( m_npc->attackTarget() )
        return 1.0f;

    RegionIterator4Chars ri( m_npc->pos(), SrvParams->animalWildFleeRange() );
    bool found = false;
    for(ri.Begin(); !ri.atEnd(); ri++)
    {
        P_PLAYER pPlayer = dynamic_cast<P_PLAYER>(ri.GetData());
        if( pPlayer && !pPlayer->free && !pPlayer->isGMorCounselor() && !pPlayer->isHidden() && !pPlayer->isInvisible() )
            found = true;

        if( pPlayer && m_npc->owner() == pPlayer )
            return 1.0f;
    }

    if( found )
        return 0.0f;

    return 1.0f;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:30,代码来源:ai_animals.cpp


示例4: ri

U32 Mesh::Manager::Report()
{
    U32 countT = 0, memT = 0;
    NBinTree<MeshRoot>::Iterator ri(&rootTree);
    while (MeshRoot * root = ri++)
    {
        if (!root->isChunk)
        {
            memT += root->GetMem();
            countT++;
        }
    }

    U32 countE = 0, memE = 0;
    NList<MeshEnt>::Iterator ei(&entList);
    while (MeshEnt * ent = ei++)
    {
        memE += ent->GetMem();
        countE++;
    }

    U32 mem = memT + memE + endVar - startVar;   // namespace

    CON_DIAG( ("%4d %-31s: %9d", countT, "mesh types", memT ) );
    LOG_DIAG( ("%4d %-31s: %9d", countT, "mesh types", memT ) );

    CON_DIAG( ("%4d %-31s: %9d", countE, "mesh instances", memE ) );
    LOG_DIAG( ("%4d %-31s: %9d", countE, "mesh instances", memE ) );

    return mem;
}
开发者ID:supermukmin,项目名称:darkreign2,代码行数:31,代码来源:meshman.cpp


示例5: qWarning

void RenderThread::run()
{
  DEBUGOUT << "RenderThread for" << renderMe << "started";
  QImage renderImage = RenderUtils::renderPagePart(m_page.page, renderMe.requestedPageSize(), renderMe.pagePart());
  if ( renderImage.isNull() )
  {
    qWarning() << "RenderThread for" << renderMe << "failed";
    QSharedPointer<RenderingIdentifier> ri( new RenderingIdentifier(renderMe) );
    emit renderingFailed(ri);
    return;
  }

  QList< AdjustedLink > links;

  for( Poppler::Link* link: m_page.page->links() )
  {
    QSharedPointer<Poppler::Link> ptrLink(link);
    try{
      AdjustedLink al(renderMe, ptrLink);
      links.append(al);
    } catch( AdjustedLink::OutsidePage & e) {
      // no-op
    }
  }
  QSharedPointer<RenderedPage> renderResult(new RenderedPage( renderImage, links, renderMe ));
  DEBUGOUT << "RenderThread for" << renderMe << "successful, image has size" << renderResult->getImage().size();
  emit renderingFinished(renderResult);
}
开发者ID:jeeger,项目名称:dspdfviewer,代码行数:28,代码来源:renderthread.cpp


示例6: alloc

 void inductive_property::to_model(model_ref& md) const {
     md = alloc(model, m);
     vector<relation_info> const& rs = m_relation_info;
     expr_ref_vector conjs(m);
     for (unsigned i = 0; i < rs.size(); ++i) {
         relation_info ri(rs[i]);
         func_decl * pred = ri.m_pred;
         expr_ref prop = fixup_clauses(ri.m_body);
         func_decl_ref_vector const& sig = ri.m_vars;
         expr_ref q(m);
         expr_ref_vector sig_vars(m);
         for (unsigned j = 0; j < sig.size(); ++j) {
             sig_vars.push_back(m.mk_const(sig[sig.size()-j-1]));
         }
         expr_abstract(m, 0, sig_vars.size(), sig_vars.c_ptr(), prop, q);
         if (sig.empty()) {
             md->register_decl(pred, q);
         }
         else {
             func_interp* fi = alloc(func_interp, m, sig.size());
             fi->set_else(q);
             md->register_decl(pred, fi);
         }
     }
     TRACE("pdr", model_smt2_pp(tout, m, *md, 0););
开发者ID:perillaseed,项目名称:z3,代码行数:25,代码来源:pdr_manager.cpp


示例7: ri

void TLevelWriterMov::save(const TImageP &img, int frameIndex) {
  TRasterImageP ri(img);
  if (!img) throw TImageException(getFilePath(), "Unsupported image type");

  TRasterP ras(ri->getRaster());

  int lx = ras->getLx(), ly = ras->getLy(), pixSize = ras->getPixelSize();
  if (pixSize != 4)
    throw TImageException(getFilePath(), "Unsupported pixel type");

  int size = lx * ly * pixSize;

  // Send messages
  QLocalSocket socket;
  tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1,
                             t32bitsrv::srvCmdline());

  tipc::Stream stream(&socket);
  tipc::Message msg;

  // Send the write message.
  stream << (msg << QString("$LWMovImageWrite") << m_id << frameIndex << lx
                 << ly);

  // Send the data through a shared memory segment
  {
    t32bitsrv::RasterExchanger<TPixel32> exch(ras);
    tipc::writeShMemBuffer(stream, msg << tipc::clr, size, &exch);
  }

  if (tipc::readMessage(stream, msg) != "ok")
    throw TImageException(getFilePath(), "Couln't save image");
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:33,代码来源:tiio_mov_proxy.cpp


示例8: IVP_U_Float_Point

void CShadowController::AttachObject( void )
{
	IVP_Real_Object *pivp = m_pObject->GetObject();
	IVP_Core *pCore = pivp->get_core();
	m_saveRot = pCore->rot_speed_damp_factor;
	m_savedRI = *pCore->get_rot_inertia();
	m_savedMass = pCore->get_mass();
	m_savedMaterialIndex = m_pObject->GetMaterialIndexInternal();
	
	m_pObject->SetMaterialIndex( MATERIAL_INDEX_SHADOW );

	pCore->rot_speed_damp_factor = IVP_U_Float_Point( 100, 100, 100 );

	if ( !m_allowPhysicsRotation )
	{
		IVP_U_Float_Point ri( 1e15f, 1e15f, 1e15f );
		pCore->set_rotation_inertia( &ri );
	}
	if ( !m_allowPhysicsMovement )
	{
		m_pObject->SetMass( 1e6f );
		//pCore->inv_rot_inertia.hesse_val = 0.0f;
		m_pObject->EnableGravity( false );
	}

	pCore->calc_calc();
	pivp->get_environment()->get_controller_manager()->add_controller_to_core( this, pCore );
	m_shadow.lastPosition.set_to_zero();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:29,代码来源:physics_shadow.cpp


示例9: ri

RationalNumber RationalNumber::operator/(const int i) const {
	RationalNumber ri(i);
	RationalNumber rr(*this);
	rr /= ri;
	rr.normalize();
	return rr;
}
开发者ID:fgrimme,项目名称:rational_number_c,代码行数:7,代码来源:rationalnumber.cpp


示例10: main

int 
main (int argc, char **argv)
{
  /* YOUR CODE HERE */
  ssize_t raw_sklen = 32;
  char* skfname = argv[1];
  if (argc != 2) {
    usage (argv[0]);
  }
  else {
    setprogname (argv[0]);

    /* first, let's create a new symmetric key */
    ri ();

    /* Note that since we'll need to do both AES-CTR and AES-CBC-MAC,
       there are actuall *two* symmetric keys, which could, e.g., be 
       stored contiguosly in a buffer */

    /* YOUR CODE HERE */
    char* buffer = (char*)malloc(raw_sklen * sizeof(char));
    prng_getbytes(buffer, raw_sklen); 
    /* now let's armor and dump to disk the symmetric key buffer */

    /* YOUR CODE HERE */
    write_skfile(skfname, buffer, raw_sklen);
    bzero(buffer, raw_sklen);
    free(buffer);
    /* finally, let's scrub the buffer that held the random bits 
       by overwriting with a bunch of 0's */

  }

  return 0;
}
开发者ID:JohnnyFabiostine,项目名称:CS579-Foundation-of-Cryptography,代码行数:35,代码来源:pv_keygen.c


示例11: StartTrace

Application *Application::GetGlobalApplication(String &applicationName)
{
	StartTrace(Application.GetGlobalApplication);
	Application *application = 0;
	if (!fgConfig.IsNull()) {
		Anything applicationConf;

		if (fgConfig.LookupPath(applicationConf, "Application") ) {
			for (long i = 0, sz = applicationConf.GetSize() && !application; i < sz; ++i) {
				// iterate over the applicationname list
				applicationName = applicationConf[i].AsCharPtr(0);
				if ( applicationName.Length() > 0 ) {
					// return the first application object found by name
					application = Application::FindApplication(applicationName);
					break;
				}
			}
		} else {
			// if no application object is configured in the config any
			// return the first in the list
			RegistryIterator ri(MetaRegistry::instance().GetRegistry("Application"), false);
			for ( ; ri.HasMore() && !application ; application = SafeCast(ri.Next(applicationName), Application));
		}
	}
	return application;
}
开发者ID:chenbk85,项目名称:CuteTestForCoastTest,代码行数:26,代码来源:Application.cpp


示例12: response

int response(UOXSOCKET s, P_CHAR pPlayer, char* SpeechUpr)
{
	char *comm=SpeechUpr;

    if (strstr( comm, "#EMPTY") && online(currchar[s]) && !pPlayer->dead && pPlayer->isGM())
	{ // restricted to GMs for now. It's too powerful (Duke, 5.6.2001)
		target(s, 0, 1, 0, 71, "Select container to empty:");
		return 1;
	}

    if (!online(DEREF_P_CHAR(pPlayer)) || pPlayer->dead)
		return 0;

	P_CHAR pc;
	cRegion::RegionIterator4Chars ri(pPlayer->pos);
	for (ri.Begin(); (pc=ri.GetData()) != ri.End(); ri++)
	{
		if (pc->isPlayer())		// only npcs will respond automagically, players still have to do that themselves ;)
			continue;
		if (pPlayer->dist(pc) > 16)	// at least they should be on the screen
			continue;
		if (pPlayer->isSameAs(pc))	// not talking to ourselves
			continue;
		
		if (StableSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (UnStableSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (ShieldSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (QuestionSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (PackupSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (TriggerSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (EscortSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (BankerSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (TrainerSpeech(pc, comm, pPlayer, s))
			return 1;
		
		if (PetCommand(pc, comm, pPlayer, s))
			return 1;
		
		if (VendorSpeech(pc, comm, pPlayer, s))
			return 1;
	}
	
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:60,代码来源:speech.cpp


示例13: data

DrawableTextureDataP texture_utils::getTextureData(
	const TXshSimpleLevel *sl, const TFrameId &fid, int subsampling)
{
	const std::string &texId = sl->getImageId(fid);

	// Now, we must associate a texture
	DrawableTextureDataP data(TTexturesStorage::instance()->getTextureData(texId));
	if (data)
		return data;

	// There was no associated texture. We must bind the texture and repeat

	// First, retrieve the image to be used as texture
	TRasterImageP ri(::getTexture(sl, fid, subsampling));
	if (!ri)
		return DrawableTextureDataP();

	TRaster32P ras(ri->getRaster());
	assert(ras);

	TRectD geom(0, 0, ras->getLx(), ras->getLy());
	geom = TScale(ri->getSubsampling()) *
		   TTranslation(convert(ri->getOffset()) - ras->getCenterD()) *
		   geom;

	return TTexturesStorage::instance()->loadTexture(texId, ras, geom);
}
开发者ID:titer1,项目名称:opentoonz,代码行数:27,代码来源:textureutils.cpp


示例14: findmulti

P_ITEM findmulti(Coord_cl pos) //Sortta like getboat() only more general... use this for other multi stuff!
{
	int lastdist = 30;
	P_ITEM multi = NULL;
	int ret;

	cRegion::RegionIterator4Items ri(pos);
	
	for (ri.Begin(); !ri.atEnd(); ri++)
	{
		P_ITEM mapitem = ri.GetData();
		if (mapitem != NULL)
		{
			if (mapitem->isMulti())
			{
				ret = pos.distance(mapitem->pos);
				if (ret <= lastdist)
				{
					lastdist = ret;
					if (inmulti(pos, mapitem))
						multi = mapitem;
				}
			}
		}
	}

	return multi;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:28,代码来源:boats.cpp


示例15: getImage

void FullColorBrushTool::onEnter()
{
	TImageP img = getImage(false);
	TRasterImageP ri(img);
	if (ri) {
		m_minThick = m_thickness.getValue().first;
		m_maxThick = m_thickness.getValue().second;
	} else {
		m_minThick = 0;
		m_maxThick = 0;
	}
	Application *app = getApplication();
	if (app->getCurrentObject()->isSpline()) {
		m_currentColor = TPixel32::Red;
		return;
	}

	TPalette *plt = app->getCurrentPalette()->getPalette();
	if (!plt)
		return;

	int style = app->getCurrentLevelStyleIndex();
	TColorStyle *colorStyle = plt->getStyle(style);
	m_currentColor = colorStyle->getMainColor();
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:25,代码来源:fullcolorbrushtool.cpp


示例16: ri

void ReadEV3LineTracerSetting::process(InputContext &input)
{
	//Intervalの読み取り
	ReadInterval ri(ev3LineTracer);
	ri.process(input);

	//CostMaxの読み取り
	ReadCostMax rcm(ev3LineTracer);
	rcm.process(input);

	//State数の読み取り
	ReadStateCount rsc(ev3LineTracer);
	rsc.process(input);

	//Stateの読み取り
	ReadState rs(ev3LineTracer);
	rs.process(input);

	//Controlの読み取り
	ReadControl rc(ev3LineTracer);
	rc.process(input);

	//RegularPolicyの読み取り
	ReadRegularPolicy<EV3LineTracer> rrp(ev3LineTracer);
	rrp.process(input);

	//CurrentPolicyをRegularPolicyとして設定する
	ev3LineTracer.setCurrentPolicyLocal(ev3LineTracer.getRegularPolicy());
}
开发者ID:verxirtam,项目名称:ReinforcementLearning,代码行数:29,代码来源:ReadEV3LineTracerSetting.cpp


示例17: main

int 
main (int argc, char **argv)
{
  /* argv[1] is the file name */
  char raw_sk[2*CCA_STRENGTH];

  if (argc != 2) {
    usage (argv[0]);
  }
  else {
    setprogname (argv[0]);

    /* first, let's create a new symmetric key */
    ri ();

    /* Note that since we'll need to do both AES-CBC-MAC and HMAC-SHA1,
       there are actuall *two* symmetric keys, which could, e.g., be 
       stored contiguosly in a buffer */

    prng_getbytes(raw_sk, 2*CCA_STRENGTH);

    /* now let's armor and dump to disk the symmetric key buffer */
    write_skfile(argv[1], raw_sk, 2*CCA_STRENGTH);

    /* finally, let's scrub the buffer that held the random bits 
       by overwriting with a bunch of 0's */
    bzero(raw_sk, 2*CCA_STRENGTH);

  }

  return 0;
}
开发者ID:dhutchis,项目名称:skCrypt,代码行数:32,代码来源:pv_keygen.c


示例18: InitPixmap

void QSegmentWidget::DrawCylinder(const Cylinder &cyl,
  const SegmentList &s, const bool erase)
{
  if (!m_pixmap)
    InitPixmap();
  qreal border = 0;
  QPainter painter(m_pixmap);
  painter.setRenderHint(QPainter::Antialiasing);
  painter.setRenderHint(QPainter::SmoothPixmapTransform);
  painter.setWindow( -(BM_OSIZE / 2), -(BM_OSIZE / 2),
    BM_OSIZE, BM_OSIZE);
  QRectF rco(-cyl.outerRadius, -cyl.outerRadius, (cyl.outerRadius * 2.0)+border,
      (cyl.outerRadius * 2.0)+border);
  QRectF rci(-cyl.innerRadius, -cyl.innerRadius, (cyl.innerRadius * 2.0)+border,
      (cyl.innerRadius * 2.0)+border);
  QRegion ro(rco.toRect(), QRegion::Rectangle);
  QRegion ri(rci.toRect(), QRegion::Ellipse);
  QRegion region = ro.subtracted(ri);
  painter.setClipRegion(region);
  if (erase) {
      painter.setBrush(Qt::NoBrush);
      painter.setPen(Qt::NoPen);
  } else {
    QBrush b(cyl.color);
    painter.setBrush(b);
    painter.setPen(QPen(cyl.color.darker(200),border));
  }
  DrawSegments(&painter, s, cyl.outerRadius);
}
开发者ID:AdunanzA,项目名称:Tsunami,代码行数:29,代码来源:qsegmentwidget.cpp


示例19: ri

		void Polynomial::push(float r, float c) {
			int n = ci.rows();
			ri.conservativeResize(n + 1);
			ci.conservativeResize(n + 1);
			ri(n) = r;
			ci(n) = c;
		}
开发者ID:Tythos,项目名称:cuben,代码行数:7,代码来源:Fund.cpp


示例20: FILE_LOG

void ColaTopologyAddon::handleResizes(const cola::Resizes& resizeList,
        unsigned n, std::valarray<double>& X, std::valarray<double>& Y, 
        cola::CompoundConstraints& ccs, vpsc::Rectangles& boundingBoxes,
        cola::RootCluster* clusterHierarchy)
{
    FILE_LOG(cola::logDEBUG) << "ColaTopologyAddon::handleResizes()...";
    if(topologyNodes.empty()) {
        COLA_ASSERT(topologyRoutes.empty());
        return;
    }
    // all shapes to be resized are wrapped in a ResizeInfo and
    // placed in a lookup table, resizes, indexed by id
    ResizeMap resizes;
    for(cola::Resizes::const_iterator r=resizeList.begin();r!=resizeList.end();++r) {
        topology::ResizeInfo ri(topologyNodes[r->getID()],r->getTarget());
        resizes.insert(std::make_pair(r->getID(),ri));
    }
    vpsc::Variables xvs, yvs;
    vpsc::Constraints xcs, ycs;
    cola::setupVarsAndConstraints(n, ccs, vpsc::HORIZONTAL, boundingBoxes,
            clusterHierarchy, xvs, xcs, X);
    cola::setupVarsAndConstraints(n, ccs, vpsc::VERTICAL, boundingBoxes,
            clusterHierarchy, yvs, ycs, Y);
    topology::applyResizes(topologyNodes, topologyRoutes, clusterHierarchy,
            resizes, xvs, xcs, yvs, ycs);
    for_each(xvs.begin(), xvs.end(), delete_object());
    for_each(yvs.begin(), yvs.end(), delete_object());
    for_each(xcs.begin(), xcs.end(), delete_object());
    for_each(ycs.begin(), ycs.end(), delete_object());
    FILE_LOG(cola::logDEBUG) << "ColaTopologyAddon::handleResizes()... done.";
}
开发者ID:atis--,项目名称:adaptagrams,代码行数:31,代码来源:cola_topology_addon.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ riPS0函数代码示例发布时间:2022-05-30
下一篇:
C++ rhythmdb_entry_get_string函数代码示例发布时间: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