• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ overlap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: compress

static double compress(info * nl, int nn)
{
    info *p = nl;
    info *q;
    int i, j;
    double s, sc = 0;
    pointf pt;

    for (i = 0; i < nn; i++) {
	q = p + 1;
	for (j = i + 1; j < nn; j++) {
	    if (overlap(p->bb, q->bb))
		return 0;
	    if (p->pos.x == q->pos.x)
		pt.x = HUGE_VAL;
	    else {
		pt.x = (p->wd2 + q->wd2) / fabs(p->pos.x - q->pos.x);
	    }
	    if (p->pos.y == q->pos.y)
		pt.y = HUGE_VAL;
	    else {
		pt.y = (p->ht2 + q->ht2) / fabs(p->pos.y - q->pos.y);
	    }
	    if (pt.y < pt.x)
		s = pt.y;
	    else
		s = pt.x;
	    if (s > sc)
		sc = s;
	    q++;
	}
	p++;
    }
    return sc;
}
开发者ID:emdenrg,项目名称:graphviz,代码行数:35,代码来源:constraint.c


示例2: main

int main() {

	while(scanf("%d",&n) && n!=-1) {
		for(int i=0;i<n;++i)
			ring[i].get();
		for(int i=0;i<n;++i)
			for(int j=0;j<n;++j)
				map[i][j] = false;
		
		for(int i=0;i<n;++i)	
			for(int j=i+1;j<n;++j)
				if(overlap(i,j))
					map[i][j] = map[j][i] = true;
					
		int Max=0;
		memset(used,false,sizeof(used));
		for(int i=0;i<n;++i)
			if(!used[i]) {
				count = 0;
				go(i);
				if(count > Max)	Max = count;
			}
		
		if(Max == 1)
			printf("The largest component contains %d ring.\n",1);
		else
			printf("The largest component contains %d rings.\n",Max);
	}

	return 0;
}
开发者ID:bruce3557,项目名称:Uva-Online-Judge,代码行数:31,代码来源:uva_10301.cpp


示例3: rotpc

void rotpc()
{
    struct piece pc = brd.pc;
    pc.rotid = (pc.rotid+1) % pc.tet->rotcount;
    if (!overlap(pc)) 
        brd.pc = pc;
}
开发者ID:theabraham,项目名称:terminal-tetris,代码行数:7,代码来源:board.c


示例4: uassert

    ShardChunkManager* ShardChunkManager::clonePlus( const BSONObj& min , const BSONObj& max , const ShardChunkVersion& version ) {

        // it is acceptable to move version backwards (e.g., undoing a migration that went bad during commit)
        // but only cloning away the last chunk may reset the version to 0
        uassert( 13591 , "version can't be set to zero" , version.isSet() );

        if ( ! _chunksMap.empty() ) {

            // check that there isn't any chunk on the interval to be added
            RangeMap::const_iterator it = _chunksMap.lower_bound( max );
            if ( it != _chunksMap.begin() ) {
                --it;
            }
            if ( overlap( min , max , it->first , it->second ) ) {
                ostringstream os;
                os << "ranges overlap, "
                   << "requested: " << min << " -> " << max << " "
                   << "existing: " << it->first.toString() + " -> " + it->second.toString();
                uasserted( 13588 , os.str() );
            }
        }

        auto_ptr<ShardChunkManager> p( new ShardChunkManager );

        p->_key = this->_key;
        p->_chunksMap = this->_chunksMap;
        p->_chunksMap.insert( make_pair( min.getOwned() , max.getOwned() ) );
        p->_version = version;
        if( version > _collVersion ) p->_collVersion = version;
        else p->_collVersion = this->_collVersion;
        p->_fillRanges();

        return p.release();
    }
开发者ID:danpe91,项目名称:mongo,代码行数:34,代码来源:d_chunk_manager.cpp


示例5: mvpcleft

