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


C++ pp函数代码示例

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


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

示例1: pp

void HairpinSegment::updateGrips(Grip* defaultGrip, QVector<QRectF>& grip) const
      {
      *defaultGrip = Grip::END;

      QPointF pp(pagePos());
      qreal _spatium = spatium();
      qreal x = pos2().x();
      if (x < _spatium)             // minimum size of hairpin
            x = _spatium;
      qreal y = pos2().y();
      QPointF p(x, y);

// Calc QPointF for Grip Aperture
      QTransform doRotation;
      QPointF gripLineAperturePoint;
      qreal h1 = hairpin()->hairpinHeight().val() * spatium() * .5;
      qreal len = sqrt( x * x + y * y );
      doRotation.rotateRadians( asin(y/len) );
      qreal lineApertureX;
      qreal offsetX = 10;                               // Horizontal offset for x Grip
      if(len < offsetX * 3 )                            // For small hairpin, offset = 30% of len
          offsetX = len/3;                              // else offset is fixed to 10

      if( hairpin()->hairpinType() == Hairpin::Type::CRESCENDO )
            lineApertureX = len - offsetX;              // End of CRESCENDO - Offset
        else
            lineApertureX = offsetX;                    // Begin of DECRESCENDO + Offset
      qreal lineApertureH = ( len - offsetX ) * h1/len; // Vertical position for y grip
      gripLineAperturePoint.setX( lineApertureX );
      gripLineAperturePoint.setY( lineApertureH );
      gripLineAperturePoint = doRotation.map( gripLineAperturePoint );
// End calc position grip aperture

      grip[int(Grip::START)].translate( pp );
      grip[int(Grip::END)].translate( p + pp );
      grip[int(Grip::MIDDLE)].translate( p * .5 + pp );
      grip[int(Grip::APERTURE)].translate( gripLineAperturePoint + pp );
      }
开发者ID:thaddeus-loke,项目名称:MuseScore,代码行数:38,代码来源:hairpin.cpp

示例2: prob

double prob(Blob& Y, Blob& p) {
    assert(Y.get_N() == p.get_N());
    assert(Y.get_C() == p.get_C());
    assert(Y.get_H() == p.get_H());
    assert(Y.get_W() == p.get_W());

    double ret = 0;
    int N = Y.get_N();
    int C = Y.get_C();
    vector<int> pp(N, -1);
    vector<int> yy(N, -2);
    mat mpp = p.reshape();
    mat myy = Y.reshape();
    
    for (int i = 0; i < N; ++i) {
        int idx_p = 0, idx_y = 0;
        double max_p = mpp(i,0), max_y = myy(i,0);
        for (int j = 1; j < C; ++j) {
            if (mpp(i, j) > max_p) {
                max_p = mpp(i, j);
                idx_p = j;
            }
            if (myy(i, j) > max_y) {
                max_y = myy(i, j);
                idx_y = j;
            }
        }
        pp[i] = idx_p;
        yy[i] = idx_y;
    }
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        if (pp[i] == yy[i])
            cnt++;
    }
    ret = (double)cnt / (double)N;
    return ret;
}
开发者ID:xenron,项目名称:sandbox-da-Caffe,代码行数:38,代码来源:blob.cpp

示例3: save

    void save(const ColorRanges *srcRanges, RacOut<IO> &rac) const {
        SimpleSymbolCoder<FLIFBitChanceMeta, RacOut<IO>, 24> coder(rac);
        SimpleSymbolCoder<FLIFBitChanceMeta, RacOut<IO>, 24> coderY(rac);
        SimpleSymbolCoder<FLIFBitChanceMeta, RacOut<IO>, 24> coderI(rac);
        SimpleSymbolCoder<FLIFBitChanceMeta, RacOut<IO>, 24> coderQ(rac);
        coder.write_int(1, MAX_PALETTE_SIZE, Palette_vector.size());
//        printf("Saving %lu colors: ", Palette_vector.size());
        prevPlanes pp(2);
        ColorVal min, max;
        for (Color c : Palette_vector) {
                ColorVal Y=std::get<0>(c);
                srcRanges->minmax(0,pp,min,max);
                coderY.write_int(min,max,Y);
                pp[0]=Y; srcRanges->minmax(1,pp,min,max);
                ColorVal I=std::get<1>(c);
                coderI.write_int(min, max, I);
                pp[1]=I; srcRanges->minmax(2,pp,min,max);
                coderQ.write_int(min, max, std::get<2>(c));
//                printf("YIQ(%i,%i,%i)\t", std::get<0>(c), std::get<1>(c), std::get<2>(c));
        }
//        printf("\nSaved palette of size: %lu\n",Palette_vector.size());
        v_printf(5,"[%lu]",Palette_vector.size());
    }
开发者ID:kif,项目名称:FLIF,代码行数:23,代码来源:palette.hpp

示例4: main

int main()
{
	std::ios::sync_with_stdio(false);
	std::map<std::string::size_type, std::vector<std::string>> words;
	std::string line;
	while (std::getline(std::cin, line) && !line.empty()) {
		words[line.size()].push_back(line);
	}

	std::cout << "===" << std::endl
		<< "index" << std::endl;
	for (auto& v : words) {
		std::cout << v.first << std::endl;
	}

	for (auto& v : words) {
		std::sort(std::begin(v.second), std::end(v.second));
		Preprocessor pp(std::move(v.second));
		pp.print_result();
	}

	return 0;
}
开发者ID:lvzheng-labs,项目名称:lab1,代码行数:23,代码来源:preprocess.cpp

示例5: pp

 void context::display_lemma_as_smt_problem(std::ostream & out, unsigned num_antecedents, literal const * antecedents,
                                            unsigned num_eq_antecedents, enode_pair const * eq_antecedents,
                                            literal consequent, const char * logic) const {
     ast_smt_pp pp(m_manager);
     pp.set_benchmark_name("lemma");
     pp.set_status("unsat");
     pp.set_logic(logic);
     for (unsigned i = 0; i < num_antecedents; i++) {
         literal l = antecedents[i];
         expr_ref n(m_manager);
         literal2expr(l, n);
         pp.add_assumption(n);
     }
     for (unsigned i = 0; i < num_eq_antecedents; i++) {
         enode_pair const & p = eq_antecedents[i];
         expr_ref eq(m_manager);
         eq = m_manager.mk_eq(p.first->get_owner(), p.second->get_owner());
         pp.add_assumption(eq);
     }
     expr_ref n(m_manager);
     literal2expr(~consequent, n);
     pp.display_smt2(out, n);
 }
开发者ID:extremecoders-re,项目名称:z3,代码行数:23,代码来源:smt_context_pp.cpp

示例6: pp

