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

C++ GetMax函数代码示例

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

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



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

示例1: m_parent

dgCollisionScene::dgNode::dgNode(dgNode* const sibling, dgNode* const myNode) :
    m_parent(sibling->m_parent), m_left(sibling), m_right(myNode), m_fitnessNode(
        NULL)
{
  if (m_parent)
  {
    if (m_parent->m_left == sibling)
    {
      m_parent->m_left = this;
    }
    else
    {
      _ASSERTE(m_parent->m_right == sibling);
      m_parent->m_right = this;
    }
  }

  sibling->m_parent = this;
  myNode->m_parent = this;

  dgNode* const left = m_left;
  dgNode* const right = m_right;

  m_minBox = dgVector(GetMin(left->m_minBox.m_x, right->m_minBox.m_x),
      GetMin(left->m_minBox.m_y, right->m_minBox.m_y),
      GetMin(left->m_minBox.m_z, right->m_minBox.m_z), dgFloat32(0.0f));
  m_maxBox = dgVector(GetMax(left->m_maxBox.m_x, right->m_maxBox.m_x),
      GetMax(left->m_maxBox.m_y, right->m_maxBox.m_y),
      GetMax(left->m_maxBox.m_z, right->m_maxBox.m_z), dgFloat32(0.0f));

  dgVector side0(m_maxBox - m_minBox);
  dgVector side1(side0.m_y, side0.m_z, side0.m_x, dgFloat32(0.0f));
  m_surfaceArea = side0 % side1;
}
开发者ID:Evil-Spirit,项目名称:Nutmeg,代码行数:34,代码来源:dgCollisionScene.cpp


示例2: Gao

        void Gao(long a1, long a2, long b1, long b2) {
                a1 = f[a1], b1 = f[b1], a2 = f[a2], b2 = f[b2];
                if (a1 > a2) std::swap(a1, a2);
                if (b1 > b2) std::swap(b1, b2);
                if (a1 == b1 && a2 == b2) {c2++; return;}
                if (a1 == b1) a1 = b1 = n + 1;
                if (a1 == b2) a1 = b2 = n + 1;
                if (a2 == b1) a2 = b1 = n + 1;
                if (a2 == b2) a2 = b2 = n + 1;
 
                bool t1 = false, t2 = false ,t3 = false;
                for (long i = 0; i < 16; i++) {
                        long d = 0;
                        memset(W, 0, sizeof W);
                        if (i & 1) d += GetMax(a1);
                        else d += GetMin(a1);
                        if (i & 2) d += GetMax(a2);
                        else d += GetMin(a2);
                        if (i & 4) d -= GetMax(b1);
                        else d -= GetMin(b1);
                        if (i & 8) d -= GetMax(b2);
                        else d -= GetMin(b2);
                        if (d > 0) if (t2 || t3) return; else t1 = true;
                        if (d== 0) if (t1 || t3) return; else t2 = true;
                        if (d < 0) if (t1 || t2) return; else t3 = true;
                }
                c1 += t1, c2 += t2, c3 += t3;
        }
开发者ID:AiHaibara,项目名称:acm-icpc,代码行数:28,代码来源:1077.cpp


示例3: OnTimer

void CGraphicOption::OnTimer(UINT nIDEvent) 
{
	if(nIDEvent==1)
	{
		m_iTick++;
		if(m_iTick>CGraphicOption_TIMERINITIAL)
		{
			// We begin doing 1/4 the pulses, then move to 1/3 after TIMERBOOST pulses, and so on
			int iBoostState=
				CGraphicOption_TIMERBOOSTSTAGES-(m_iTick-CGraphicOption_TIMERINITIAL)/CGraphicOption_TIMERBOOST;
			if(iBoostState>1 && (m_iTick%iBoostState!=0))
				return;

			// Update position
			m_iPos+=m_iTimerDirection;
			if(m_iPos<GetMin()) m_iPos=GetMax();
			if(m_iPos>GetMax()) m_iPos=GetMin();

			// Repaint text
			CRect rect(m_iButtonX,0,m_pgBackground->Width()-m_iButtonX,
				m_pgBackground->Height());
			InvalidateRect(&rect,FALSE);
		}
	}
	else
		CWnd::OnTimer(nIDEvent);
}
开发者ID:quen,项目名称:leafdrums2,代码行数:27,代码来源:GraphicOption.cpp


示例4: GetMax

	int GetMax( TreeNode * root)
	{
		if(root == NULL)
			return 0;
		int leftMax = GetMax(root->left);
		int rightMax = GetMax(root->right);

		int currentMax = root->val;
		if(leftMax >0)
			currentMax += leftMax;
		if(rightMax > 0)
			currentMax += rightMax;
		if(currentMax > max)
			max = currentMax;

		if(leftMax > rightMax)	
		{
			if(leftMax >0)
				return root->val + leftMax;
			else 
				return root->val;
		}
		else		
		{
			if(rightMax >0)
				return root->val + rightMax;
			else
				return root->val;	
		}
	}
开发者ID:qs8607a,项目名称:Algorithm-22,代码行数:30,代码来源:Binary+Tree+Maximum+Path+Sum.cpp


示例5: FindIndex

int wxSheetArrayEdge::FindMaxEdgeIndex(int val, int edge_size) const
{
    const int index = FindIndex(val, true);
    if (index < 0) return -1;
    // we know we're inside the 'index' element (or above or below the array)
    //   find which side is closer and if < edge_size return index
    const int diff = abs(GetMax(index) - val);
    const int diff_min = (index > 0) ? abs(GetMax(index-1) - val) : diff+edge_size+1; 

    const int min_diff = wxMin(diff, diff_min);
    if (min_diff > edge_size)
        return -1;
    else if (min_diff == diff)
        return index;
    else if (min_diff == diff_min)
        return index - 1;
    
    return -1;
    
/*   
    // FIXME I wonder if this really makes complete sense? check it...
    // eg. what would happen if size of cell was only 1 pixel, you couldn't resize it?
    if ( GetSize(index) > edge_size )
    {
        // We know that we are in index, test whether we are
        // close enough to lower or upper border, respectively.
        if ( abs(GetMax(index) - val) < edge_size )
            return index;
        else if ( (index > 0) && (val - GetMin(index) < edge_size) )
            return index - 1;
    }

    return -1;
*/    
}
开发者ID:andrioni,项目名称:gambit,代码行数:35,代码来源:sheetedg.cpp


示例6: dgVector

dgFloat32 dgCollisionScene::CalculateSurfaceArea (const dgNode* const node0, const dgNode* const node1, dgVector& minBox, dgVector& maxBox) const
{
	minBox = dgVector (GetMin (node0->m_minBox.m_x, node1->m_minBox.m_x), GetMin (node0->m_minBox.m_y, node1->m_minBox.m_y), GetMin (node0->m_minBox.m_z, node1->m_minBox.m_z), dgFloat32 (0.0f));
	maxBox = dgVector (GetMax (node0->m_maxBox.m_x, node1->m_maxBox.m_x), GetMax (node0->m_maxBox.m_y, node1->m_maxBox.m_y), GetMax (node0->m_maxBox.m_z, node1->m_maxBox.m_z), dgFloat32 (0.0f));		
	dgVector side0 (maxBox - minBox);
	dgVector side1 (side0.m_y, side0.m_z, side0.m_x, dgFloat32 (0.0f));
	return side0 % side1;
}
开发者ID:mmozeiko,项目名称:Squares3D-Android,代码行数:8,代码来源:dgCollisionScene.cpp


示例7: TransformTriplex

void dgMatrix::TransformBBox (const dgVector& p0local, const dgVector& p1local, dgVector& p0, dgVector& p1) const
{
	dgVector box[8];

	box[0][0] = p0local[0];
	box[0][1] = p0local[1];
	box[0][2] = p0local[2];
	box[0][3] = hacd::HaF32(1.0f);

	box[1][0] = p0local[0];
	box[1][1] = p0local[1];
	box[1][2] = p1local[2];
	box[1][3] = hacd::HaF32(1.0f);

	box[2][0] = p0local[0];
	box[2][1] = p1local[1];
	box[2][2] = p0local[2];
	box[2][3] = hacd::HaF32(1.0f);

	box[3][0] = p0local[0];
	box[3][1] = p1local[1];
	box[3][2] = p1local[2];
	box[3][3] = hacd::HaF32(1.0f);

	box[4][0] = p1local[0];
	box[4][1] = p0local[1];
	box[4][2] = p0local[2];
	box[4][3] = hacd::HaF32(1.0f);

	box[5][0] = p1local[0];
	box[5][1] = p0local[1];
	box[5][2] = p1local[2];
	box[1][3] = hacd::HaF32(1.0f);

	box[6][0] = p1local[0];
	box[6][1] = p1local[1];
	box[6][2] = p0local[2];
	box[6][3] = hacd::HaF32(1.0f);

	box[7][0] = p1local[0];
	box[7][1] = p1local[1];
	box[7][2] = p1local[2];
	box[7][3] = hacd::HaF32(1.0f);

	TransformTriplex (&box[0].m_x, sizeof (dgVector), &box[0].m_x, sizeof (dgVector), 8);

	p0 = box[0];
	p1 = box[0];
	for (hacd::HaI32 i = 1; i < 8; i ++) {
		p0.m_x = GetMin (p0.m_x, box[i].m_x);
		p0.m_y = GetMin (p0.m_y, box[i].m_y);
		p0.m_z = GetMin (p0.m_z, box[i].m_z);

		p1.m_x = GetMax (p1.m_x, box[i].m_x);
		p1.m_y = GetMax (p1.m_y, box[i].m_y);
		p1.m_z = GetMax (p1.m_z, box[i].m_z);
	}
}
开发者ID:qimiaokeju11,项目名称:testhacd,代码行数:58,代码来源:dgMatrix.cpp


