当前位置: 首页>>代码示例>>C++>>正文


C++ rr函数代码示例

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


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

示例1: miird

static int
miird(Dev *d, int idx)
{
	while(rr(d, MIIaddr) & MIIbusy)
		;
	wr(d, MIIaddr, PHYinternal<<11 | idx<<6 | MIIread);
	while(rr(d, MIIaddr) & MIIbusy)
		;
	return rr(d, MIIdata);
}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:10,代码来源:smsc.c

示例2: miiwr

static void
miiwr(Dev *d, int idx, int val)
{
	while(rr(d, MIIaddr) & MIIbusy)
		;
	wr(d, MIIdata, val);
	wr(d, MIIaddr, PHYinternal<<11 | idx<<6 | MIIwrite);
	while(rr(d, MIIaddr) & MIIbusy)
		;
}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:10,代码来源:smsc.c

示例3: MathMultU8x8

// OK
void MathMultU8x8(void)	
{
    counter = 8;
    nilrval = 0;
    W = nilgarg1.low8;
    do  {
        nilgarg2.low8 = rr( nilgarg2.low8);
        if (Carry)
            nilrval.high8 += W;
        nilrval = rr( nilrval);
        counter = decsz(counter);
    } while (1);
	return;
}
开发者ID:gke,项目名称:UAVP,代码行数:15,代码来源:mathlib.c

示例4: stoi

unordered_map<std::string, int> LoadParticles::read_xyzHeader(std::fstream &data) {
  string line;

  // Reading the number of particles
  std::getline(data, line);

  m_nParticles = stoi(line);

  // Reading the comments
  // This program follows a convention that the comments
  // in a xyz-file must name the variables.
  std::getline(data, line);
  boost::regex rr("([A-Za-z_]+)");
  boost::sregex_iterator next(line.begin(), line.end(), rr);
  boost::sregex_iterator end;

  unordered_map<std::string, int> parameters;

  int position = 0;
  while (next != end) {
    boost::smatch match = *next;
    parameters[match.str()] = position;
    position++;
    next++;
  }

  return parameters;
}
开发者ID:sigvebs,项目名称:PDtools,代码行数:28,代码来源:loadparticles.cpp

示例5: extract_region

    cv::Mat extract_region(const cv::Mat& m, const cv::RotatedRect& ir, bool flipped, int interpolation, int bordertype, int value){
        cv::Mat M, enlarged, rotated, cropped;
        cv::Rect margins;
        cv::RotatedRect pos_in_enlarged;
        boost::tie(margins,pos_in_enlarged) = required_padding(m, ir);
        cv::copyMakeBorder(m, enlarged, 
                margins.y, margins.height, margins.x, margins.width, 
                bordertype, value);

        cv::Size rect_size = pos_in_enlarged.size;
        float angle = pos_in_enlarged.angle;
        if(angle == 0.){
            cv::Rect rr(
                    pos_in_enlarged.center.x - pos_in_enlarged.size.width/2,
                    pos_in_enlarged.center.y - pos_in_enlarged.size.height/2,
                    pos_in_enlarged.size.width, pos_in_enlarged.size.height);
            cropped = enlarged(rr);
        }
        else{
            if (pos_in_enlarged.angle < -45.) {
                angle += 90.0;
                std::swap(rect_size.width, rect_size.height);
            }
            M = cv::getRotationMatrix2D(pos_in_enlarged.center, angle, 1.0);
            cv::warpAffine(enlarged, rotated, M, enlarged.size(), interpolation);
            cv::getRectSubPix(rotated, rect_size, pos_in_enlarged.center, cropped);
            assert(cropped.rows == cropped.cols);
        }
        if(flipped)
            cv::flip(cropped, cropped, 1);
        if(!cropped.isContinuous())
            cropped = cropped.clone();
        return cropped;
    }
开发者ID:deeplearningais,项目名称:cuvnet,代码行数:34,代码来源:cv_datasets.cpp

示例6: main

int main(int argc, const char** argv) {
  Options options;
  if (!options.parse(argc, argv))
    return 1;

  radical::RadiometricResponse rr(options.r_response);
  auto min_radiance = rr.inverseMap(cv::Vec3b(0, 0, 0));
  auto max_radiance = rr.inverseMap(cv::Vec3b(255, 255, 255));

  std::cout << "Loaded radiometric response from file \"" << options.r_response << "\"" << std::endl;
  std::cout << "Irradiance range: " << min_radiance << " - " << max_radiance << std::endl;

  auto plot = utils::plotRadiometricResponse(rr);

  if (options.save) {
    auto output = options.r_response + ".png";
    cv::imwrite(output, plot);
    std::cout << "Saved radiometric response visualization to file \"" << output << "\"" << std::endl;
  } else {
    cv::imshow("Radiometric response", plot);
    cv::waitKey(-1);
  }

  return 0;
}
开发者ID:taketwo,项目名称:radical,代码行数:25,代码来源:display_radiometric_response.cpp

示例7: 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

示例8: SetControlText

LRESULT CHexFileDialog::OnPostInit(WPARAM wp, LPARAM lp)
{
	// Set text of "OK" button
	if (!strOKName.IsEmpty())
		SetControlText(IDOK, strOKName);

	// Restore the window position and size
	CRect rr(theApp.GetProfileInt("Window-Settings", strName+"X1", -30000),
			 theApp.GetProfileInt("Window-Settings", strName+"Y1", -30000),
			 theApp.GetProfileInt("Window-Settings", strName+"X2", -30000),
			 theApp.GetProfileInt("Window-Settings", strName+"Y2", -30000));
	if (rr.top != -30000)
		GetParent()->MoveWindow(&rr);  // Note: there was a crash here until we set 8th
									   // param of CFileDialog (bVistaStyle) c'tor to FALSE.

	// Restore the list view display mode (details, report, icons, etc)
	ASSERT(GetParent() != NULL);
	CWnd *psdv  = FindWindowEx(GetParent()->m_hWnd, NULL, "SHELLDLL_DefView", NULL);
	if (psdv != NULL)
	{
		int mode = theApp.GetProfileInt("Window-Settings", strName+"Mode", REPORT);
		psdv->SendMessage(WM_COMMAND, mode, 0);
	}

	return 0;
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:26,代码来源:Dialog.cpp

示例9: rrtester

void rrtester(int& rrcntr)
{
	extern const int globalWindow;
	extern double k;
	double u[globalWindow], v[globalWindow];
	double rrmean = 0.0, testdiff = 0.0, tempdiff = 0.0;
	const int iters = 200, num = 20;

	cout << "Testing calibration of rr()..." << endl;
	cout << setw(10) << "Expected" << setw(12) << " Actual  " << setw(10) << "Difference" << endl;
	cout << setw(10) << "--------" << setw(12) << " ------  " << setw(10) << "----------" << endl;

	for (int i = 1; i < num; i++)
	{
		u[0] = 0.0;
		v[0] = 1.0 / static_cast<double> (i);
//		stdmpInit(0.0,u,v,w);	// These need to be created from scratch, and follow the older definitions of the functions because they are calling a k = 0 option.
		rrmean = rrInit(u,v,rrcntr);
		for (int j = 0; j < iters; j++)
		{
//			stdmp(0.0,u,v,w,n);
			rrmean += rr(u,v,rrcntr);
		}
		tempdiff = fabs(1.0/static_cast<double> (i) - rrmean/(static_cast<double> (iters + 1)));
		testdiff += tempdiff;
		
		cout << std::fixed << std::setprecision(5) << setw(10) << 1.0/i << setw(10) << rrmean/(iters+1) << setw(12) << std::scientific << std::setprecision(3) << tempdiff << endl;
		rrmean = 0.0;
		rrcntr = 0.0;
	}

	testdiff /= static_cast<double> (num);
	cout << endl;
	cout << "--->  rr() is accurate to within " << std::fixed << testdiff*100 << "% on average." << endl;
}
开发者ID:ohasselblad,项目名称:rrstdmp,代码行数:35,代码来源:rrtester.cpp

示例10: f

void TestCtcExist::test01() {

    Variable x,y;
    Function f(x,y,1.5*sqr(x)+1.5*sqr(y)-x*y-0.2);

    double prec=1e-05;

    NumConstraint c(f,LEQ);
    CtcExist exist_y(c,y,IntervalVector(1,Interval(-10,10)),prec);
    CtcExist exist_x(c,x,IntervalVector(1,Interval(-10,10)),prec);

    IntervalVector box(1,Interval(-10,10));

    RoundRobin rr(1e-03);
    CellStack stack;
    vector<IntervalVector> sols;

    double right_bound=+0.3872983346072957;

    Solver sx(exist_y,rr,stack);
    sx.start(box);
    sx.next(sols);
    // note: we use the fact that the solver always explores the right
    // branch first
    TEST_ASSERT(sols.back()[0].contains(right_bound));

    sols.clear();
    Solver sy(exist_x,rr,stack);
    sy.start(box);
    sy.next(sols);
    // note: we use the fact that the constraint is symmetric in x/y
    TEST_ASSERT(sols.back()[0].contains(right_bound));

}
开发者ID:ClementAubry,项目名称:ibex-lib,代码行数:34,代码来源:TestCtcExist.cpp

示例11: directworm

void directworm(struct wormy *worms, float addx, float addy, float param){ // test directionworm
// change angle randomly within param as max deviation
static float angle=1.0;

xy acc;
angle+=rr(param);
acc.x= cosf(angle*(PI/180.0));
acc.y= sinf(angle*(PI/180.0));


  acc.x=acc.x*worms->speed;
  acc.y=acc.y*worms->speed;
  xy vel=worms->vel;
  vel.x+=acc.x;
  vel.y+=acc.y;
  limit(&vel,worms->maxspeed);
  worms->wloc.x+=vel.x;
  worms->wloc.y+=vel.y;

// when hit boundary slowly change angle back or just reverse with larger deviation
if (worms->wloc.x>worms->boundx || worms->wloc.x<addx ) angle=180.0-angle;//-180.0;
if (worms->wloc.y>worms->boundy || worms->wloc.y<addy ) angle=360.0-angle;//-180.0;a
  
//  checkbound(&worms->wloc,worms->boundx,worms->boundy,addx,addy);
  //  worms->acc=acc;
//  worms->vel=vel;

}
开发者ID:microresearch,项目名称:WORM,代码行数:28,代码来源:worming.c

示例12: mapScale

void PathView::drawBackground(QPainter *painter, const QRectF &rect)
{
	if ((_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
	  || !_map) {
		painter->fillRect(rect, Qt::white);
		return;
	}

	qreal scale = mapScale(_zoom);
	QRectF rr(rect.topLeft() * scale, rect.size());
	QPoint tile = mercator2tile(QPointF(rr.topLeft().x(), -rr.topLeft().y()),
	  _zoom);
	QPointF tm = tile2mercator(tile, _zoom);
	QPoint tl = mapToScene(mapFromScene(QPointF(tm.x() / scale,
	  -tm.y() / scale))).toPoint();

	QList<Tile> tiles;
	for (int i = 0; i <= rr.size().width() / Tile::size() + 1; i++) {
		for (int j = 0; j <= rr.size().height() / Tile::size() + 1; j++) {
			tiles.append(Tile(QPoint(tile.x() + i, tile.y() + j), _zoom));
		}
	}

	_map->loadTiles(tiles, _plot);

	for (int i = 0; i < tiles.count(); i++) {
		Tile &t = tiles[i];
		QPoint tp(tl.x() + (t.xy().x() - tile.x()) * Tile::size(),
		  tl.y() + (t.xy().y() - tile.y()) * Tile::size());
		painter->drawPixmap(tp, t.pixmap());
	}
}
开发者ID:tumic0,项目名称:GPXSee,代码行数:32,代码来源:pathview.cpp

示例13: send_data

void send_data( char dout )
{
    char i;
#asm
    comf    dout, F                     // invert the bits for sending
#endasm

    RS232_out = LOW;                    // start bit
    delay1bit();

    for ( i = 8; i > 0; i-- )
    {
        dout = rr( dout );
        RS232_out = Carry;
        delay1bit();
    }

    RS232_out = HIGH;                   // stop bit
    delay1bit();
    /*-----------------10/19/2001 12:51PM---------------
     * ## WARNING ## without the nop() after the above
     * function call the code generated for the function
     * call was a GOTO and not a CALL.  The return from
     * this function was also not generated.
     * --------------------------------------------------*/
    nop();
}
开发者ID:Team4550,项目名称:PIC_Code,代码行数:27,代码来源:509serv2.c

示例14: children

void QWidget::updateOverlappingChildren() const
{
    if ( overlapping_children != -1 || isSettingGeometry )
	return;

    QRegion r;
    const QObjectList *c = children();
    if ( c ) {
	QObjectListIt it(*c);
	QObject* ch;
	while ((ch=it.current())) {
	    ++it;
	    if ( ch->isWidgetType() && !((QWidget*)ch)->isTopLevel() ) {
		QWidget *w = (QWidget *)ch;
		if ( w->isVisible() ) {
		    QRegion rr( w->req_region );
		    QRegion ir = r & rr;
		    if ( !ir.isEmpty() ) {
			overlapping_children = 1;
			return;
		    }
		    r |= rr;
		}
	    }
	}
    }
    overlapping_children = 0;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:28,代码来源:qwidget_qws.cpp

示例15: caret_size

// InvalidateRange is an overrideable function that is used to invalidate the view
// between two caret positions.  This is used to invalidate bits of the window
// when the selection is changed (using mouse selection or with SetSel()).
// The default behaviour invalidates the lines (whole width of document) from
// the top of start to the bottom of end (using the current character height).
void CScrView::InvalidateRange(CPointAp start, CPointAp end, bool f /*=false*/)
{
	if (start.y > scrollpos_.y + win_height_ || start.x > scrollpos_.x + win_width_ ||
		end.y < scrollpos_.y || end.x < scrollpos_.x)
	{
		// All outside display area so do nothing.  Note that this may appear to not be nec.
		// as Windows does this too but due to overflow problems is safer to do it here.
		return;
	}

	CSizeAp ss = caret_size();

	// Also invalidate a row above and up to 3 rows below (this is necessary for stacked mode)
	start.y -= ss.cy;
	end.y += 3*ss.cy;

	if (start.x < scrollpos_.x) start.x = scrollpos_.x;
	if (start.y < scrollpos_.y) start.y = scrollpos_.y;
	if (end.y > scrollpos_.y + win_height_)
		end.y = scrollpos_.y + win_height_;

	// Invalidate the full width of display from top of start to bottom of end
	CRectAp rr(0, start.y, total_.cx, end.y);

	// Convert to device coords
	CRect norm_rect = ConvertToDP(rr);

	CRect cli;
	GetDisplayRect(&cli);

	// Invalidate the previous selection so that it is drawn unselected
	CRect rct;
	if (rct.IntersectRect(&cli, &norm_rect))
		DoInvalidateRect(&norm_rect);
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:40,代码来源:ScrView.cpp


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