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


C++ overlap函数代码示例

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


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


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