示例8: OnMouseMove

void CGraphicOption::OnLButtonDown(UINT nFlags, CPoint point) 
{
	if(m_fOverLeft)
	{
		// Set the button as down and repaint it
		m_fOverLeft=FALSE;
		m_fDownLeft=TRUE;
		OnMouseMove(nFlags,point);

		// Change the text string
		m_iPos--;
		if(m_iPos<GetMin()) m_iPos=GetMax();

		// Repaint text
		CRect rect(m_iButtonX,0,m_pgBackground->Width()-m_iButtonX,
			m_pgBackground->Height());
		InvalidateRect(&rect,FALSE);

		// Begin timer to make more moves
		m_iTick=0;
		m_iTimerDirection=-1;
		SetTimer(1,CGraphicOption_TIMERPULSE,NULL);

		// Notify parent
		SetSel(m_iPos,TRUE);
	}
	if(m_fOverRight)
	{
		// Set the button as down and repaint it
		m_fOverRight=FALSE;
		m_fDownRight=TRUE;
		OnMouseMove(nFlags,point);

		// Change the text string
		m_iPos++;
		if(m_iPos>GetMax()) m_iPos=GetMin();

		// Repaint text
		CRect rect(m_iButtonX,0,m_pgBackground->Width()-m_iButtonX,
			m_pgBackground->Height());
		InvalidateRect(&rect,FALSE);

		// Begin timer to make more moves
		m_iTick=0;
		m_iTimerDirection=1;
		SetTimer(1,CGraphicOption_TIMERPULSE,NULL);

		// Notify parent
		SetSel(m_iPos,TRUE);
	}
	
	CWnd::OnLButtonDown(nFlags, point);
}
开发者ID:quen,项目名称:leafdrums2,代码行数:53,代码来源:GraphicOption.cpp


示例9: GetBitmap

void MAS::Progress::Draw(Bitmap &canvas) {
   Bitmap bmp = GetBitmap();
   if (orientation == 1) {
      bmp.HorizontalTile(canvas, 0, 0, 0, w(), 2);
      int ww = (int)(w()*GetPosition()/(GetMax() - GetMin()));
      bmp.HorizontalTile(canvas, 1, 0, 0, ww, 2);
   }
   else {
      bmp.VerticalTile(canvas, 0, 0, 0, h(), 2);
      int hh = (int)(h()*GetPosition()/(GetMax() - GetMin()));
      bmp.VerticalTile(canvas, 1, 0, 0, hh, 2);
   }
}
开发者ID:bambams,项目名称:ma5king,代码行数:13,代码来源:progress.cpp


示例10: GetMin

		float CAxisAlignedBoundingBox::GetLengthFromPoint(
			const Graphic::CVector3& point) const
		{
			float SqLen = 0;
			for (int i = 0; i < 3; i++)
			{
				if (point[i] < GetMin()[i])
					SqLen += (point[i] - GetMin()[i]) * (point[i] - GetMin()[i]);
				if (point[i] > GetMax()[i])
					SqLen += (point[i] - GetMax()[i]) * (point[i] - GetMax()[i]);
			}
			return sqrt(SqLen);
		};
开发者ID:abdiel1325,项目名称:MMLibrary,代码行数:13,代码来源:CAxisAlignedBoundingBox.cpp


示例11: GetMin

void	WED_GISBoundingBox::MoveCorner(GISLayer_t l,int corner, const Vector2& delta)
{
	Point2	p1,p2;
	GetMin()->GetLocation(l,p1);
	GetMax()->GetLocation(l,p2);
	switch(corner) {
	case 0:	p1.x_ += delta.dx;	p1.y_ += delta.dy;	break;
	case 1: p2.x_ += delta.dx;	p1.y_ += delta.dy;	break;
	case 2:	p2.x_ += delta.dx;	p2.y_ += delta.dy;	break;
	case 3: p1.x_ += delta.dx;	p2.y_ += delta.dy;	break;
	}
	GetMin()->SetLocation(l,p1);
	GetMax()->SetLocation(l,p2);
}
开发者ID:highattack30,项目名称:xptools,代码行数:14,代码来源:WED_GISBoundingBox.cpp


