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


C++ Poly::begin方法代码示例

本文整理汇总了C++中Poly::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Poly::begin方法的具体用法?C++ Poly::begin怎么用?C++ Poly::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Poly的用法示例。


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

示例1: insert_cell

  virtual bool insert_cell(const Cell& cell,
			   const std::string& mode,
			   const std::string& separator) {
    bool bold = false;
    int rr = 0, gg = 0, bb = 0;
    if (mode=="+++") {
      rr = HALF_COLOR;
      gg = FULL_COLOR;
      bb = HALF_COLOR;
      bold = true;
    } else if (mode=="---") {
      rr = FULL_COLOR;
      gg = HALF_COLOR;
      bb = HALF_COLOR;
    } else if (mode=="->") {
      rr = HALF_COLOR;
      gg = HALF_COLOR;
      bb = FULL_COLOR;
      bold = true;
    }
    if (rr!=0||gg!=0||bb!=0) {
      Poly<Appearance> appear = sheet.getCellAppearance(x,y);
      if (appear.isValid()) {
	appear->begin();
	appear->setBackgroundRgb16(rr,gg,bb,
				   AppearanceRange::full());
	if (bold) {
	  appear->setWeightBold(true,AppearanceRange::full());
	}
	appear->end();
      }
    }
    x++;
    return true;
  }
开发者ID:3615pipou,项目名称:coopy,代码行数:35,代码来源:Highlighter.cpp

示例2: simplePolygon

void simplePolygon( Poly &p ){
	Point c = centerMass( p ) ;
	for( int i = 0; i < p.size(); i++){
		p[i].ang = atan2( c.x - p[i].x , c.y - p[i].y );
	}
	sort( p.begin(), p.end() );
}
开发者ID:JoseMiguel,项目名称:icpc-training,代码行数:7,代码来源:uva920.cpp

示例3: pos

ReducerPack<Q>::MultipleWithPos::MultipleWithPos(
  const Poly& poly,
  NewConstTerm multipleParam
):
  pos(poly.begin()),
  end(poly.end()),
  current(poly.ring().allocMonomial())
{
  multiple.mono = poly.ring().monoid().alloc().release();
  poly.ring().monoid().copy(*multipleParam.mono, *multiple.mono);
  multiple.coef = multipleParam.coef;
}
开发者ID:Macaulay2,项目名称:mathicgb,代码行数:12,代码来源:ReducerPack.cpp

示例4:

void ReducerHash<Q>::insert(ConstMonoRef multiplier, const Poly& f) {
  mNodesTmp.clear();
  const auto end = f.end();
  for (auto it = f.begin(); it != end; ++it) {
    auto p = mHashTable.insertProduct
      (it.getMonomial(), multiplier, it.getCoefficient());
    if (p.second)
      mNodesTmp.emplace_back(p.first);
  }
  if (!mNodesTmp.empty())
    mQueue.push(mNodesTmp.begin(), mNodesTmp.end());
}
开发者ID:magichowl,项目名称:mathicgb,代码行数:12,代码来源:ReducerHash.cpp

示例5:

void ReducerNoDedup<Q>::insert(ConstMonoRef multiple, const Poly& poly) {
  if (poly.isZero())
    return;
  mLeadTermKnown = false;

  const auto end = poly.end();
  for (auto it = poly.begin(); it != end; ++it) {
    NewTerm t = {it.coef(), mRing.monoid().alloc().release()};
    mRing.monoid().multiply(multiple, it.mono(), *t.mono);
    mQueue.push(t);
  }
}
开发者ID:Macaulay2,项目名称:mathicgb,代码行数:12,代码来源:ReducerNoDedup.cpp

示例6: convexHull

Poly convexHull( Poly p ){
	sort( p.begin(), p.end() );
	int n = p.size(), k = 0;
	Poly h ( 2 * n );
	for( int i = 0; i < n; i++ ){
		while( k >= 2 && ccw( h[k-2], h[k-1], p[i] ) <= 0 ) k--;
		h[k++] = p[i];
	}
	int t = k + 1;
	for( int i = n - 2; i >= 0; i-- ){
		while( k >= t && ccw( h[k-2], h[k-1], p[i] ) <= 0 ) k--;
		h[k++] = p[i];
	}
	h.resize( k - 1 );
	return h;
	
}
开发者ID:JoseMiguel,项目名称:icpc-training,代码行数:17,代码来源:uva10242.cpp

示例7: lining

int lining( Poly p ){
	int n = p.size(), res = 2;
	sort( p.begin(), p.end(), sort_y);
	for( int i = 0; i < n; i++){
		double pd[ n ];
		int k = 0;
		for( int j = i + 1 ; j < n; j++ ){
			pd[ k++ ] = slope( p[j], p[i] );
		}
		sort( pd, pd + k );
		int tmp = 2;
		for( int j = 1; j < k; j++){
			if ( fabs( pd[j] - pd[j-1] ) <= EPS ) tmp++;
			else tmp = 2;
			res = max( tmp , res );
		}
	}
	return res ;
}
开发者ID:JoseMiguel,项目名称:icpc-training,代码行数:19,代码来源:uva270.cpp