void mvpcleft()
{
    struct piece pc = brd.pc;
    pc.pos.x -= 1; 
    if (!overlap(pc))
        brd.pc = pc;
}
开发者ID:theabraham,项目名称:terminal-tetris,代码行数:7,代码来源:board.c


示例6: mvpcright

void mvpcright()
{
    struct piece pc = brd.pc;
    pc.pos.x += 1; 
    if (!overlap(pc))
        brd.pc = pc;
}
开发者ID:theabraham,项目名称:terminal-tetris,代码行数:7,代码来源:board.c


示例7: ValueType

inline ValueType spatialaggregate::OcTreeNode< CoordType, ValueType >::getValueInVolume( const spatialaggregate::OcTreePosition< CoordType >& minPosition, const spatialaggregate::OcTreePosition< CoordType >& maxPosition, CoordType minimumSearchVolumeSize ) {

	if( type == OCTREE_LEAF_NODE ) {

		if( inRegion( minPosition, maxPosition ) )
			return value;

		return ValueType(0);

	}
	else {

		if( !overlap( minPosition, maxPosition ) )
			return ValueType(0);

		if( containedInRegion( minPosition, maxPosition ) )
			return value;

		if( (this->maxPosition[0] - this->minPosition[0]) - minimumSearchVolumeSize <= -OCTREE_EPSILON*minimumSearchVolumeSize ) {
			return value;
		}

		ValueType value = ValueType(0);
		for( unsigned int i = 0; i < 8; i++ ) {
			if(!siblings[i])
				continue;
			value += siblings[i]->getValueInVolume( minPosition, maxPosition, minimumSearchVolumeSize );
		}

		return value;

	}

}
开发者ID:azaganidis,项目名称:rgbdpro,代码行数:34,代码来源:octree.hpp


示例8:

bool TrackerTLDImpl::Nexpert::operator()(Rect2d box)
{
    if( overlap(resultBox_, box) < NEXPERT_THRESHOLD )
        return false;
    else
        return true;
}
开发者ID:2php,项目名称:opencv_contrib,代码行数:7,代码来源:tldTracker.cpp


示例9: overlap

 ExecStatus
 Nq<View0,View1>::propagate(Space& home, const ModEventDelta&) {
   if (x0.assigned() && x1.assigned()) {
     return overlap(x0.val(),x1.val()) ? ES_FAILED : home.ES_SUBSUMED(*this);
   } 
   return ES_FIX;
 }
开发者ID:Wushaowei001,项目名称:vcp,代码行数:7,代码来源:nq.hpp


示例10: PyBobIpBase_blockOutputShape

PyObject* PyBobIpBase_blockOutputShape(PyObject*, PyObject* args, PyObject* kwds) {
  BOB_TRY
  /* Parses input arguments in a single shot */
  char** kwlist = s_blockOutputShape.kwlist();

  PyBlitzArrayObject* input = 0;
  blitz::TinyVector<int,2> size, overlap(0,0);
  PyObject* flat_ = 0;

  if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&(ii)|(ii)O!", kwlist, &PyBlitzArray_Converter, &input, &size[0], &size[1], &overlap[0], &overlap[1], &PyBool_Type, &flat_)) return 0;

  auto input_ = make_safe(input);

  if (input->ndim != 2) {
    PyErr_Format(PyExc_TypeError, "block shape can only be computed from and to 2D arrays");
    return 0;
  }

  if (f(flat_)){
    auto shape = block_shape3(input, size, overlap);
    return Py_BuildValue("(iii)", shape[0], shape[1], shape[2]);
  } else {
    auto shape = block_shape4(input, size, overlap);
    return Py_BuildValue("(iiii)", shape[0], shape[1], shape[2], shape[3]);
  }

  BOB_CATCH_FUNCTION("in block_output_shape", 0)
}
开发者ID:183amir,项目名称:bob.ip.base,代码行数:28,代码来源:auxiliary.cpp


示例11: getS