示例12: GetTreeHeightPreorder2

int GetTreeHeightPreorder2(const BTree root)
{
    deque<const BTree> dq;
    int TreeHeight=-1;
    while(-1)
    {
        for(;root!=NULL;root=root->LChild)
        {
            dq.push_back(root);
        }
        TreeHeight=GetMax(TreeHeight,(int)dq.size()-1);
        while(1)
        {
            //若该节点无新的子树,表示已经到头
            if(dq.empty()) return TreeHeight;
            //否则,调用实现,取其右子树
            const BTree parrent=dq.back();
            const BTree RChild=parrent->RChild;
            if(RChild && root !=RChild)
            {
                root=RChild;
                break;
            }
            //每次都要从左边起,都要判断
            root=parrent;
            dq.pop_back();
        }
    }
    return TreeHeight;
}
开发者ID:Lonui-NC,项目名称:Algorithm,代码行数:30,代码来源:DepthTree.c


示例13: origin

void dgCollisionScene::CalcAABB (const dgMatrix& matrix, dgVector& p0, dgVector& p1) const
{
	dgVector origin (matrix.TransformVector(m_boxOrigin));
	dgVector size (m_boxSize.m_x * dgAbsf(matrix[0][0]) + m_boxSize.m_y * dgAbsf(matrix[1][0]) + m_boxSize.m_z * dgAbsf(matrix[2][0]) + DG_MAX_COLLISION_PADDING,  
				   m_boxSize.m_x * dgAbsf(matrix[0][1]) + m_boxSize.m_y * dgAbsf(matrix[1][1]) + m_boxSize.m_z * dgAbsf(matrix[2][1]) + DG_MAX_COLLISION_PADDING,  
				   m_boxSize.m_x * dgAbsf(matrix[0][2]) + m_boxSize.m_y * dgAbsf(matrix[1][2]) + m_boxSize.m_z * dgAbsf(matrix[2][2]) + DG_MAX_COLLISION_PADDING,
				   dgFloat32 (0.0f));

	p0 = origin - size;
	p1 = origin + size;

#ifdef DG_DEBUG_AABB
	dgInt32 i;
	dgVector q0;
	dgVector q1;
	dgMatrix trans (matrix.Transpose());
	for (i = 0; i < 3; i ++) {
		q0[i] = matrix.m_posit[i] + matrix.RotateVector (BoxSupportMapping(trans[i].Scale (-1.0f)))[i];
		q1[i] = matrix.m_posit[i] + matrix.RotateVector (BoxSupportMapping(trans[i]))[i];
	}

	dgVector err0 (p0 - q0);
	dgVector err1 (p1 - q1);
	dgFloat32 err; 
	err = GetMax (size.m_x, size.m_y, size.m_z) * 0.5f; 
	_ASSERTE ((err0 % err0) < err);
	_ASSERTE ((err1 % err1) < err);
#endif
}
开发者ID:mmozeiko,项目名称:Squares3D-Android,代码行数:29,代码来源:dgCollisionScene.cpp


示例14: GetMax

void CStatistic::PrintStats(std::string const& physicalQuantity)const
{
	std::cout << "Max " << physicalQuantity.c_str() << ":" << GetMax() << std::endl;
	std::cout << "Min " << physicalQuantity.c_str() << ":" << GetMin() << std::endl;
	std::cout << "Average " << physicalQuantity.c_str() << ":" << GetAverage() << std::endl;
	std::cout << "----------------" << std::endl;
}
开发者ID:Dzzirt,项目名称:OOP,代码行数:7,代码来源:Statistic.cpp


示例15: GetMax