void InsertProjectTester::testGroupRequest()
{
    Part pp(0);
    MainDocument part( &pp );
    pp.setDocument( &part );

    addCalendar( part );
    addResourceGroup( part );
    addResource( part );
    addTask( part );
    addGroupRequest( part );

    Project &p = part.getProject();
    QVERIFY( p.numChildren() == 1 );

    Part pp2(0);
    MainDocument part2( &pp2 );
    pp2.setDocument( &part2 );

    part2.insertProject( p, 0, 0 );
    Project &p2 = part2.getProject();
    QVERIFY( p2.childNode( 0 )->resourceGroupRequest( p2.resourceGroupAt( 0 ) ) != 0 );
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:23,代码来源:InsertProjectTester.cpp

示例7: xc

void ReprojectionError3D::computeXc(const T * const _pp, const T * const _distortionParams, const T * const _focals, const T * const _xc, T *residuals) const
{
	Eigen::Map<Eigen::Matrix<T, 3, 1>> xc((T*)_xc);
	Eigen::Map<Eigen::Matrix<T, 2, 1>> pp((T*)_pp);
	Eigen::Map<Eigen::Matrix<T, TDistortionParamVector::RowsAtCompileTime, 1>> distortionParams((T*)_distortionParams);
	Eigen::Map<Eigen::Matrix<T, 2, 1>> focals((T*)_focals);

	if (CeresUtils::ToDouble(xc[2]) <= 0)
	{
		//Negative point
		residuals[0] = T(1e3);
		residuals[1] = T(1e3);
	}
	else
	{
		//Point in front of camera, proceed
		Eigen::Matrix<T,2,1> p;
		CameraModel::ProjectFromWorld(pp, distortionParams, focals, xc, p);

		residuals[0] = (p[0] - T(mImgPoint[0])) / T(mScale);
		residuals[1] = (p[1] - T(mImgPoint[1])) / T(mScale);
	}
}
开发者ID:caomw,项目名称:planecalib,代码行数:23,代码来源:ReprojectionError3DImpl.hpp

示例8: pp

bool Paragraph::Paint(int zoom, Draw& w, int x, int y, int cx, int ymax, PaintInfo& pi,
                      Color paper) const {
	ParaPaint pp(w);
	int bi = style.bullet ? style.bulletindent : 0;
	pp.zoom = zoom;
	pp.posx = x;
	pp.liney = y;
	pp.ymax = ymax;
	pp.lm = DocZoom(zoom, style.lm + bi);
	pp.yl = pi.yl;
	pp.yp = 0;
	pp.paper = paper;
	cx -= DocZoom(zoom, style.lm + style.rm + bi);
	bool r = Format(pp, max(1, cx), zoom);
	if(pi.yl == 0 && pp.yp > 0 && style.bullet)
		style.bullet.Paint(w, x + DocZoom(zoom, style.lm), y,
		                   style.bulletsize.cx ? DocZoom(zoom, style.bulletsize.cx) : pp.bh,
		                   style.bulletsize.cy ? DocZoom(zoom, style.bulletsize.cy) : pp.bh,
						   style.bulletcolor, paper, 0);
	pi.ypos = pp.liney;
	pi.yl = pp.yp;
	return r;
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:23,代码来源:DocTypes.cpp

示例9: V3

void TMesh::SetFromFB(FrameBuffer *fb, PPC *ppc) {

    vertsN = fb->w*fb->h;
    verts = new V3[vertsN];
    cols = new V3[vertsN];

    float z0 = ppc->GetF() / 100.0f;

    for (int v = 0; v < fb->h; v++) {
        for (int u = 0; u < fb->w; u++) {
            int uv = (fb->h-1-v)*fb->w+u;
            if (fb->zb[uv] == 0.0f) {
                verts[uv] = V3(FLT_MAX, FLT_MAX, FLT_MAX);
                cols[uv].setFromColor(fb->Get(u, v));
                continue;
            }
            //V3 pp((float)u+0.5f, (float)v+0.5f, fb->zb[uv]);
            V3 pp((float)u+0.5f, (float)v+0.5f, z0);
            verts[uv] = ppc->UnProject(pp);
            cols[uv].setFromColor(fb->Get(u, v));
        }
    }
}
开发者ID:lazopard,项目名称:The-Engine,代码行数:23,代码来源:tmesh.cpp

示例10: main

int  main() {
  const int N = 1000;
  const unsigned int K = 10;

  Tree tree;
  Random_points_iterator rpit(4,1000.0);
  for(int i = 0; i < N; i++){
    tree.insert(*rpit++);
  }
  Point_d pp(0.1,0.1,0.1,0.1);
  Point_d qq(0.2,0.2,0.2,0.2);
  Iso_box_d query(pp,qq);

  Distance tr_dist;
  Neighbor_search N1(tree, query, 5, 10.0, false); // eps=10.0, nearest=false

  std::cout << "For query rectangle = [0.1, 0.2]^4 " << std::endl
	    <<  "the " << K << " approximate furthest neighbors are: " << std::endl;
  for (Neighbor_search::iterator it = N1.begin();it != N1.end();it++) {
    std::cout << " Point " << it->first << " at distance  " << tr_dist.inverse_of_transformed_distance(it->second) << std::endl;
  }
  return 0;
}
开发者ID:Asuzer,项目名称:cgal,代码行数:23,代码来源:general_neighbor_searching.cpp

示例11: mktmpdir

    std::string mktmpdir(const char *prefix)
    {
      std::string sprefix;
      std::string tmpdir;
      std::string path;
      int         i = 0;

      if (prefix)
        sprefix = prefix;

      do
      {
        tmpdir = sprefix;
        tmpdir += randomstr(7);
        boost::filesystem::path pp(qi::os::tmp(), qi::unicodeFacet());
        pp.append(tmpdir, qi::unicodeFacet());
        path = pp.make_preferred().string(qi::unicodeFacet());
        ++i;
      }
      while (i < TMP_MAX && mkdir(path.c_str(), S_IRWXU) == -1);

      return path;
    }
开发者ID:sanyaade-research-hub,项目名称:libqi,代码行数:23,代码来源:os_posix.cpp

示例12: drawPolyLine

void drawPolyLine( ipl_image_wrapper& ipl_image
                   , const curve_vec_t& curves
                   , bool               is_closed
                   , PIXEL              color
                   , std::size_t        line_width )
{
    const std::size_t num_curves = curves.size();

    boost::scoped_array<int> num_points_per_curve( new int[num_curves] );

    std::size_t total_num_points = 0;
    for( std::size_t i = 0; i < num_curves; ++i )
    {
        num_points_per_curve[i] = curves[i].size();
    }

    // The curve array vector will deallocate all memory by itself.
    cvpoint_array_vec_t pp( num_curves );

    CvPoint** curve_array = new CvPoint*[num_curves];

    for( std::size_t i = 0; i < num_curves; ++i )
    {
        pp[i] = make_cvPoint_array( curves[i] );

        curve_array[i] = pp[i].get();
    }

    cvPolyLine( ipl_image.get()
                , curve_array  // needs to be pointer to C array of CvPoints.
                , num_points_per_curve.get()// int array that contains number of points of each curve.
                , curves.size()
                , is_closed
                , make_cvScalar( color )
                , line_width             );

}
开发者ID:skozacik,项目名称:gil-contributions,代码行数:37,代码来源:drawing.hpp

示例13: MessageFormat

void MessageFormatRegressionTest::Test4118592()
{
    UErrorCode status = U_ZERO_ERROR;
    MessageFormat *mf = new MessageFormat("", status);
    failure(status, "new messageFormat");
    UnicodeString pattern("{0,choice,1#YES|2#NO}");
    UnicodeString prefix("");
    Formattable *objs = 0;

    for (int i = 0; i < 5; i++) {
        UnicodeString formatted;
        formatted = prefix + "YES";
        mf->applyPattern(prefix + pattern, status);
        failure(status, "mf->applyPattern");
        prefix += "x";
        //Object[] objs = mf.parse(formatted, new ParsePosition(0));
        int32_t count = 0;
        ParsePosition pp(0);
        objs = mf->parse(formatted, pp, count);
        UnicodeString pat;
        logln(UnicodeString("") + i + ". pattern :\"" + mf->toPattern(pat) + "\"");
        log(" \"" + formatted + "\" parsed as ");
        if (objs == NULL) 
            logln("  null");
        else {
            UnicodeString temp;
            if(objs[0].getType() == Formattable::kString)
                logln((UnicodeString)"  " + objs[0].getString(temp));
            else
                logln((UnicodeString)"  " + (objs[0].getType() == Formattable::kLong ? objs[0].getLong() : objs[0].getDouble()));
            delete[] objs;

        }
    }

    delete mf;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:37,代码来源:msfmrgts.cpp

示例14: json2xdropq

bool
json2xdropq (str t, str *out, ptr<const pub3::expr_t> cin)
{
  xdr_procpair_t pp (NULL, NULL);
  bool found = 
    json_fetch_constants_t::get_singleton_obj()->lookup_procpair (t, &pp);
  bool ret = false;
  if (found) {
#define BUFSZ 4
    char buf[BUFSZ];
    xdrmem x (buf, BUFSZ, XDR_DECODE);
#undef BUFSZ
    
    XDR *xd = &x;
    
    ptr<json_decoder_t> jd = 
      json_XDR_dispatch_t::get_singleton_obj ()->alloc_decoder (xd);
    
    jd->init_decode (cin->cast_hack_copy ());
    
    // run the standard str2xdr stuff
    void *obj = (*pp.alloc)();
    ret = (*pp.proc) (xd, obj);
    if (ret) {
      xdrsuio xs (XDR_ENCODE, false);
      XDR *xe = &xs;
      ret = (*pp.proc) (xe, obj);
      if (ret) {
	mstr m (xs.uio ()->resid ());
	xs.uio ()->copyout (m);
	*out = m;
      }
    }
    xdr_delete (pp.proc, obj);
  }
  return ret;
}
开发者ID:digideskio,项目名称:okws,代码行数:37,代码来源:json_rpc.C

示例15: load

    bool load(const ColorRanges *srcRanges, RacIn<IO> &rac) {
        SimpleSymbolCoder<FLIFBitChanceMeta, RacIn<IO>, 24> coder(rac);
        SimpleSymbolCoder<FLIFBitChanceMeta, RacIn<IO>, 24> coderY(rac);
        SimpleSymbolCoder<FLIFBitChanceMeta, RacIn<IO>, 24> coderI(rac);
        SimpleSymbolCoder<FLIFBitChanceMeta, RacIn<IO>, 24> coderQ(rac);
        long unsigned size = coder.read_int(1, MAX_PALETTE_SIZE);
//        printf("Loading %lu colors: ", size);
        prevPlanes pp(2);
        ColorVal min, max;
        for (unsigned int p=0; p<size; p++) {
                srcRanges->minmax(0,pp,min,max);
                ColorVal Y=coderY.read_int(min,max);
                pp[0]=Y; srcRanges->minmax(1,pp,min,max);
                ColorVal I=coderI.read_int(min,max);
                pp[1]=I; srcRanges->minmax(2,pp,min,max);
                ColorVal Q=coderQ.read_int(min,max);
                Color c(Y,I,Q);
                Palette_vector.push_back(c);
//                printf("YIQ(%i,%i,%i)\t", std::get<0>(c), std::get<1>(c), std::get<2>(c));
        }
//        printf("\nLoaded palette of size: %lu\n",Palette_vector.size());
        v_printf(5,"[%lu]",Palette_vector.size());
        return true;
    }
开发者ID:kif,项目名称:FLIF,代码行数:24,代码来源:palette.hpp


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