示例8: contains

bool contains(const Poly & poly, const Point & p)
{
    bool result = false;
    const auto * prev = &poly.back();
    for(auto i = poly.begin(), end = poly.end(); i != end; ++i)
    {
        const auto * cur = &*i;
        if(cur->y > prev->y)
        {
            auto dy = cur->y - prev->y;
            if(p.y >= prev->y && p.y < cur->y &&
               (p.x - prev->x) * dy <= (p.y - prev->y) * (cur->x - prev->x))
               result = !result;
        } else {
            auto dy = cur->y - prev->y;
            if(p.y < prev->y && p.y >= cur->y &&
               (p.x - prev->x) * dy >= (p.y - prev->y) * (cur->x - prev->x))
               result = !result;
        }
        prev = cur;
    }
    return result;
}
开发者ID:go4and,项目名称:lib,代码行数:23,代码来源:math.hpp

示例9: begin_row

  virtual bool begin_row(const std::string& mode) {
    row_mode = mode;
    bool bold = false;
    int rr = 0, gg = 0, bb = 0;
    if (row_mode=="+++") {
      rr = HALF_COLOR;
      gg = FULL_COLOR;
      bb = HALF_COLOR;
      bold = true;
    } else if (row_mode=="---") {
      rr = FULL_COLOR;
      gg = HALF_COLOR;
      bb = HALF_COLOR;
    } else if (row_mode=="!") {
      rr = HALF_COLOR;
      gg = HALF_COLOR;
      bb = HALF_COLOR;
    } else if (row_mode=="@@") {
      rr = HALF_COLOR;
      gg = FULL_COLOR;
      bb = FULL_COLOR;
      bold = true;
    }
    if (rr!=0||gg!=0||bb!=0) {
      Poly<Appearance> appear = sheet.getRowAppearance(y);
      if (appear.isValid()) {
	appear->begin();
	appear->setBackgroundRgb16(rr,gg,bb,
				   AppearanceRange::full());
	if (bold) {
	  appear->setWeightBold(true,AppearanceRange::full());
	}
	appear->end();
      }
    }
    return true;
  }
开发者ID:3615pipou,项目名称:coopy,代码行数:37,代码来源:Highlighter.cpp

示例10: pos

TournamentReducer::MultipleWithPos::MultipleWithPos
(const Poly& poly, const_term multiple):
  pos(poly.begin()),
  end(poly.end()),
  multiple(allocTerm(poly.ring(), multiple)),
  current(poly.ring().allocMonomial()) {}
开发者ID:ederc,项目名称:mathicgb,代码行数:6,代码来源:TournamentReducer.cpp

示例11: main

int main(){

	int runs;
	scanf("%d",&runs);
	while( runs--){
		int n;
		scanf("%d",&n);
		int R[ n + 1 ];
		Poly p;
		for( int i = 0; i < n; i++){
			int x , y;
			scanf("%d %d",&x,&y);
			p.push_back( Point( x, y ) );
		}
		sort( p.begin(), p.end() );
		for( int i = 0; i < n ; i++ ) {
			p[i].id = i ;
			R[i] = i + 1;
		}
		
		int sig[ n + 1 ];
		int id = 0;
		for( int i = 0; i < n; i++){
			int id = i + 1;
			bool cagao = false;
			for( int j = i + 1; j < n; j++){
				if ( p[i].y < p[j].y ) cagao = true;
				if ( p[j].y > p[id].y ) id = j;
			}
			if ( !cagao ) {
				sig[i] = id;
			}else{
				sig[i] = -1;
			}
		}
		Poly h;
		for( int i = 0; i < n; i++){
			if ( sig[i] != -1 ){
				for( int pos = i ; pos != n; pos = sig[pos] ){
					h.push_back( p[pos] );
				}
				break;
			}
		}
		int s = 0;
		if ( h[0].y < h[1].y) s++;
		double res = 0.0;
		for( int i = s; i < h.size()-1 ; i++){
			// a = h[i], b = h[i+1], c es la interseccion de la recta a,R[a].id
			// con el vector b(b.x+5, b.y)
			Recta ac ( h[i+1], Point( h[i+1].x+5, h[i+1].y ));
			Recta cb ( h[i], p[ R[ h[i].id ] ] );
			bool paralelas = false;
			Point c = ac.intersect( cb ,paralelas );
			res += dist( h[i], c );
		}
		printf("%.2lf\n", res );
		
	}

	return 0;
}
开发者ID:JoseMiguel,项目名称:icpc-training,代码行数:62,代码来源:uva920.cpp


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