void getS(int nbf, int *nprim, int *istart,
	  double *xcenter, double *ycenter, double *zcenter, 
	  int *lpower,int *mpower, int *npower, 
      int n2,
	  double *coef, double *alpha, 
	  double *S){
  int i,j,iprim,jprim,jindex,iindex;
  for (j=0; j<nbf; j++){
    for (i=0; i<nbf; i++){
      S[i+j*nbf] = 0.;
      for (jprim=0; jprim<nprim[j]; jprim++){
	jindex = istart[j]+jprim;
	for (iprim=0; iprim<nprim[i]; iprim++){
	  iindex = istart[i]+iprim;
	  S[i+j*nbf] += coef[iindex]*coef[jindex]
	    *overlap(alpha[iindex],lpower[i],mpower[i],
		     npower[i],xcenter[i],ycenter[i],
		     zcenter[i],
		     alpha[jindex],lpower[j],mpower[j],
		     npower[j],xcenter[j],ycenter[j],
		     zcenter[j]);
	}
      }
    }
  }
}
开发者ID:certik,项目名称:hfsolver,代码行数:26,代码来源:qc.c


示例12: intersection

TBOX TBOX::intersection(  //shared area box
                      const TBOX &box) const {
  inT16 left;
  inT16 bottom;
  inT16 right;
  inT16 top;
  if (overlap (box)) {
    if (box.bot_left.x () > bot_left.x ())
      left = box.bot_left.x ();
    else
      left = bot_left.x ();

    if (box.top_right.x () < top_right.x ())
      right = box.top_right.x ();
    else
      right = top_right.x ();

    if (box.bot_left.y () > bot_left.y ())
      bottom = box.bot_left.y ();
    else
      bottom = bot_left.y ();

    if (box.top_right.y () < top_right.y ())
      top = box.top_right.y ();
    else
      top = top_right.y ();
  }
  else {
    left = MAX_INT16;
    bottom = MAX_INT16;
    top = -MAX_INT16;
    right = -MAX_INT16;
  }
  return TBOX (left, bottom, right, top);
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:35,代码来源:rect.cpp


示例13: overlap

	point2<T> overlap( const point2<T>& pt, const polygon2<T>& poly ) {
		// check if either is null
		if( pt == point2<T>::null( ) || poly == polygon2<T>::null( ) ) {
			return point2<T>::null( );
		}
		// check bounding box first
		if( overlap( pt, poly.m_bounding_box ) == point2<T>::null( ) ) {
			return point2<T>::null( );
		}

		// check actual polygon
		//   the point should be on the same side of every line making
		//   up the polygon if it is inside
		float dir = poly.direction( poly.m_hull[0], poly.m_hull[1], pt );
		bool side = dir > std::numeric_limits<T>::epsilon( );
		for( unsigned int i = 1; i < poly.m_hull.size( ); ++i ) {
			// check last element w/ first
			if( i == poly.m_hull.size( ) - 1 ) {
				dir = poly.direction( poly.m_hull[i], poly.m_hull[0], pt );
			}
			else {
				dir = poly.direction( poly.m_hull[i], poly.m_hull[i+1], pt );
			}
			// different side, can't be inside
			if( side != (dir > std::numeric_limits<T>::epsilon( )) ) {
				return point2<T>::null( );
			}
		}

		return pt;
	}
开发者ID:jmarini,项目名称:euclib,代码行数:31,代码来源:euclib_helper.hpp


示例14: return

 ExecStatus
 NqFloat<View>::propagate(Space& home, const ModEventDelta&) {
   if (x0.assigned()) {
     return (overlap(x0.val(),c)) ? ES_FAILED : home.ES_SUBSUMED(*this);
   } 
   return ES_FIX;
 }
开发者ID:Wushaowei001,项目名称:vcp,代码行数:7,代码来源:nq.hpp


示例15: PyBobIpBase_block

PyObject* PyBobIpBase_block(PyObject*, PyObject* args, PyObject* kwds) {
  BOB_TRY
  /* Parses input arguments in a single shot */
  char** kwlist = s_block.kwlist();

  PyBlitzArrayObject* input = 0,* output = 0;
  blitz::TinyVector<int,2> size, overlap(0,0);
  PyObject* flat_ = 0;

  if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&(ii)|(ii)O&O!", kwlist, &PyBlitzArray_Converter, &input, &size[0], &size[1], &overlap[0], &overlap[1], &PyBlitzArray_OutputConverter, &output, &PyBool_Type, &flat_)) return 0;

  auto input_ = make_safe(input), output_ = make_xsafe(output);
  bool flat = f(flat_);

  if (input->ndim != 2) {
    PyErr_Format(PyExc_TypeError, "blocks can only be extracted from and to 2D arrays");
    return 0;
  }
  bool return_out = false;
  if (output){
    if (output->type_num != input->type_num){
      PyErr_Format(PyExc_TypeError, "``input`` and ``output`` must have the same data type");
      return 0;
    }
    if (output->ndim != 3 && output->ndim != 4){
      PyErr_Format(PyExc_TypeError, "``output`` must have either three or four dimensions, not %" PY_FORMAT_SIZE_T "d", output->ndim);
      return 0;
    }
    flat = output->ndim == 3;
  } else {
    return_out = true;
    // generate output in the desired shape
    if (flat){
      auto res = block_shape3(input, size, overlap);
      Py_ssize_t osize[] = {res[0], res[1], res[2]};
      output = (PyBlitzArrayObject*)PyBlitzArray_SimpleNew(input->type_num, 3, osize);
    } else {
      auto res = block_shape4(input, size, overlap);
      Py_ssize_t osize[] = {res[0], res[1], res[2], res[3]};
      output = (PyBlitzArrayObject*)PyBlitzArray_SimpleNew(input->type_num, 4, osize);
    }
    output_ = make_safe(output);
  }

  switch (input->type_num){
    case NPY_UINT8:   if (flat) block_inner<uint8_t,3>(input, size, overlap, output);  else block_inner<uint8_t,4>(input, size, overlap, output); break;
    case NPY_UINT16:  if (flat) block_inner<uint16_t,3>(input, size, overlap, output); else block_inner<uint16_t,4>(input, size, overlap, output); break;
    case NPY_FLOAT64: if (flat) block_inner<double,3>(input, size, overlap, output);   else block_inner<double,4>(input, size, overlap, output); break;
    default:
      PyErr_Format(PyExc_TypeError, "block does not work on 'input' images of type %s", PyBlitzArray_TypenumAsString(input->type_num));
  }

  if (return_out){
    return PyBlitzArray_AsNumpyArray(output, 0);
  } else
    Py_RETURN_NONE;

  BOB_CATCH_FUNCTION("in block", 0)
}
开发者ID:183amir,项目名称:bob.ip.base,代码行数:59,代码来源:auxiliary.cpp


示例16: canAttendMeetings

 bool canAttendMeetings(vector<Interval>& intervals) {
     sort(intervals.begin(), intervals.end(), compare);
     int n = intervals.size();
     for (int i = 0; i < n - 1; i++)
         if (overlap(intervals[i], intervals[i + 1]))
             return false;
     return true;
 }
开发者ID:LLouice,项目名称:leetcode,代码行数:8,代码来源:Meeting+Rooms.cpp


示例17: overlap_any

bool overlap_any(struct nobjs *pv, struct obj *p, int pad)
{
    int n, m; struct obj *l;
    for (l = pv->p, m = pv->n, n = 0; n < m; ++n, ++l)
        if (overlap(l, p, pad))
            return true;
    return false;
}
开发者ID:BackupTheBerlios,项目名称:bblean,代码行数:8,代码来源:bbSlit.cpp


示例18: overlap

void
MonotoneChainOverlapAction::overlap(MonotoneChain& mc1, size_t start1,
		MonotoneChain& mc2, size_t start2)
{
	mc1.getLineSegment(start1, overlapSeg1);
	mc2.getLineSegment(start2, overlapSeg2);
	overlap(overlapSeg1, overlapSeg2);
}
开发者ID:drownedout,项目名称:datamap,代码行数:8,代码来源:MonotoneChainOverlapAction.cpp


示例19: trainNegative

void Detection::trainNegative(cv::Mat const & integral)
{

   cv::Point currentSize;
   cv::Point2d doubleBox;
   doubleBox.x = static_cast<double>(m_boxSize.x);
   doubleBox.y = static_cast<double>(m_boxSize.y);

   // Create a list of bounding boxes to search through
   for( int scaleIdx = 0; scaleIdx < 5; ++scaleIdx)
   {
	   // Calculate the scale for this index
	   double scale = static_cast<double>(scaleIdx)/4.0 + 0.5;

	   // Determine the x values
       currentSize.x = static_cast<int>(scale*doubleBox.x);
       int xMax  = m_size.x - currentSize.x;
       int xStep = xMax / 19;

       if( xStep <= 0)
       {
    	   xMax  = 0;
    	   xStep = 1;
       }

       // Loop over the x-values and generate the y-values
       for( int x = 0; x <= xMax; x += xStep)
       {
          currentSize.y = static_cast<int>(scale*doubleBox.y);
          int yMax  = m_size.y - currentSize.y;
          int yStep = yMax / 19;
          if( yStep <= 0 )
          {
        	  yMax  = 0;
        	  yStep = 1;
          }

          // Loop over y and build the boxes
          for( int y = 0; y <= yMax; y += yStep)
          {
        	  // Create a new contact
        	  Contact newBox;
        	  newBox.position.x = x;
        	  newBox.position.y = y;
        	  newBox.dims.x     = currentSize.x;
        	  newBox.dims.y     = currentSize.y;

        	  if(overlap(newBox) ==  0.)
        	  {
        		  m_classifier->train(integral,newBox.position, newBox.dims,0);
        	  }

          }

       }
   }

}
开发者ID:mdqyy,项目名称:detectTriangle,代码行数:58,代码来源:detection.cpp


示例20: ClipParticles

void PARTICLE::ClipParticles(VERTEX * rect)
{
	//return;
	
	float height = 0;
	int j;
	for (j = 0; j < 4; j++)
	{
		height += rect[j].y;
	}
	height /= 4.0f;
	
	height += 0.2f;
	
	int i;
	for (i = 0; i < MAX_PARTICLES; i++)
	{	
		if (particle[i].active)
		{
			VERTEX drawpos;
			drawpos = particle[i].start_position;
			float age = curtime - particle[i].timestamp;
			VERTEX offset = particle[i].direction.ScaleR(age*particle[i].speed);
			drawpos = drawpos + offset;
			
			float dimension = 0.5f;
			VERTEX dprect[4];
			dprect[0] = drawpos;
			dprect[0].x -= dimension;
			dprect[0].z -= dimension;
			dprect[1] = drawpos;
			dprect[1].x -= dimension;
			dprect[1].z += dimension;
			dprect[2] = drawpos;
			dprect[2].x += dimension;
			dprect[2].z += dimension;
			dprect[3] = drawpos;
			dprect[3].x += dimension;
			dprect[3].z -= dimension;
			
			//if (inrect(rect, drawpos))// && drawpos.y > height)
			if (overlap(rect, dprect) && drawpos.y > height)
			{
				if (drawpos.y - height <= 0.2)
				{
					float age = (curtime - particle[i].timestamp);
					particle[i].start_position = drawpos;
					particle[i].start_position.y = height;
					particle[i].longevity = particle[i].longevity - age;
					particle[i].timestamp = curtime;
					particle[i].transparency = particle[i].transparency*(1.0f-age/particle[i].longevity)*1.0f/((float)NUM_ROTATIONS+1.0f);
				}
				else
					particle[i].active = false;
			}
		}
	}
}
开发者ID:Timo6,项目名称:trackeditor,代码行数:58,代码来源:particles.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ overlaps函数代码示例发布时间:2022-05-30
下一篇:
C++ overflow函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap