本文整理汇总了C++中cr函数的典型用法代码示例。如果您正苦于以下问题:C++ cr函数的具体用法?C++ cr怎么用?C++ cr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
void main()
{
std::ifstream instream;
int cases;
instream.open("input.txt");
instream >> cases;
for (int i = 0; i < cases; i++)
{
cross_line cr(instream);
cr.check();
}
}
开发者ID:myunghakLee,项目名称:2015-Cpp-programming,代码行数:16,代码来源:h072(main).cpp
示例2: findFloodReach
static
void findFloodReach(const RoseBuildImpl &tbi, const RoseVertex v,
set<CharReach> &flood_reach) {
for (u32 lit_id : tbi.g[v].literals) {
const ue2_literal &s = tbi.literals.right.at(lit_id).s;
if (s.empty()) {
continue;
}
if (is_flood(s)) {
CharReach cr(*s.begin());
DEBUG_PRINTF("flood-prone with reach: %s\n",
describeClass(cr).c_str());
flood_reach.insert(cr);
}
}
}
开发者ID:01org,项目名称:hyperscan,代码行数:16,代码来源:rose_build_lookaround.cpp
示例3: cr
void ChaserRunner_Test::initial()
{
ChaserRunner cr(m_doc, m_chaser);
QCOMPARE(cr.m_doc, m_doc);
QCOMPARE(cr.m_chaser, m_chaser);
QCOMPARE(cr.m_updateOverrideSpeeds, false);
QCOMPARE(cr.m_direction, Function::Forward);
QCOMPARE(cr.m_currentFunction, (Function*) NULL);
QCOMPARE(cr.m_elapsed, quint32(0));
QCOMPARE(cr.m_next, false);
QCOMPARE(cr.m_previous, false);
QCOMPARE(cr.m_currentStep, 0);
QCOMPARE(cr.m_newCurrent, -1);
QCOMPARE(cr.m_intensity, qreal(1.0));
}
开发者ID:Jeija,项目名称:qlcplus,代码行数:16,代码来源:chaserrunner_test.cpp
示例4: clipRect
bool RenderThemeSymbian::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
i.context->save();
IntRect clipRect(intersection(r, i.rect));
i.context->clip(clipRect);
EAppearance appearance = o->style()->appearance();
IntRect innerRect(r);
IntSize cr(1,1);
for (int j = 4; j > 0; --j) {
innerRect.setSize(innerRect.size() - IntSize(1,1));
i.context->fillRoundedRect(innerRect, IntSize(1,1), IntSize(1,1), IntSize(1,1), IntSize(1,1), Color(226 - j*10, 226 - j*10, 226 - j*2));
}
i.context->restore();
return false;
}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:16,代码来源:RenderThemeSymbian.cpp
示例5: NumericMatrix
NumericMatrix Clmbr::cr4R( double CL, int met,
double incr, int verboseR )
{
if(Model==M3) {
Rcout << model_msg << endl << endl;
return NumericMatrix(0,0);
}
if(CL <=0. || CL >=1.) stop( CLmsg );
const double tmp = SL;
set_SL(1.-CL);
METHOD MET;
if(met==1) MET=GEO; else {
if(met==2) MET=AF; else {
stop( methods2msg );
}
}
double inc;
if( incr == -1 ) inc= xinc; else inc= incr;
const double maxwidth = xs[ns-1] - xs[0] + 2;
const int Nmax = maxwidth/inc + ns + 3;
double* Btmp= Calloc( Nmax*3, double );
const bool verbose = static_cast<bool>( verboseR );
if( verbose )
stop( "dummy argument for dispatch, should be FALSE" );
const int nrows = cr( MET, incr, false, Btmp );
set_SL(tmp);
NumericMatrix bds( nrows, 3 );
for(int i=0;i<nrows;i++) {
bds(i,0) = *(Btmp + 0*nrows + i);
bds(i,1) = *(Btmp + 1*nrows + i);
bds(i,2) = *(Btmp + 2*nrows + i);
}
Free( Btmp );
return bds;
}
开发者ID:cran,项目名称:lm.br,代码行数:47,代码来源:R_interface.cpp
示例6: cr
wxString KissMangaCom::JSRiddle(wxString Script)
{
CurlRequest cr(false);
cr.SetUrl(wxT("http://jsapp.us/ajax"));
cr.SetPostData(wxT("{\"actions\":[{\"action\":\"test\",\"code\":\"") + Script + wxT("\"}]}"));
wxString response;
wxStringOutputStream sos(&response);
cr.SetOutputStream(&sos);
cr.ExecuteRequest();
// open url from response
cr.SetUrl(response.BeforeLast('"').AfterLast('"'));
response = wxEmptyString;
cr.ExecuteRequest();
return response;
}
开发者ID:foecum,项目名称:Hakuneko-comic,代码行数:17,代码来源:KissMangaCom.cpp
示例7: cr
void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix) {
if (!pGraphics)
return;
if (!pRect)
return;
pGraphics->SaveGraphState();
CFX_Color cr(0xFF000000);
pGraphics->SetStrokeColor(&cr);
FX_FLOAT DashPattern[2] = {1, 1};
pGraphics->SetLineDash(0.0f, DashPattern, 2);
CFX_Path path;
path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
pGraphics->StrokePath(&path, pMatrix);
pGraphics->RestoreGraphState();
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:17,代码来源:cfwl_widgettp.cpp
示例8: from
eid PhysicsSystem::RayCastIgnore(eid ign) {
eid cam = 1; // TODO: This hard-coded number should be the active camera id.
last_rayvalid = false;
glm::vec3 position;
if (Entity(cam).Has<Position>()) {
position = (Entity(cam).Get<Position>())->value;
}
glm::quat orientation;
if (Entity(cam).Has<Orientation>()) {
orientation = (Entity(cam).Get<Orientation>())->value;
}
auto fv = position + glm::rotate(orientation, FORWARD_VECTOR * 300.f);
btVector3 from(position.x, position.y, position.z), to(fv.x, fv.y, fv.z);
last_rayfrom = from;
btDynamicsWorld::AllHitsRayResultCallback cr(from, to);
this->dynamicsWorld->rayTest(from, to, cr);
if (cr.hasHit()) {
int mx = cr.m_collisionObjects.size();
double lastfrac = 1.1;
int hc = mx;
eid entity_hit = 0;
for (int i = 0; i < mx; i++) {
eid entity = 0;
double frc = cr.m_hitFractions.at(i);
const CollisionBody* coll = (const CollisionBody*)cr.m_collisionObjects.at(i)->getUserPointer();
if (!coll) continue;
entity = coll->entity_id;
if (entity && entity != cam && entity != ign) {
if (frc < lastfrac) {
entity_hit = entity;
hc = i;
lastfrac = frc;
}
}
}
if (hc < mx) {
last_raypos = cr.m_hitPointWorld.at(hc);
last_raynorm = cr.m_hitNormalWorld.at(hc);
last_raydist = last_rayfrom.distance(last_raypos);
last_rayvalid = true;
return entity_hit;
}
}
return 0;
}
开发者ID:retrograzer,项目名称:tec,代码行数:45,代码来源:physics-system.cpp
示例9: cairo_create
cairo_t* wxGISDisplay::CreateContext(wxDC* dc)
{
cairo_t *cr(NULL);
#ifdef __WXMSW__
//#if CAIRO_HAS_WIN32_SURFACE
HDC hdc = (HDC)dc->GetHDC();
cr = cairo_create(cairo_win32_surface_create( hdc ));
#endif
#ifdef __WXGTK__
wxGraphicsRenderer * const renderer = wxGraphicsRenderer::GetCairoRenderer();
wxWindowDC* pwdc = wxDynamicCast(dc, wxWindowDC);
wxGraphicsContext * gc = renderer->CreateContext(*pwdc);
if(gc)
cr = (cairo_t*)gc->GetNativeContext();
#endif
return cr;
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:18,代码来源:gisdisplay.cpp
示例10: play_note
// add a single note to spectrum
void play_note(int freq, float adsr, fftw_real* out) {
int i=1;
float r, p;
while ( i*freq < N/2 ) {
r = cr(i);
p = cp(i);
// re{ck}
out[freq*i] += adsr * N * r*cos(p);
// im{ck}
out[N-freq*i] += adsr * N * r*sin(p);
i++;
}
}
开发者ID:danilopantani,项目名称:dsp,代码行数:19,代码来源:song.c
示例11: main
int main ( ) {
//TODO: proper replay finding
std::string path_replay = "C:\\replay.osr";
std::string path_beat = "C:\\beatmap.osu";
#ifdef _DEBUG
//b.Debug_printhitobj( );
#endif
CReplay r( path_replay, true );
CBeatmap b;
b.ReadFile( path_beat );
CReplayAnalyze cr( b, r );
return 0;
}
开发者ID:dex73r,项目名称:creplay,代码行数:18,代码来源:creplay.cpp
示例12: cr
FWL_ERR CFWL_GridImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_ERR_Indefinite;
if ((m_pProperties->m_dwStyleExes & FWL_GRIDSTYLEEXT_ShowGridLines) == 0) {
return FWL_ERR_Succeeded;
}
pGraphics->SaveGraphState();
if (pMatrix) {
pGraphics->ConcatMatrix(pMatrix);
}
{
FX_BOOL bDrawLine = FALSE;
CFX_Path path;
path.Create();
int32_t iColumns = m_Columns.GetSize();
for (int32_t i = 1; i < iColumns; i++) {
CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Columns[i]);
if (!pColRow) {
continue;
}
bDrawLine = TRUE;
path.AddLine(pColRow->m_fActualPos, 0, pColRow->m_fActualPos,
m_pProperties->m_rtWidget.height);
}
int32_t iRows = m_Rows.GetSize();
for (int32_t j = 1; j < iRows; j++) {
CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Rows[j]);
if (!pColRow) {
continue;
}
bDrawLine = TRUE;
path.AddLine(0, pColRow->m_fActualPos, m_pProperties->m_rtWidget.width,
pColRow->m_fActualPos);
}
if (bDrawLine) {
CFX_Color cr(0xFFFF0000);
pGraphics->SetStrokeColor(&cr);
pGraphics->StrokePath(&path);
}
}
pGraphics->RestoreGraphState();
return FWL_ERR_Succeeded;
}
开发者ID:JinAirsOs,项目名称:pdfium,代码行数:44,代码来源:fwl_gridimp.cpp
示例13: switch
void CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return;
switch (pParams->m_iPart) {
case CFWL_Part::Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
break;
}
case CFWL_Part::Background: {
CFX_Path path;
CFX_RectF& rect = pParams->m_rtPart;
path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
FX_ARGB argb_color;
switch (pParams->m_dwStates) {
case CFWL_PartState_Selected:
argb_color = FWLTHEME_COLOR_BKSelected;
break;
case CFWL_PartState_Disabled:
argb_color = FWLTHEME_COLOR_EDGERB1;
break;
default:
argb_color = 0xFFFFFFFF;
}
pParams->m_pGraphics->SaveGraphState();
CFX_Color cr(argb_color);
pParams->m_pGraphics->SetFillColor(&cr);
pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix);
pParams->m_pGraphics->RestoreGraphState();
break;
}
case CFWL_Part::DropDownButton: {
DrawDropDownButton(pParams, pParams->m_dwStates, &pParams->m_matrix);
break;
}
case CFWL_Part::StretchHandler: {
DrawStrethHandler(pParams, 0, &pParams->m_matrix);
break;
}
default:
break;
}
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:43,代码来源:cfwl_comboboxtp.cpp
示例14: main
int main(int argc, char **argv){
// GtkWidget *window;
//
// Mat a;
// gtk_init(&argc, &argv);
//
// window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// gtk_widget_show(window);
//
// gtk_main();
//
// return(0);
ros::init(argc,argv,"facedetect");
cv::namedWindow(WINDOW);
cspm_robot cr("/image/camera");
ros::spin();
return 0;
}
开发者ID:SilverBulletmdc,项目名称:cspm,代码行数:19,代码来源:main.cpp
示例15: HGSetBrush
void
HGSetBrush(int mode)
{
register int printed = 0;
if (linmod != style[--mode]) {
/* Groff doesn't understand \Ds, so we take it out */
/* printf ("\\D's %du'", linmod = style[mode]); */
linmod = style[mode];
printed = 1;
}
if (linethickness != thick[mode]) {
linethickness = thick[mode];
printf("\\h'-%.2fp'\\D't %.2fp'", linethickness, linethickness);
printed = 1;
}
if (printed)
cr();
}
开发者ID:0xffffffRabbit,项目名称:NextBSD-1,代码行数:19,代码来源:hgraph.cpp
示例16: cr
void ChaserRunner_Test::writeBackwardPingPongZero()
{
m_chaser->setDirection(Function::Backward);
m_chaser->setRunOrder(Function::PingPong);
ChaserRunner cr(m_doc, m_chaser);
MasterTimer timer(m_doc);
QVERIFY(cr.write(&timer, NULL) == true);
timer.timerTick();
QCOMPARE(timer.m_functionList.size(), 1);
QCOMPARE(timer.m_functionList[0], m_scene3);
QVERIFY(cr.write(&timer, NULL) == true);
timer.timerTick();
QCOMPARE(timer.m_functionList.size(), 1);
QCOMPARE(timer.m_functionList[0], m_scene2);
QVERIFY(cr.write(&timer, NULL) == true);
timer.timerTick();
QCOMPARE(timer.m_functionList.size(), 1);
QCOMPARE(timer.m_functionList[0], m_scene1);
QVERIFY(cr.write(&timer, NULL) == true);
timer.timerTick();
QCOMPARE(timer.m_functionList.size(), 1);
QCOMPARE(timer.m_functionList[0], m_scene2);
QVERIFY(cr.write(&timer, NULL) == true);
timer.timerTick();
QCOMPARE(timer.m_functionList.size(), 1);
QCOMPARE(timer.m_functionList[0], m_scene3);
QVERIFY(cr.write(&timer, NULL) == true);
timer.timerTick();
QCOMPARE(timer.m_functionList.size(), 1);
QCOMPARE(timer.m_functionList[0], m_scene2);
QVERIFY(cr.write(&timer, NULL) == true);
timer.timerTick();
QCOMPARE(timer.m_functionList.size(), 1);
QCOMPARE(timer.m_functionList[0], m_scene1);
}
开发者ID:massimostolfa90,项目名称:qlcplus,代码行数:43,代码来源:chaserrunner_test.cpp
示例17: assert
void Membrane::computeNodalDisplacements(Real dt, bool rotIncr){
assert(hasRefConf());
// supposes node is updated already
for(int i:{0,1,2}){
Vector3r xy=node->glob2loc(nodes[i]->pos);
// relative tolerance of 1e-6 was too little, in some cases?!
#ifdef MEMBRANE_DEBUG_ROT
if(xy[2]>1e-5*(max(abs(xy[0]),abs(xy[1])))){
LOG_ERROR("local z-coordinate is not zero for node "<<i<<": node->ori="<<AngleAxisr(node->ori).axis()<<" !"<<AngleAxisr(node->ori).angle()<<", xy="<<xy<<", position in global-oriented centroid-origin CS "<<(nodes[i]->pos-node->pos).transpose());
}
#else
assert(xy[2]<1e-5*(max(abs(xy[0]),abs(xy[1]))));
#endif
// displacements
uXy.segment<2>(2*i)=xy.head<2>()-refPos.segment<2>(2*i);
// rotations
if(rotIncr){
// incremental
Vector3r angVelL=node->glob2loc(nodes[i]->getData<DemData>().angVel); // angular velocity in element coords
phiXy.segment<2>(2*i)-=dt*angVelL.head<2>();
// throw std::runtime_error("Incremental rotation (In2_ElastMat_Membrane.rotIncr) is not yet implemented properly.");
} else {
// from total rotation difference
AngleAxisr aa(refRot[i].conjugate()*(nodes[i]->ori.conjugate()*node->ori));
/* aa sometimes gives angle close to 2π for rotations which are actually small and negative;
I posted that question at http://forum.kde.org/viewtopic.php?f=74&t=110854 .
Such a result is fixed by conditionally subtracting 2π:
*/
if(aa.angle()>M_PI) aa.angle()-=2*M_PI;
Vector3r rot=Vector3r(aa.angle()*aa.axis()); // rotation vector in local coords
// if(aa.angle()>3)
if(rot.head<2>().squaredNorm()>3.1*3.1) LOG_WARN("Membrane's in-plane rotation in a node is > 3.1 radians, expect unstability!");
phiXy.segment<2>(2*i)=rot.head<2>(); // drilling rotation discarded
#ifdef MEMBRANE_DEBUG_ROT
AngleAxisr rr(refRot[i]);
AngleAxisr cr(nodes[i]->ori.conjugate()*node->ori);
LOG_TRACE("node "<<i<<"\n refRot : "<<rr.axis()<<" !"<<rr.angle()<<"\n currRot: "<<cr.axis()<<" !"<<cr.angle()<<"\n diffRot: "<<aa.axis()<<" !"<<aa.angle());
drill[i]=rot[2];
currRot[i]=nodes[i]->ori.conjugate()*node->ori;
#endif
}
}
};
开发者ID:Azeko2xo,项目名称:woodem,代码行数:43,代码来源:Membrane.cpp
示例18: cr
void EventWidget::resizeEvent( QResizeEvent *re )
{
// outta here if no changes necessary
if (re && (re->size() == re->oldSize()))
return;
register int xOff, yOff;
register int w, h;
QRect cr(contentsRect());
QRect fr(frameRect());
xOff = fr.left(); yOff = fr.top();
if (useHandle) {
handleFrame->setGeometry(xOff, yOff,
HANDLESIZE, fr.height());
xOff += HANDLESIZE;
} else {
handleFrame->hide();
}
yOff = cr.top();
w = fr.width() - (HANDLESIZE + frameWidth());
// we need to do this initial resize to the new width of the window so
// we see how many lines of text it will take up. Then we can adjust the
// height based on this.
textBox->resize(w, textBox->height());
textBox->fitText();
h = textBox->lines() * textBox->fontMetrics().height();
textBox->setGeometry(xOff, yOff, w,
h <= cr.height() ? h : cr.height());
yOff += h <= cr.height() ? h : cr.height();
h = textBox->height() + MAXPMSIZE;
if (useIcons) {
iconBox->setGeometry(xOff, yOff,
w, h <= cr.height() ?
MAXPMSIZE : cr.height() - textBox->height());
} else {
iconBox->hide();
}
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:42,代码来源:eventwidget.cpp
示例19: RGB
void CDittoWindow::DrawMinimizeBtn(CWindowDC &dc)
{
if(m_bDrawMinimize == false)
{
return;
}
//rows first then columns
int Points[5][6] =
{
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
1,1,1,1,1,0,
1,1,1,1,1,0
};
CPoint ptShift = m_crMinimizeBT.TopLeft();
ptShift.Offset(3, 3);
if(m_bMouseDownOnMinimize)
{
dc.Draw3dRect(m_crMinimizeBT, RGB(255, 255, 255), RGB(255, 255, 255));
CRect cr(m_crMinimizeBT);
cr.DeflateRect(1, 1, 1, 1);
dc.Draw3dRect(cr, RGB(255, 255, 255), RGB(255, 255, 255));
}
else if(m_bMouseOverMinimize)
{
dc.Draw3dRect(m_crMinimizeBT, RGB(255, 255, 255), RGB(255, 255, 255));
}
for (int iRow = 0; iRow < 5; iRow++)
{
for (int iCol = 0; iCol < 6; iCol++)
{
if (Points[iRow][iCol] == 1)
dc.SetPixel(ptShift+CPoint(iCol, iRow), RGB(255, 255, 255));
}
}
}
开发者ID:wilsonr990,项目名称:Ditto-clipboard-manager,代码行数:41,代码来源:DittoWindow.cpp
示例20: PaintHDC
static void PaintHDC(LabelWithCloseWnd *w, HDC hdc, const PAINTSTRUCT& ps)
{
HBRUSH br = CreateSolidBrush(w->bgCol);
FillRect(hdc, &ps.rcPaint, br);
ClientRect cr(w->hwnd);
int x = win::DpiAdjust(w->hwnd, w->padL);
int y = win::DpiAdjust(w->hwnd, w->padT);
UINT opts = ETO_OPAQUE;
if (IsRtl(w->hwnd)) {
opts = opts | ETO_RTLREADING;
}
HGDIOBJ prevFont = NULL;
if (w->font) {
prevFont = SelectObject(hdc, w->font);
}
SetTextColor(hdc, w->txtCol);
SetBkColor(hdc, w->bgCol);
WCHAR *s = win::GetText(w->hwnd);
ExtTextOut(hdc, x, y, opts, NULL, s, (UINT)str::Len(s), NULL);
free(s);
// Text might be too long and invade close button area. We just re-paint
// the background, which is not the pretties but works.
// A better way would be to intelligently truncate text or shrink the font
// size (within reason)
x = w->closeBtnPos.x - win::DpiAdjust(w->hwnd, LABEL_BUTTON_SPACE_DX);
RectI ri(x, 0, cr.dx - x, cr.dy);
RECT r = ri.ToRECT();
FillRect(hdc, &r, br);
DrawCloseButton(hdc, w->closeBtnPos, IsMouseOverClose(w));
DeleteObject(br);
if (w->font) {
SelectObject(hdc, prevFont);
}
}
开发者ID:Nargesf,项目名称:Sumatrapdf,代码行数:41,代码来源:LabelWithCloseWnd.cpp
注:本文中的cr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论