void WaveletMatrixBuilder::BuildWithAVals(WaveletMatrix& wm, vector<uint32_t>& avals){
	uint32_t max_val = GetMax(vals_);
	uint32_t max_depth = GetLen(max_val);
	wm.max_val_ = max_val;
	wm.layers_.resize(max_depth);

	vector<uint32_t> zeros;
	vector<uint32_t> ones;

	vector<uint32_t> zero_avals;
	vector<uint32_t> one_avals;
	zeros.swap(vals_);
	zero_avals = avals;
	for (uint32_t depth = 0; depth < max_depth; ++depth){
		vector<uint32_t> next_zeros;
		vector<uint32_t> next_ones;
		vector<uint32_t> next_zero_avals;
		vector<uint32_t> next_one_avals;

		RSDicBuilder rsdb;
		FilterWithAVals(zeros, zero_avals, max_depth - depth - 1, next_zeros, next_ones, next_zero_avals, next_one_avals, rsdb);
		FilterWithAVals(ones,  one_avals,  max_depth - depth - 1, next_zeros, next_ones, next_zero_avals, next_one_avals, rsdb);
		zeros.swap(next_zeros);
		ones.swap(next_ones);
		zero_avals.swap(next_zero_avals);
		one_avals.swap(next_one_avals);
		rsdb.Build(wm.layers_[depth]);
	}
	copy(zero_avals.begin(), zero_avals.end(), avals.begin());
	copy(one_avals.begin(), one_avals.end(), avals.begin() + zero_avals.size());
}
开发者ID:pombredanne,项目名称:wavelet-matrix,代码行数:31,代码来源:WaveletMatrixBuilder.cpp


示例16: GetMax

 long GetMax(long u) {
         if (W[u]) return W[u];
         long Max = 0;
         for (Edge* p = min[u]; p; p = p->next)
                 Max = std::max(Max, GetMax(p->y));
         return W[u] = Max + 1;
 }
开发者ID:AiHaibara,项目名称:acm-icpc,代码行数:7,代码来源:1077.cpp


示例17: GetQps

void MatrixStat::Dump(std::ostream& os) const {
  os.setf(std::ios::fixed);
  os << std::setprecision(2); 
  os << "{\"qps\": " << GetQps()
     << ", \"count\": " << GetCount()
     << ", \"avg\": " << GetAvg()
     << ", \"max\": " << GetMax()
     << ", \"min\": " << GetMin();
  if (HasTimeDistribute()) {
    os << ", \"99\": " << GetTimeDistribute(0.99)
       << ", \"95\": " << GetTimeDistribute(0.95)
       << ", \"90\": " << GetTimeDistribute(0.9)
       << ", \"80\": " << GetTimeDistribute(0.8)
       << ", \"50\": " << GetTimeDistribute(0.5);
  } else {
    os << ", \"value\": " << GetValue();
  }
  if (HasResult()) {
    os << ",\n    \"Result\": {";
    bool first = true;
    for (const auto& pair : child_) {
      if (first == true) {
        first = false;
        os << "\n      ";
      } else {
        os << ",\n      ";
      }
      os << "\"" << pair.first << "\": ";
      pair.second.Dump(os);
    }
    os << "}";
  }
  os << "}";
}
开发者ID:wolfhead,项目名称:minotaur,代码行数:34,代码来源:matrix_stat.cpp


示例18: r

void CCue::OnMouseMove(UINT nFlags, POINT point)
{
    CFlowZap *fc = ((CFlowZap *)m_Parent);
    ptr = fc->GetInstructionAtPixel(point);

    if (ptr == NULL)
    {
        ptr = oldPtr;
    }

    if (oldPtr != ptr)
    {
        // DETERMINE THE RECTANGLE TO REDRAW
        CRect r(0, GetMin(ptr->GetCenter(), oldPtr->GetCenter()) - 7 , 25, GetMax(ptr->GetCenter(), oldPtr->GetCenter()) + 7);
        CString SoundPath = ((CRobotWorldApp*)AfxGetApp())->m_DefaultPath;
        SoundPath += "/sounds/choice.wav";

        if (fc->IsSoundOn())
        {
            PlaySound(SoundPath, NULL, SND_FILENAME | SND_ASYNC);
        }

        fc->RedrawWindow(r, NULL, RDW_INVALIDATE | RDW_ERASE);
    }

    oldPtr = ptr;
}
开发者ID:dogshoes,项目名称:map-n-zap,代码行数:27,代码来源:Cue.cpp


示例19: main

int main (void)
{
    ImplDecl id;
    int i = 4; int j = 6;
    int k = GetMax(i, j);
    return (GlobalExt() ? k - id.MethodF(42) : 42);
}
开发者ID:Distrotech,项目名称:codeblocks,代码行数:7,代码来源:impl_decl_main.cpp


示例20: main

int main()
{
	int iFirst = 10;
	int iSecond = 20;
	printf("The max value is %d\n",GetMax(iFirst,iSecond));
	
	return 0;
};
开发者ID:ec06cumt,项目名称:zeromqtest,代码行数:8,代码来源:testServer.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetMaxClip1函数代码示例发布时间:2022-05-30
下一篇:
C++ GetMatrix函数代码示例发布时间: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