您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xy函数代码示例

51自学网 2021-06-03 11:53:50
  C++
这篇教程C++ xy函数代码示例写得很实用,希望能帮到您。

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

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

示例1: main

/* * Diagram "F", SQED, unbroken SUSY, * Gauge sector. */main(){  page                   pg;  FeynDiagram            fd(pg);#define RAD    2.5  fd.line_thickness.set(0.15);  fd.vertex_thickness.set(0.15);  /* define the left and the right external points */  xy                     el(-6, 0), er(6, 0);  xy              arcpt1(RAD, 0);    arcpt1.rotate(90); arcpt1 += xy(0,RAD);  arcpt1 += xy(0, GAUGE_LIFT1);  /* the LV vertex */  xy                     lv_coord(0, GAUGE_LIFT1);  vertex_circlecross     v1(fd, lv_coord);          /* photon line propagators */  line_wiggle            ph1(fd, el, er); ph1.width.scale(0.7);  line_plain             f1(fd, v1, v1);  /* stretch it to be an arc */  f1.arcthru(arcpt1);  pg.output();  return 0;}
开发者ID:pasha-bolokhov,项目名称:sqed,代码行数:36,


示例2: doMove

// Move from a location into a given direction.// The field is updated in place.// Returns the target location, -1 if the move is illegalint doMove(field f, location from, direction d) {  unsigned x = X(from);  unsigned y = Y(from);  color c = COLOR(f[from]);  int dx = 0;  int dy = 0;  unsigned x2, y2;  switch (d) {  case NORTH: dy = -1; break;  case SOUTH: dy = 1; break;  case WEST: dx = -1; break;  case EAST: dx = 1; break;  }  x2 = x + dx;  y2 = y + dy;  while (!(f[xy(x, y)] & d) && !COLOR(f[xy(x2, y2)])) {    x = x2;    y = y2;    x2 += dx;    y2 += dy;  }  if (x == X(from) && y == Y(from)) {    return -1;  }  f[from] = WALLS(f[from]);  f[xy(x, y)] |= c << 4;  return xy(x, y);}
开发者ID:mathiask,项目名称:robosolver,代码行数:31,


示例3: sizeof

PJ *PROJECTION(imw_p) {    double del, sig, s, t, x1, x2, T2, y1, m1, m2, y2;    int err;    struct pj_opaque *Q = static_cast<struct pj_opaque*>(pj_calloc (1, sizeof (struct pj_opaque)));    if (nullptr==Q)        return pj_default_destructor (P, ENOMEM);    P->opaque = Q;    if (!(Q->en = pj_enfn(P->es))) return pj_default_destructor (P, ENOMEM);    if( (err = phi12(P, &del, &sig)) != 0) {        return destructor(P, err);    }    if (Q->phi_2 < Q->phi_1) { /* make sure P->phi_1 most southerly */        del = Q->phi_1;        Q->phi_1 = Q->phi_2;        Q->phi_2 = del;    }    if (pj_param(P->ctx, P->params, "tlon_1").i)        Q->lam_1 = pj_param(P->ctx, P->params, "rlon_1").f;    else { /* use predefined based upon latitude */        sig = fabs(sig * RAD_TO_DEG);        if (sig <= 60)      sig = 2.;        else if (sig <= 76) sig = 4.;        else                sig = 8.;        Q->lam_1 = sig * DEG_TO_RAD;    }    Q->mode = NONE_IS_ZERO;    if (Q->phi_1 != 0.0)        xy(P, Q->phi_1, &x1, &y1, &Q->sphi_1, &Q->R_1);    else {        Q->mode = PHI_1_IS_ZERO;        y1 = 0.;        x1 = Q->lam_1;    }    if (Q->phi_2 != 0.0)        xy(P, Q->phi_2, &x2, &T2, &Q->sphi_2, &Q->R_2);    else {        Q->mode = PHI_2_IS_ZERO;        T2 = 0.;        x2 = Q->lam_1;    }    m1 = pj_mlfn(Q->phi_1, Q->sphi_1, cos(Q->phi_1), Q->en);    m2 = pj_mlfn(Q->phi_2, Q->sphi_2, cos(Q->phi_2), Q->en);    t = m2 - m1;    s = x2 - x1;    y2 = sqrt(t * t - s * s) + y1;    Q->C2 = y2 - T2;    t = 1. / t;    Q->P = (m2 * y1 - m1 * y2) * t;    Q->Q = (y2 - y1) * t;    Q->Pp = (m2 * x1 - m1 * x2) * t;    Q->Qp = (x2 - x1) * t;    P->fwd = e_forward;    P->inv = e_inverse;    P->destructor = destructor;    return P;}
开发者ID:Navionics,项目名称:proj.4,代码行数:59,


示例4: createSamples

void RBFVectorFieldGenerator2D::process() {    if (samples_.size() != static_cast<size_t>(seeds_.get())) {        createSamples();    }    Eigen::MatrixXd A(seeds_.get(), seeds_.get());    Eigen::VectorXd bx(seeds_.get()), by(seeds_.get());    Eigen::VectorXd xx(seeds_.get()), xy(seeds_.get());    int row = 0;    for (auto &a : samples_) {        int col = 0;        for (auto &b : samples_) {            auto r = glm::distance(a.first, b.first);            A(row, col++) = shape_.get() + gaussian_.evaluate(r);        }        bx(row) = a.second.x;        by(row++) = a.second.y;    }    auto solverX = A.llt();    auto solverY = A.llt();    xx = solverX.solve(bx);    xy = solverY.solve(by);    auto img = std::make_shared<Image>(size_.get(), DataVec4Float32::get());    vec4 *data =        static_cast<vec4 *>(img->getColorLayer()->getEditableRepresentation<LayerRAM>()->getData());    int i = 0;    for (int y = 0; y < size_.get().y; y++) {        for (int x = 0; x < size_.get().x; x++) {            dvec2 p(x, y);            p /= size_.get();            p *= 2;            p -= 1;            vec3 v(0, 0, 0);            int s = 0;            for (; s < seeds_.get(); s++) {                double r = glm::distance(p, samples_[s].first);                auto w = gaussian_.evaluate(r);                v.x += static_cast<float>(xx(s) * w);                v.y += static_cast<float>(xy(s) * w);            }            data[i++] = vec4(v, 1.0f);        }    }    vectorField_.setData(img);}
开发者ID:ResearchDaniel,项目名称:inviwo,代码行数:52,


示例5: Interpolation1D

  Interpolation1D(const Interpolation1D& f1, const Interpolation1D& f2,		  BinOp op, double epsilon = 0,		  Interpolator interp = Interpolator()):    m_interp(interp), m_ydef(op(0,f1.m_ydef,f2.m_ydef)), m_xy()  {    for(typename xy_vec_type::const_iterator i1 =      f1.m_xy.begin(), i2=f2.m_xy.begin();      i1!=f1.m_xy.end() || i2!=f2.m_xy.end();)    {    	typename xy_vec_type::const_iterator i;    	if(i2==f2.m_xy.end() || (i1!=f1.m_xy.end() && i1->first<i2->first))    	  i = i1++;    	else    	  i = i2++;    	if(m_xy.empty() || fabs(i->first - m_xy.back().first)>epsilon)  	  {  	    xy_type xy(i->first, op(i->first, f1(i->first), f2(i->first)));#if 0        std::cout << i->first << ' ' << f1(i->first) << ' ' << f2(i->first)          << ' ' << op(i->first, f1(i->first), f2(i->first)) << '/n';#endif  	    m_xy.push_back(xy);  	  }    }  }
开发者ID:sfegan,项目名称:calin,代码行数:25,


示例6: DrawRect

void DrawRect(int x, int y, int width, int height, uint8 r, uint8 g, uint8 b){    int right = x + width;    int bottom = y + height;    if (x < 0)        x = 0;    if (y < 0)        y = 0;    if (right > (int32)s3eSurfaceGetInt(S3E_SURFACE_WIDTH))        right = s3eSurfaceGetInt(S3E_SURFACE_WIDTH);    if (bottom > (int32)s3eSurfaceGetInt(S3E_SURFACE_HEIGHT))        bottom = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT);    // Draw the text    IwGxSetScreenSpaceSlot(0);    CIwMaterial *fadeMat = IW_GX_ALLOC_MATERIAL();    fadeMat->SetAlphaMode(CIwMaterial::NONE);    fadeMat->SetShadeMode(CIwMaterial::SHADE_FLAT);    IwGxSetMaterial(fadeMat);    CIwColour* cols = IW_GX_ALLOC(CIwColour, 4);    for (int i = 0; i < 4; i++)        cols[i].Set(r, g, b);    CIwSVec2 xy(x, y);    CIwSVec2 wh(width, height);    IwGxDrawRectScreenSpace(&xy, &wh, cols);}
开发者ID:Nazulu,项目名称:s3eAndroidFullscreen,代码行数:29,


示例7: draw_level

/* **draw/_level()** draws the game frames, using * the content of the level (the wizard, level tiles, monsters, etc..). * It uses the level_data stored inside the data arg as well * as the LEVEL string that represents the level map using * ascii chars as tiles index; */static void draw_level(void* data, float elapsed_ms){    struct level_data* ldata = data;    struct rectangle tile_size = { 0, 0, 16, 16 };    unsigned int i;    char fps[10];    sprintf(fps, "FPS:%02.0f", 1000 / elapsed_ms);    if (ldata->wizard->sprite->active_animation == ldata->wizard->spell) {        if (ldata->wizard->sprite->current_frame > 1) shake_screen(elapsed_ms);    } else {        relax_screen(elapsed_ms);    }    for (i = 0; i < strlen(LEVEL); i++) {        if (LEVEL[i] != ' ') {            int x = 16 * (i % 13);            int y = 16 * (i / 13);            draw_image(LEVEL[i] == '-' ? ldata->grass_tile : ldata->earth_tile,                       x, y, &tile_size, 0);        }    }    draw_sprite(ldata->tree.sprite, 100, 56);    draw_sprite(ldata->wizard->sprite,                xy(ldata->wizard->pos.x, ldata->wizard->pos.y));    draw_text(ldata->font, fps, 75, 3);}
开发者ID:dmalves,项目名称:cage,代码行数:35,


示例8: xy

void widget::rect(const Rect& rect){    Rect r = rect.normalize();    xy(r.left_top());    size(r.size());}
开发者ID:goalizc,项目名称:takisy,代码行数:7,


示例9: window

bool widget::as_window(cross_platform_window::Handle handle){    if (father())        return false;    if (is_window())        return true;    if (handle)    {        if (takisy::all_windows__.find(handle) == takisy::all_windows__.end())        {            cross_platform_window window(handle);            window.xy(xy() - window.client_offset());            window.client_size(size());            window.visible(visible());            window.repaint();            takisy::all_windows__[handle] = this;        }    }    else    {        handle = takisy::handleFromLPWIDGET(this);        if (handle)        {            takisy::all_windows__.erase(handle);            cross_platform_window(handle).repaint();        }    }    return true;}
开发者ID:goalizc,项目名称:takisy,代码行数:35,


示例10: repaint

void widget::xy(Point _xy){    if (!onMoving(_xy))        return;    if (impl_->father_ && !impl_->father_->onChildMoving(this, _xy))        return;    if (_xy == xy())        return;    cross_platform_window::Handle handle = takisy::handleFromLPWIDGET(this);    if (!handle)    {        repaint();        impl_->rect_ = impl_->rect_.move(_xy);        repaint();    }    else        impl_->rect_ = impl_->rect_.move(_xy);    onMove();    if (impl_->father_)        impl_->father_->onChildMove(this);    if (handle)    {        cross_platform_window window(handle);        window.xy(_xy - window.client_offset());    }}
开发者ID:goalizc,项目名称:takisy,代码行数:30,


示例11: op_drawline

P op_drawline(void){#if X_DISPLAY_MISSING	return NO_XWINDOWS;#else  B *xyf, *freevm;   P retc, k;  if (dvtdisplay == NULL) return NO_XWINDOWS;  if (o_1 < FLOORopds) return OPDS_UNF;  freevm = FREEvm;  if ((retc = coloropd()) != OK) return retc;  if ((retc = xy(&xyf,&freevm)) != OK) return retc;  if (ARRAY_SIZE(xyf) < 4) return RNG_CHK;  if (o_1 < FLOORopds) return (OPDS_UNF);  if (CLASS(o_1) != NUM) return OPD_CLA;  if (!PVALUE(o_1,&wid)) return UNDF_VAL;  FREEopds = o_1;  for (k = 0; k < ndvtwindows; k++)    if (dvtwindows[k] == wid) break;  if (k >= ndvtwindows) return OK;  HXDrawLines(dvtdisplay,wid,dvtgc,(XPoint *)VALUE_BASE(xyf),             ARRAY_SIZE(xyf)>>1, CoordModeOrigin);  return OK;#endif}
开发者ID:apeyser,项目名称:Deuterostome,代码行数:27,


示例12: xy

bool IfcGeom::profile_helper(int numVerts, double* verts, int numFillets, int* filletIndices, double* filletRadii, gp_Trsf2d trsf, TopoDS_Face& face) {	TopoDS_Vertex* vertices = new TopoDS_Vertex[numVerts];		for ( int i = 0; i < numVerts; i ++ ) {		gp_XY xy (verts[2*i],verts[2*i+1]);		trsf.Transforms(xy);		vertices[i] = BRepBuilderAPI_MakeVertex(gp_Pnt(xy.X(),xy.Y(),0.0f));	}	BRepBuilderAPI_MakeWire w;	for ( int i = 0; i < numVerts; i ++ )		w.Add(BRepBuilderAPI_MakeEdge(vertices[i],vertices[(i+1)%numVerts]));	IfcGeom::convert_wire_to_face(w.Wire(),face);	if ( numFillets && *std::max_element(filletRadii, filletRadii + numFillets) > 1e-7 ) {		BRepFilletAPI_MakeFillet2d fillet (face);		for ( int i = 0; i < numFillets; i ++ ) {			const double radius = filletRadii[i];			if ( radius <= 1e-7 ) continue;			fillet.AddFillet(vertices[filletIndices[i]],radius);		}		fillet.Build();		if (fillet.IsDone()) {			face = TopoDS::Face(fillet.Shape());		} else {			Logger::Message(Logger::LOG_WARNING, "Failed to process profile fillets");		}	}	delete[] vertices;	return true;}
开发者ID:iwataka,项目名称:IfcOpenShell-JNI,代码行数:33,


示例13: op_fillrectangle

P op_fillrectangle(void){#if X_DISPLAY_MISSING	return NO_XWINDOWS;#else  B *xyf, *freevm;   P retc, k;  if (dvtdisplay == NULL) return NO_XWINDOWS;  freevm = FREEvm;  if ((retc = coloropd()) != OK) return retc;  if ((retc = xy(&xyf,&freevm)) != OK) return retc;  if (ARRAY_SIZE(xyf) != 4) return RNG_CHK;  if (o_1 < FLOORopds) return (OPDS_UNF);  if (CLASS(o_1) != NUM) return OPD_CLA;  if (!PVALUE(o_1,&wid)) return UNDF_VAL;  FREEopds = o_1;  for (k = 0; k < ndvtwindows; k++)     if (dvtwindows[k] == wid) break;  if (k >= ndvtwindows) return OK;  HXFillRectangles(dvtdisplay,wid,dvtgc,(XRectangle *)VALUE_BASE(xyf),1);  return OK;#endif}
开发者ID:apeyser,项目名称:Deuterostome,代码行数:26,


示例14: frameRect

	QRectF frameRect(const QRectF &area, const QPoint &off = {0, 0}, QRectF *letterbox = nullptr) {		QRectF rect = area;		if (p->hasFrame()) {			const double aspect = p->targetAspectRatio();			QSizeF frame(aspect, 1.0), letter(p->targetCropRatio(aspect), 1.0);			letter.scale(area.width(), area.height(), Qt::KeepAspectRatio);			frame.scale(letter, Qt::KeepAspectRatioByExpanding);			QPointF pos(area.x(), area.y());			pos.rx() += (area.width() - frame.width())*0.5;			pos.ry() += (area.height() - frame.height())*0.5;			rect = {pos, frame};			QPointF xy(area.width(), area.height());			xy.rx() -= letter.width(); xy.ry() -= letter.height();	xy *= 0.5;			QPointF offset = off;			offset.rx() *= letter.width()/100.0;			offset.ry() *= letter.height()/100.0;			if (alignment & Qt::AlignLeft)				offset.rx() -= xy.x();			else if (alignment & Qt::AlignRight)				offset.rx() += xy.x();			if (alignment & Qt::AlignTop)				offset.ry() -= xy.y();			else if (alignment & Qt::AlignBottom)				offset.ry() += xy.y();			rect.translate(offset);			xy += offset;			if (letterbox)				*letterbox = {xy, letter};		}		return rect;	}
开发者ID:akhilo,项目名称:cmplayer,代码行数:32,


示例15: xy

void Render::updateDirection(float x, float y){	float viewHeight = viewer.getCamera()->getViewport()->height();	float viewWidth = viewer.getCamera()->getViewport()->width(); 	y = y - (viewHeight/2);	x = x - (viewWidth/2);	if(viewHeight < viewWidth)	{		y = (y>viewHeight/4)?(viewHeight/4):y;		y = (y<(-viewHeight/4))?-(viewHeight/4):y;		x = (x>viewHeight/4)?(viewHeight/4):x;		x = (x<(-viewHeight/4))?-(viewHeight/4):x;	} else {		y = (y>viewWidth/4)?(viewWidth/4):y;		y = (y<(-viewWidth/4))?-(viewWidth/4):y;		x = (x>viewWidth/4)?(viewWidth/4):x;		x = (x<(-viewWidth/4))?-(viewWidth/4):x;	}	  osg::Vec2f xy(x, y); std::cout << "0Centered-X:  " << x << std::endl;	std::cout << "0Centered-Y:  " << y << std::endl; helicopterThrust = calculateForceDirections(rotorForce, xy);}
开发者ID:cook220j,项目名称:ense470-helicopter,代码行数:26,


示例16: xy

/////////////////////////////// Galvo API/////////////////////////////int RappScanner::PointAndFire(double x, double y, double pulseTime_us){   pointf xy((float) x,(float) y);   bool success = UGA_->ClickAndFire(xy, (int) pulseTime_us, laser2_);   return success ? DEVICE_OK : DEVICE_ERR;}
开发者ID:PI-SRau,项目名称:micro-manager,代码行数:10,


示例17: sp_textpath_to_text

voidsp_textpath_to_text(SPObject *tp){    SPObject *text = SP_OBJECT_PARENT(tp);    NRRect bbox;    sp_item_invoke_bbox(SP_ITEM(text), &bbox, sp_item_i2doc_affine(SP_ITEM(text)), TRUE);    Geom::Point xy(bbox.x0, bbox.y0);    // make a list of textpath children    GSList *tp_reprs = NULL;    for (SPObject *o = SP_OBJECT(tp)->firstChild() ; o != NULL; o = o->next) {        tp_reprs = g_slist_prepend(tp_reprs, SP_OBJECT_REPR(o));    }    for ( GSList *i = tp_reprs ; i ; i = i->next ) {        // make a copy of each textpath child        Inkscape::XML::Node *copy = ((Inkscape::XML::Node *) i->data)->duplicate(SP_OBJECT_REPR(text)->document());        // remove the old repr from under textpath        SP_OBJECT_REPR(tp)->removeChild((Inkscape::XML::Node *) i->data);        // put its copy under text        SP_OBJECT_REPR(text)->addChild(copy, NULL); // fixme: copy id    }    //remove textpath    tp->deleteObject();    g_slist_free(tp_reprs);    // set x/y on text    /* fixme: Yuck, is this really the right test? */    if (xy[Geom::X] != 1e18 && xy[Geom::Y] != 1e18) {        sp_repr_set_svg_double(SP_OBJECT_REPR(text), "x", xy[Geom::X]);        sp_repr_set_svg_double(SP_OBJECT_REPR(text), "y", xy[Geom::Y]);    }}
开发者ID:wdmchaft,项目名称:DoonSketch,代码行数:35,


示例18: handleRequest

 void handleRequest(const Wt::Http::Request& request,                    Wt::Http::Response& response) {     WApplication::UpdateLock app_lock = app_->getUpdateLock();     WMouseEvent::Coordinates xy(-1, -1);     const std::string* xy_str = request.getParameter("MapImageXY");     if (xy_str) {         int comma_pos = xy_str->find(',');         if (comma_pos != std::string::npos) {             std::string x_str = xy_str->substr(1, comma_pos - 1);             std::string y_str = xy_str->substr(comma_pos + 1);             try {                 int x = boost::lexical_cast<int>(x_str);                 int y = boost::lexical_cast<int>(y_str);                 xy = WMouseEvent::Coordinates(x, y);             } catch (...) {             }         }     }     map_image_->clicked().emit(xy);     response.setMimeType("text/html");     response.out() << "<html><head>";     response.out() << "<meta http-equiv='refresh' ";     response.out() << " content='0; url=" << redirect_to_ << "' />";     response.out() << "</head><body></body></html>"; }
开发者ID:NCAR,项目名称:wt-classes,代码行数:25,


示例19: testQLDSolver

  void testQLDSolver()  {    BaseVariable xy("xy",2);    BaseVariable z("z",1);    CompositeVariable T("T", xy, z);    MatrixXd A1(1,1); A1 << 1;    VectorXd b1(1); b1 << -3;    LinearFunction lf1(z, A1, b1);    LinearConstraint c1(&lf1, true);    MatrixXd A2(1,2); A2 << 3,1 ;    VectorXd b2(1); b2 << 0;    LinearFunction lf2(xy, A2, b2);    LinearConstraint c2(&lf2, true);    MatrixXd A3(2,2); A3 << 2,1,-0.5,1 ;    VectorXd b3(2); b3 << 0, 1;    LinearFunction lf3(xy, A3, b3);    LinearConstraint c3(&lf3, false);    QuadraticFunction objFunc(T, Matrix3d::Identity(), Vector3d::Zero(), 0);    QuadraticObjective obj(&objFunc);        QLDSolver solver;    solver.addConstraint(c1);    solver.addConstraint(c2);    solver.addConstraint(c3);    solver.addObjective(obj);    std::cout << "sol = " << std::endl << solver.solve().solution << std::endl << std::endl;    ocra_assert(solver.getLastResult().info == 0);    solver.removeConstraint(c1);    IdentityFunction id(z);    VectorXd lz(1); lz << 1;    VectorXd uz(1); uz << 2;    IdentityConstraint bnd1(&id, lz, uz);    solver.addBounds(bnd1);    std::cout << "sol = " << std::endl << solver.solve().solution << std::endl << std::endl;    ocra_assert(solver.getLastResult().info == 0);    BaseVariable t("t", 2);    VectorXd ut(2); ut << -4,-1;    BoundFunction bf(t, ut, BOUND_TYPE_SUPERIOR);    BoundConstraint bnd2(&bf, false);    solver.addBounds(bnd2);    QuadraticFunction objFunc2(t, Matrix2d::Identity(), Vector2d::Constant(2.71828),0);    QuadraticObjective obj2(&objFunc2);    solver.addObjective(obj2);    std::cout << "sol = " << std::endl << solver.solve().solution << std::endl << std::endl;    ocra_assert(solver.getLastResult().info == 0);    Vector2d c3l(-1,-1);    c3.setL(c3l);    std::cout << "sol = " << std::endl << solver.solve().solution << std::endl << std::endl;    ocra_assert(solver.getLastResult().info == 0);  }
开发者ID:ocra-recipes,项目名称:ocra-recipes,代码行数:60,


示例20: randomScatter

/* RANDOM STUFFS */vector<float> randomScatter(float x, float y, int range){	vector<float> xy(2);	int mrandx = ofRandom(-range,range);	int mrandy = ofRandom(-range,range);	xy[0] =( x + mrandx);	xy[1] = y + mrandy;	return(xy);	}
开发者ID:RecipientCollective,项目名称:KinActor_project,代码行数:10,


示例21: x

void TestGradient::transpose01() {	Variable x(3);	Variable y(3);	Function f(x,y,transpose(x)*y);	double _xy[]={1,2,3,4,5,6};	IntervalVector xy(Vector(6,_xy));	double _g[]={4,5,6,1,2,3};	check(f.gradient(xy),IntervalVector(Vector(6,_g)));	CPPUNIT_ASSERT(f.gradient(xy).is_superset(IntervalVector(Vector(6,_g))));}
开发者ID:dvinc,项目名称:ibex-lib,代码行数:10,


示例22: RenderLine2D

void RenderLine2D(Shader *sh, Primitive prim, const float3 &v1, const float3 &v2, float thickness){    auto v = (v2 - v1) / 2;    auto len = length(v);    auto vnorm = v / len;    auto trans = translation(v1 + v) *                  rotationZ(vnorm.xy()) *                 float4x4(float4(len, thickness / 2, 1, 1));    RenderQuad(sh, prim, true, trans);}
开发者ID:The-Mad-Pirate,项目名称:lobster,代码行数:10,


示例23: Q_ASSERT

void LabelItemDialog::saveDimensions(ViewItem *viewitem) {  Q_ASSERT(viewitem);  LabelItem *item = qobject_cast<LabelItem*>(viewitem);  Q_ASSERT(item);  QPointF xy(_labelDimensionsTab->x(),_labelDimensionsTab->y());  qreal theta = _labelDimensionsTab->rotation();  bool fix_left = _labelDimensionsTab->fixLeft();  if (_labelDimensionsTab->lockPosToData() && item->dataPosLockable()) {    QRectF dr = item->dataRelativeRect();    if (fix_left) {      dr.moveTopLeft(xy);      item->setFixLeft(true);    } else {      dr.moveBottomRight(xy);      item->setFixLeft(false);    }    item->setDataRelativeRect(dr);    bool lockPosToData = _labelDimensionsTab->lockPosToDataDirty() ? _labelDimensionsTab->lockPosToData() : item->lockPosToData();    item->setLockPosToData(lockPosToData);    item->applyDataLockedDimensions();  } else {    QRectF parentRect = item->parentRect();    qreal parentWidth = parentRect.width();    qreal parentHeight = parentRect.height();    qreal parentX = parentRect.x();    qreal parentY = parentRect.y();    bool lockPosToData = _labelDimensionsTab->lockPosToDataDirty() ? _labelDimensionsTab->lockPosToData() : item->lockPosToData();    item->setLockPosToData(lockPosToData);    qreal width = item->rect().width();    qreal height = item->rect().height();    item->setPos(parentX + xy.x()*parentWidth, parentY + xy.y()*parentHeight);    if (fix_left) {      item->setViewRect(0,-height, width, height);      item->setFixLeft(true);    } else {      item->setViewRect(-width,-height, width, height);      item->setFixLeft(false);    }  }  QTransform transform;  transform.rotate(theta);  item->setTransform(transform);  item->updateRelativeSize(true);  if (_saveAsDefault->isChecked()) {    _dialogDefaults->setValue(item->staticDefaultsGroupName()+"/fixLeft",_labelDimensionsTab->fixLeft());  }}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:55,


示例24: VRR_condorcetTable

static void VRR_condorcetTable( VRR* it, FILE* fout, int numw, NameVote* winners ) {	int i, xi, xj;	int* indextr;	fprintf( fout, "<table border=/"1/"><tr><td></td>" );	for ( i = 0; i < numw; i++ ) {		fprintf( fout, "<td>(%d)</td>", i );	}	fprintf( fout, "</tr>" );	indextr = (int*)malloc( sizeof(int)*numw );	assert( indextr != NULL );	for ( i = 0; i < numw; i++ ) {		indextr[i] = nameIndex( it->ni, winners[i].name );	}	for ( xi = 0; xi < numw; xi++ ) {		i = indextr[xi];		fprintf( fout, "<tr><td>(%d) %s</td>", xi, winners[xi].name );		for ( xj = 0; xj < numw; xj++ ) {			int j;			j = indextr[xj];			if ( i == j ) {				fprintf( fout, "<td></td>" );			} else {				int thisw, otherw;				thisw = xy(i,j);				otherw = xy(j,i);				if ( thisw > otherw ) {					fprintf( fout, "<td bgcolor=/"#bbffbb/">");				} else if ( thisw < otherw ) {					fprintf( fout, "<td bgcolor=/"#ffbbbb/">");				} else {					fprintf( fout, "<td>");				}				fprintf( fout, "%d</td>", thisw );			}		}		fprintf( fout, "</tr>" );	}	free( indextr );	indextr = NULL;	fprintf( fout, "</table>" );}
开发者ID:TheProjecter,项目名称:voteutil,代码行数:42,


示例25: xy

void Ansiterm::fill(int x1, int y1, int x2, int y2){ for (int x = x1; x <= x2; x++) {   for (int y = y1; y <= y2; y++)   {     xy(x,y);     Serial.print(' ');   } }}
开发者ID:davidcranor,项目名称:ansiterm,代码行数:11,


示例26: countDefeats

static void countDefeats( VRR* it, int* defeatCount ) {	int i, j;	for ( i = 0; i < it->numc; i++ ) {		defeatCount[i] = 0;	}	for ( i = 0; i < it->numc; i++ ) {		for ( j = i + 1; j < it->numc; j++ ) {			int ij, ji;			ij = xy(i,j);			ji = xy(j,i);			if ( ij > ji ) {				defeatCount[j]++;			} else if ( ji > ij ) {				defeatCount[i]++;			} else {				// tie policy?			}		}	}}
开发者ID:TheProjecter,项目名称:voteutil,代码行数:20,


示例27: pow

void DataMangler::AverageValues(XYGraph *graph) {	double pvx = pow(0.1, m_di[0]->GetPrec());	int count;	double slice;	double dif = graph->m_dmax[0] - graph->m_dmin[0];	if (dif < pvx) {		count = 1;		slice = pvx;	} else {		count = 0;		while (dif / count > pvx && count < 20)			++count;		slice = dif / count;	}	std::deque<double> sums(count, 0);	std::deque<int> counts(count, 0);	std::deque< std::vector<DTime> > ptimes(count);	for (size_t i = 0; i < graph->m_points_values.size(); ++i) {		double& x = graph->m_points_values.at(i).first[0];		double& y = graph->m_points_values.at(i).first[1];		std::vector<DTime> &times = graph->m_points_values.at(i).second;		int idx = int((x - graph->m_dmin[0] - slice / 2) * count / dif);		if (idx < 0)			idx = 0;		if (idx >= count)			idx = count - 1;		counts[idx]++;		sums[idx] += y; 		for(unsigned int j = 0; j < times.size(); j++)			ptimes[idx].push_back(times[j]);	}	graph->m_points_values.clear();	for (int i = 0; i < count; ++i) {		int c = counts[i];		if (c == 0)			continue;		std::vector<double> xy(2);		xy[0] = graph->m_dmin[0] + dif * i / count;		xy[1] = sums[i] / c;		graph->m_points_values.push_back(XYPoint(xy, ptimes[i]));	}			}
开发者ID:cyclefusion,项目名称:szarp,代码行数:54,


示例28: sql

    template<> ACQRSCONTROLSSHARED_EXPORT    bool    counting_data_writer_< acqrscontrols::threshold_result_< acqrscontrols::ap240::waveform > >::write( adfs::filesystem& fs ) const    {        if ( auto accessor = dynamic_cast< threshold_result_accessor_type * >( accessor_.get() ) ) {            if ( auto rp = accessor->data() ) { // std::shared_ptr< const acqrscontrols::u5303a::threshold_result >                                auto wp = rp->data();  // waveform                                do {                    adfs::stmt sql( fs.db() );                                        sql.prepare( "INSERT INTO trigger ( id,protocol,timeSinceEpoch,elapsedTime,events,threshold,algo ) VALUES (?,?,?,?,?,?,?)" );                    int id(1);                    sql.bind( id++ ) = wp->serialnumber_;                    sql.bind( id++ ) = wp->method_.protocolIndex();                    sql.bind( id++ ) = wp->timeSinceEpoch_;                    sql.bind( id++ ) = wp->meta_.initialXTimeSeconds;                    sql.bind( id++ ) = wp->wellKnownEvents_;                    sql.bind( id++ ) = rp->threshold_level();  // V                    sql.bind( id++ ) = int( rp->algo() );                    if ( sql.step() != adfs::sqlite_done ) {                        ADDEBUG() << "sql error";                        return true;                    }                } while ( 0 );                do {                    adfs::stmt sql( fs.db() );                    for ( auto& idx : rp->indices2() ) {                        sql.prepare( "INSERT INTO peak"                                     " (idTrigger,peak_time,peak_intensity,front_offset,front_intensity,back_offset,back_intensity )"                                     " VALUES (?,?,?,?,?,?,?)" );                        int id = 1;                        auto apex  = wp->xy( idx.apex );                                                sql.bind( id++ ) = wp->serialnumber_;                                   // idTrigger                        sql.bind( id++ ) = apex.first;                                          // peak_time                        sql.bind( id++ ) = wp->toVolts( apex.second ) * std::milli::den;        // peak_intensity, mV                        sql.bind( id++ ) = idx.first - idx.apex;                                // distance between front and apex                        sql.bind( id++ ) = wp->toVolts( (*wp)[ idx.first ] ) * std::milli::den; // front mV                        sql.bind( id++ ) = idx.second - idx.apex;                               // distance between apex and back                        sql.bind( id++ ) = wp->toVolts( (*wp)[ idx.second ] ) * std::milli::den;// front mV                        if ( sql.step() != adfs::sqlite_done ) {                            ADDEBUG() << "sql error";                            return true;                                                        }                         }                } while ( 0 );            }        }        return true;     }
开发者ID:qtplatz,项目名称:qtplatz,代码行数:53,



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


C++ xzalloc函数代码示例
C++ xxstrdup函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。