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

C++ GetX函数代码示例

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

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



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

示例1: SetPosition

void Line::SetY(double y) { SetPosition(GetX(), y); }
开发者ID:cugone,项目名称:Abrams2010,代码行数:1,代码来源:CLine.cpp


示例2: GET_PLAYER

/// Recalculate when each unit will arrive at the current army position, whatever that is
void CvArmyAI::UpdateCheckpointTurnsAndRemoveBadUnits()
{
	CvAIOperation* pOperation = GET_PLAYER(GetOwner()).getAIOperation(GetOperationID());
	//should be updated before calling this ...
	CvPlot* pCurrentArmyPlot = GC.getMap().plot(GetX(), GetY());

	//kick out damaged units, but if we're defending or escorting, no point in running away
	if (pOperation->IsOffensive())
	{
		for (unsigned int iI = 0; iI < m_FormationEntries.size(); iI++)
		{
			if (!m_FormationEntries[iI].IsUsed())
				continue;

			CvUnit* pUnit = GET_PLAYER(m_eOwner).getUnit(m_FormationEntries[iI].m_iUnitID);
			if (pUnit == NULL)
				continue;

			//failsafe - make sure the army ID is set
			if (pUnit->getArmyID() != GetID())
				pUnit->setArmyID(GetID());

			//let tactical AI handle those
			if (pUnit->GetCurrHitPoints() < pUnit->GetMaxHitPoints() / 3)
				RemoveUnit(m_FormationEntries[iI].GetUnitID());
		}
	}

	//update for all units in this army. ignore the ones still being built
	int iGatherTolerance = pOperation->GetGatherTolerance(this, pCurrentArmyPlot);
	for(unsigned int iI = 0; iI < m_FormationEntries.size(); iI++)
	{
		if (!m_FormationEntries[iI].IsUsed())
			continue;

		CvUnit* pUnit = GET_PLAYER(m_eOwner).getUnit(m_FormationEntries[iI].GetUnitID());
		if(pUnit && pCurrentArmyPlot)
		{
			if(plotDistance(*pUnit->plot(),*pCurrentArmyPlot)<iGatherTolerance)
			{
				m_FormationEntries[iI].SetTurnsToCheckpoint(0);
			}
			else
			{
				//be generous with the flags here, for some ops the muster point may be far away and intermittendly occupied by foreign units ...
				int iFlags = CvUnit::MOVEFLAG_APPROX_TARGET_RING2 | CvUnit::MOVEFLAG_IGNORE_STACKING | CvUnit::MOVEFLAG_IGNORE_ZOC;
				int iTurnsToReachCheckpoint = pUnit->TurnsToReachTarget(pCurrentArmyPlot, iFlags, pOperation->GetMaximumRecruitTurns());

				//if we're already moving to target, the current army plot is moving, so we cannot check progress against ...
				if ( iTurnsToReachCheckpoint==INT_MAX ||
					 (GetArmyAIState()==ARMYAISTATE_WAITING_FOR_UNITS_TO_CATCH_UP && !m_FormationEntries[iI].IsMakingProgressTowardsCheckpoint(iTurnsToReachCheckpoint)) )
				{
					CvString strMsg;
					strMsg.Format("Removing %s %d from army %d because no progress to checkpoint (%d:%d). ETA %d, previously %d.", 
						pUnit->getName().c_str(), m_FormationEntries[iI].GetUnitID(), GetID(), pCurrentArmyPlot->getX(), pCurrentArmyPlot->getY(),
						iTurnsToReachCheckpoint, m_FormationEntries[iI].m_iPrevEstimatedTurnsToCheckpoint);
					pOperation->LogOperationSpecialMessage(strMsg);
					RemoveUnit(m_FormationEntries[iI].GetUnitID());
				}
				else
					m_FormationEntries[iI].SetTurnsToCheckpoint(iTurnsToReachCheckpoint);
			}
		}
	}
}
开发者ID:LoneGazebo,项目名称:Community-Patch-DLL,代码行数:66,代码来源:CvArmyAI.cpp


示例3: GetX

void Sprite::ScaleToClipped( float fWidth, float fHeight )
{
	m_fRememberedClipWidth = fWidth;
	m_fRememberedClipHeight = fHeight;

	if( !m_pTexture )
		return;

	int iSourceWidth	= m_pTexture->GetSourceWidth();
	int iSourceHeight	= m_pTexture->GetSourceHeight();

	// save the original X&Y.  We're going to resore them later.
	float fOriginalX = GetX();
	float fOriginalY = GetY();

	if( IsDiagonalBanner(iSourceWidth, iSourceHeight) )		// this is a SSR/DWI CroppedSprite
	{
		float fCustomImageCoords[8] = {
			0.02f,	0.78f,	// top left
			0.22f,	0.98f,	// bottom left
			0.98f,	0.22f,	// bottom right
			0.78f,	0.02f,	// top right
		};
		Sprite::SetCustomImageCoords( fCustomImageCoords );

		if( fWidth != -1 && fHeight != -1)
			m_size = RageVector2( fWidth, fHeight );
		else
		{
			/* If no crop size is set, then we're only being used to crop diagonal
			 * banners so they look like regular ones. We don't actually care about
			 * the size of the image, only that it has an aspect ratio of 4:1.  */
			m_size = RageVector2(256, 64);
		}
		SetZoom( 1 );
	}
	else if( m_pTexture->GetID().filename.find( "(was rotated)" ) != m_pTexture->GetID().filename.npos && 
			 fWidth != -1 && fHeight != -1 )
	{
		/* Dumb hack.  Normally, we crop all sprites except for diagonal banners,
		 * which are stretched.  Low-res versions of banners need to do the same
		 * thing as their full resolution counterpart, so the crossfade looks right.
		 * However, low-res diagonal banners are un-rotated, to save space.  BannerCache
		 * drops the above text into the "filename" (which is otherwise unused for
		 * these banners) to tell us this.
		 */
		Sprite::StopUsingCustomCoords();
		m_size = RageVector2( fWidth, fHeight );
		SetZoom( 1 );
	}
	else if( fWidth != -1 && fHeight != -1 )
	{
		// this is probably a background graphic or something not intended to be a CroppedSprite
		Sprite::StopUsingCustomCoords();

		// first find the correct zoom
		Sprite::ScaleToCover( RectF(0,0,fWidth,fHeight) );
		// find which dimension is larger
		bool bXDimNeedsToBeCropped = GetZoomedWidth() > fWidth+0.01;
		
		if( bXDimNeedsToBeCropped )	// crop X
		{
			float fPercentageToCutOff = (this->GetZoomedWidth() - fWidth) / this->GetZoomedWidth();
			float fPercentageToCutOffEachSide = fPercentageToCutOff / 2;
			
			// generate a rectangle with new texture coordinates
			RectF fCustomImageRect( 
				fPercentageToCutOffEachSide, 
				0, 
				1 - fPercentageToCutOffEachSide, 
				1 );
			SetCustomImageRect( fCustomImageRect );
		}
		else		// crop Y
		{
			float fPercentageToCutOff = (this->GetZoomedHeight() - fHeight) / this->GetZoomedHeight();
			float fPercentageToCutOffEachSide = fPercentageToCutOff / 2;
			
			// generate a rectangle with new texture coordinates
			RectF fCustomImageRect( 
				0, 
				fPercentageToCutOffEachSide,
				1, 
				1 - fPercentageToCutOffEachSide );
			SetCustomImageRect( fCustomImageRect );
		}
		m_size = RageVector2( fWidth, fHeight );
		SetZoom( 1 );
	}

	// restore original XY
	SetXY( fOriginalX, fOriginalY );
}
开发者ID:Braunson,项目名称:openitg,代码行数:93,代码来源:Sprite.cpp


示例4: AnimateText

/************************************************************************
 Function: void AnimateText(BYTE mov)
                                                                       
 Overview: Routine to move or animate the text.
  		                                         
 Input: mov - number of pixels the text will be moved
                                                                       
 Output: none
************************************************************************/
void AnimateText(BYTE mov)
{
    static SHORT    xPos = STXXPOS, yPos = STXYPOS;
    static SHORT    x, y;
    SHORT           width;
    SHORT           height;

    SHORT           newX, newY, oldX, oldY;
    XCHAR           NewChar, *pString;

    // set the clipping region
    SetClip(CLIP_ENABLE);
    SetClipRgn(STXXPOS + 2, STXYPOS + 2, STXXPOS + STXWIDTH - 2, STXYPOS + STXHEIGHT - 2);

    // set the font
    SetFont(pHWData->pHWFont);

    // calculate string width & height	
    width = GetTextWidth((XCHAR *)pHWData->pHWStr, pHWData->pHWFont);
    height = GetTextHeight(pHWData->pHWFont);

    //-----------------------------------------------------------------
    // interlace the erasing and printing of characters
    // check first if we need to move in the positive or negative direction
    if((xPos + width) >= (STXXPOS + STXWIDTH))
        x = -(mov);
    if(xPos <= (STXXPOS))
        x = (mov);

    if((yPos + height) >= (STXYPOS + STXHEIGHT))
        y = -(mov);
    if(yPos <= (STXYPOS))
        y = (mov);

    pString = pHWData->pHWStr;
    oldX = xPos;
    oldY = yPos;
    newX = xPos + x;
    newY = yPos + y;
    while((XCHAR)15 < (XCHAR)(NewChar = *pString++))
    {

        // remove the old position of the character
        SetColor(FontScheme2->CommonBkColor);
        MoveTo(oldX, oldY);
        WAIT_UNTIL_FINISH(OutChar(NewChar));
        oldX = GetX();
        oldY = GetY();

        // display the character in the new position
        SetColor(BRIGHTBLUE);
        MoveTo(newX, newY);
        WAIT_UNTIL_FINISH(OutChar(NewChar));
        newX = GetX();
        newY = GetY();
    }

    xPos += x;
    yPos += y;

    // disable the clipping
    SetClip(CLIP_DISABLE);
}
开发者ID:Athuli7,项目名称:Microchip,代码行数:72,代码来源:MultiFontsDemo.c


示例5: remove_timer

// solar: if lifetime is 0 this is a permanent beacon.. not sure if that'll be
// useful for anything
Beacon::Beacon(Mob *at_mob, int lifetime)
:Mob
(
	nullptr, nullptr, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
),
		remove_timer(lifetime),
		spell_timer(0)
{
	remove_timer.Disable();
	spell_timer.Disable();
	remove_me = false;
	spell_id = 0xFFFF;
	resist_adjust = 0;
	spell_iterations = 0;
	caster_id = 0;

	// copy location
	x_pos = at_mob->GetX();
	y_pos = at_mob->GetY();
	z_pos = at_mob->GetZ();
	heading = at_mob->GetHeading();

	if(lifetime)
	{
		remove_timer.Start();
	}
#ifdef SOLAR
	entity_list.Message(0, 0, "Beacon being created at %0.2f %0.2f %0.2f heading %0.2f lifetime %d", GetX(), GetY(), GetZ(), GetHeading(), lifetime);
#endif
}
开发者ID:fizzgig16,项目名称:Server,代码行数:33,代码来源:beacon.cpp


示例6: main

/*****************************************
 *int main (void)
 *****************************************/
int main (void)
{
    InitializeHardware();
    HardwareButtonInit();
    InitAllLEDs();
    
#ifdef USE_BISTABLE_DISPLAY_GOL_AUTO_REFRESH     
	GFX_DRIVER_AutoUpdPart();		// Turn on widget auto update, partial update for less flashing
#endif
    
    InitTick();
	GOLInit();

    SetColor(WHITE);
    ClearDevice();

	// Set proper display rotation
#if(DISP_ORIENTATION == 90)
    GFX_DRIVER_InitRotmode(ROTATE_90);
#else
#error "This PICTail display orientation must be 90."
#endif
       
	// make sure that the correct hex file is loaded
    CheckExternalFlashHex();

	// Create cursor in GFX_CURSOR_LAYER with Alpha Color = 0xA
	GFX_DRIVER_CreateLayer( GFX_CURSOR_LAYER, GFX_LAYER_TRANS_EN | 0xA, GetX(), GetY(), GetX() + 31, GetY() + 31 );
	GFX_DRIVER_ActivateLayer( GFX_CURSOR_LAYER );
	PutImage(0, 0, (void *)&mouse_cursor_icon_270, IMAGE_NORMAL); 
	GFX_DRIVER_ActivateLayer( GFX_MAIN_LAYER );
	
	// Start demo screen 
	demoScreens = DEMO_INTRO_SCREEN_CREATE;
	
    while(1)
	{
        GOLDraw();
#ifndef USE_BISTABLE_DISPLAY_GOL_AUTO_REFRESH
	#if defined( ONE_CYCLE_DRAWING	) 
		// The screen drawing starts and completes during one while(1) cycle loop in main().
		// This Demo is one cycle drawing application.
        if ( GFX_DRIVER_IsUpdateRequested() || (g_UPDATE_FLAGS == GFX_UPDATE_AS_IT_DRAWS) )
        {
	    	GFX_DRIVER_UpdateEpd( g_UPDATE_FLAGS, 0, 0, GetMaxX(), GetMaxY() ); 
	    	g_UPDATE_FLAGS = GFX_UPDATE_NO_FLASH | GFX_WAIT_IMAGE_DISPLAYED;   
	    }
	#else
		// This way can be used when drawing may take few or more cycles of while(1) loop in main().
		// See "tick.c" file for details.
        if ( g_UpdateNow || (g_UPDATE_FLAGS == GFX_UPDATE_AS_IT_DRAWS) )
        {
	        g_UpdateNow = 0;
	    	GFX_DRIVER_UpdateEpd( g_UPDATE_FLAGS, 0, 0, GetMaxX(), GetMaxY() ); 
	    	g_UPDATE_FLAGS = GFX_UPDATE_NO_FLASH | GFX_WAIT_IMAGE_DISPLAYED;   
	    }	
	#endif
#endif		 
	}	

    return (-1);
}
开发者ID:Athuli7,项目名称:Microchip,代码行数:65,代码来源:MainDemo.c


示例7: GetX

/**\brief Slider mouse down call back.
 */
bool Slider::MouseLUp( int xi, int yi ){
	this->SetVal(this->PixelToVal(xi - GetX()));
	Widget::MouseLDown( xi, yi );;
	if(OPTION(int, "options/sound/buttons")) UI::beep->Play();
	return true;
}
开发者ID:cthielen,项目名称:epiar,代码行数:8,代码来源:ui_slider.cpp


示例8: SetupBlendingFunction

void CGSH_Direct3D9::SetRenderingContext(uint64 primReg)
{
	auto prim = make_convertible<PRMODE>(primReg);

	unsigned int context = prim.nContext;

	uint64 testReg = m_nReg[GS_REG_TEST_1 + context];
	uint64 frameReg = m_nReg[GS_REG_FRAME_1 + context];
	uint64 alphaReg = m_nReg[GS_REG_ALPHA_1 + context];
	uint64 zbufReg = m_nReg[GS_REG_ZBUF_1 + context];
	uint64 tex0Reg = m_nReg[GS_REG_TEX0_1 + context];
	uint64 tex1Reg = m_nReg[GS_REG_TEX1_1 + context];
	uint64 clampReg = m_nReg[GS_REG_CLAMP_1 + context];
	uint64 scissorReg = m_nReg[GS_REG_SCISSOR_1 + context];

	if(!m_renderState.isValid ||
		(m_renderState.primReg != primReg))
	{
		m_device->SetRenderState(D3DRS_ALPHABLENDENABLE, ((prim.nAlpha != 0) && m_alphaBlendingEnabled) ? TRUE : FALSE);
	}

	if(!m_renderState.isValid ||
		(m_renderState.alphaReg != alphaReg))
	{
		SetupBlendingFunction(alphaReg);
	}

	if(!m_renderState.isValid ||
		(m_renderState.testReg != testReg))
	{
		SetupTestFunctions(testReg);
	}

	if(!m_renderState.isValid ||
		(m_renderState.zbufReg != zbufReg) ||
		(m_renderState.frameReg != frameReg))
	{
		SetupDepthBuffer(zbufReg, frameReg);
	}

	if(!m_renderState.isValid ||
		(m_renderState.frameReg != frameReg) ||
		(m_renderState.scissorReg != scissorReg))
	{
		SetupFramebuffer(frameReg, scissorReg);
	}

	if(!m_renderState.isValid ||
		(m_renderState.tex0Reg != tex0Reg) ||
		(m_renderState.tex1Reg != tex1Reg) ||
		(m_renderState.clampReg != clampReg))
	{
		SetupTexture(tex0Reg, tex1Reg, clampReg);
	}

	m_renderState.isValid = true;
	m_renderState.primReg = primReg;
	m_renderState.alphaReg = alphaReg;
	m_renderState.testReg = testReg;
	m_renderState.zbufReg = zbufReg;
	m_renderState.frameReg = frameReg;
	m_renderState.tex0Reg = tex0Reg;
	m_renderState.tex1Reg = tex1Reg;
	m_renderState.clampReg = clampReg;
	m_renderState.scissorReg = scissorReg;

	auto offset = make_convertible<XYOFFSET>(m_nReg[GS_REG_XYOFFSET_1 + context]);
	m_nPrimOfsX = offset.GetX();
	m_nPrimOfsY = offset.GetY();
	
	if(GetCrtIsInterlaced() && GetCrtIsFrameMode())
	{
		if(m_nCSR & CSR_FIELD)
		{
			m_nPrimOfsY += 0.5;
		}
	}
}
开发者ID:AbandonedCart,项目名称:Play-,代码行数:78,代码来源:GSH_Direct3D9.cpp


示例9: Point

Point Tile::GetPoint() const
{
	return Point(GetX(), GetY());
}
开发者ID:stuzeakd,项目名称:NEXT-study-CPP-BattleShip,代码行数:4,代码来源:Tile.cpp


示例10: GetAquarium

void CFish::BreedingUpdate(double elapsed)
{
	
	CAquarium *aquarium = GetAquarium();
	//fish logic for breeding
	if (mCanBreed == true && mAge >= MaxAge)
	{
		if (mInterestTime >= InterestTimePreBreed)
		{
			mIsInterested = true;
		}
		else if (mIsGestating == false)
			mInterestTime++;
		if (mIsGestating == true)
			mGestatingTime++;

		if (mIsInterested == true)
		{
			CBreedVisitor visitor(mIsMale, GetType());
			
			aquarium->Accept(&visitor);
			if (visitor.IsInterested())
			{
				// Compute a vector from (x1,y1) to (x2,y2)
					
				double dx = visitor.GetX() - GetX();
				double dy = visitor.GetY() - GetY();				
				
				// How long is that vector?
				double len = sqrt(dx * dx + dy * dy);
				if (len > 0)
				{
					// Normalize the vector
					dx /= len;
					dy /= len;
				}

				// Update the location
				if (GetType() == "beta")
				{
					mSpeedX = dx * (MaxSpeedX - BetaSpeed) * BreedMultuplier * elapsed;
					mSpeedY = dy * (MaxSpeedY - BetaSpeed) * BreedMultuplier * elapsed;
				}

				if (GetType() == "bubbles")
				{
					mSpeedX = dx * (MaxSpeedX - BubblesSpeed) * BreedMultuplier * elapsed;
					mSpeedY = dy * (MaxSpeedY - BubblesSpeed) * BreedMultuplier * elapsed;
				}

				if (GetType() == "dory")
				{
					mSpeedX = dx * (DorySpeed - MaxSpeedX) * BreedMultuplier * elapsed;
					mSpeedY = dy * (DorySpeed - MaxSpeedY) * BreedMultuplier * elapsed;
				}

				

				// check if the visited fish overlaps this one
				if (OverlapTest(visitor.GetX(), visitor.GetY()))
				{
					if (mIsMale == 0)
					{
						mIsGestating = true;
					}
					else
					{
						visitor.SetGestating();
					}
					mIsInterested = false;
					mInterestTime = 0;
					visitor.SetUninterested();
					if (GetType() == "beta")
					{
						mSpeedX = ((double)rand() / RAND_MAX) * (MaxSpeedX - BetaSpeed);
						mSpeedY = ((double)rand() / RAND_MAX) * (MaxSpeedY - BetaSpeed);
					}
					else if (GetType() == "bubbles")
					{
						mSpeedX = ((double)rand() / RAND_MAX) * (MaxSpeedX - BubblesSpeed);
						mSpeedY = ((double)rand() / RAND_MAX) * (MaxSpeedY - BubblesSpeed);
					}
					else if (GetType() == "dory")
					{
						mSpeedX = ((double)rand() / RAND_MAX) * (DorySpeed- MaxSpeedX);
						mSpeedY = ((double)rand() / RAND_MAX) * (DorySpeed- MaxSpeedY);
					}
					
										
				}
				
			}


		}

		if (mGestatingTime >= GestatingTime)
		{
			mIsGestating = false;
			mGestatingTime = 0;
//.........这里部分代码省略.........
开发者ID:Hutecker,项目名称:Aquarium-Project,代码行数:101,代码来源:Fish.cpp


示例11: return

bool Player::IsPointWithin(int x, int y)
{
	return (x > (GetX()) && GetX() + GetWidth()  > x) && (y > GetY()  && GetY() + GetWidth() > y);
}
开发者ID:copyzerov3,项目名称:Pacman,代码行数:4,代码来源:Player.cpp


示例12: SetX

void Sprite::MoveLeft(Dim x) {
		if(GetX() > x)
				SetX(GetX() - x);
}
开发者ID:Christos-Papoulas,项目名称:hy454_game,代码行数:4,代码来源:Sprites.cpp


示例13: rp

wxRealPoint ExplainShape::GetEndPoint(int kidNo)
{
    wxRealPoint rp(GetX() - GetBitmap().GetWidth() / 2.0 - ARROWMARGIN, GetY() - (GetHeight()-GetBitmap().GetHeight()) / 2. + (kidCount>1 ? GetBitmap().GetHeight() * 2. /3. * kidNo / (2*kidCount-2) : 0 ));
    return rp;
}
开发者ID:lhcezar,项目名称:pgadmin3,代码行数:5,代码来源:explainShape.cpp


示例14: Packet

WorldPacket Creature::PackData()
{
    WorldPacket Packet((uint16)MSG_ADD_OBJECT);
    Packet << ObjID << pTemplate->Tileset << pTemplate->Name << GetX() << GetY() << pTemplate->tx << pTemplate->ty;
    return Packet;
}
开发者ID:calkut,项目名称:Warrior-of-Dreamworld,代码行数:6,代码来源:Creature.cpp


示例15: Calculate

struct Cluster* Calculate(struct Points* Field, int Height, int Width, int* Num, int NumOfPoints)
{
	struct Cluster *Clusters;
	int i,j,k,NumOfClusters;
	int n;
	double Min;
	/*int Min_x;
	int Min_y;
	int Max_x;
	int Max_y;*/
	double New_Cluster_X;
	double New_Cluster_Y;
	int Min_cluster;
	double Distance;
	double Point_X, Point_Y;
	int Flag = 1;
	int New_Flag;
	
	
	printf("Enter number of clusters: ");
	scanf("%d",&NumOfClusters);
	
	Clusters = (struct Cluster*)malloc(NumOfClusters * sizeof(struct Cluster));
	Init_Clusters(Clusters, NumOfClusters);
	
	srand(time(NULL));
	
	for(i = 0; i< NumOfClusters; i++)
	{
		Clusters[i].x = (double)(rand()%Width);
		Clusters[i].y = (double)(rand()%Height);
	}

	#pragma omp parallel for private(i, Min)
	for(i = 0;i<NumOfPoints;i++)
	{
		Min = (double)(Height + Width);
		for(k = 0; k<NumOfClusters; k++)
		{
			Distance = Dist(Field[i].x,Field[i].y,Clusters[k].x,Clusters[k].y);
			if(Distance < Min)
			{
				Min = Distance;
				Min_cluster = k;
			}
		}
		Field[i].cluster = Min_cluster;
		Clusters[Min_cluster] = AddIndex(Clusters[Min_cluster], i);
	}
	
	while(Flag == 1)
	{
		Flag = 0;
		#pragma omp parallel for private(k)
		for(k=0; k<NumOfClusters; k++)
		{
			n = GetClusterNumOfPoints(Clusters[k]);
			New_Cluster_X = 0;
			New_Cluster_Y = 0;
			
			/*for(i = 0; i < n; i++)
			{
				Point_X = GetX(Field, Clusters[k],i);
				Point_Y = GetY(Field, Clusters[k],i);
				New_Cluster_X = (i*New_Cluster_X + Point_X)/(i+1);//vot on obhod perepolneniya
				New_Cluster_Y = (i*New_Cluster_Y + Point_Y)/(i+1);
			}*/
			#pragma omp parallel for private(i) reduction(+:New_Cluster_X, New_Cluster_Y)
			for(i = 0; i < n; i++)
			{
				New_Cluster_X += GetX(Field, Clusters[k],i)/n;
				New_Cluster_Y += GetY(Field, Clusters[k],i)/n;
			}
			Clusters[k].x = New_Cluster_X;
			Clusters[k].y = New_Cluster_Y;
		}
		Clear_Points(Clusters, NumOfClusters);
		#pragma omp parallel for private(i, Min)
		for(i = 0;i<NumOfPoints;i++)
		{
			Min = (double)(Height + Width);
			for(k = 0; k<NumOfClusters; k++)
			{
				Distance = Dist(Field[i].x,Field[i].y,Clusters[k].x,Clusters[k].y);
				if(Distance < Min)
				{
					Min = Distance;
					Min_cluster = k;
				}
			}
			if(Field[i].cluster != Min_cluster)
				Flag = 1;
			Field[i].cluster = Min_cluster;
			Clusters[Min_cluster] = AddIndex(Clusters[Min_cluster], i);
		}
	}
	*Num = NumOfClusters;
	return Clusters;
}
开发者ID:StaVorosh,项目名称:K-Means-method,代码行数:99,代码来源:main.c


示例16: SuggestMove

void ribi::con3::ConnectThreeWidget::DoComputerMove() noexcept
{
  const auto move = SuggestMove();
  assert(CanDoMove(move.GetX(),move.GetY()));
  DoMove(move.GetX(),move.GetY());
}
开发者ID:richelbilderbeek,项目名称:ConnectThree,代码行数:6,代码来源:connectthreewidget.cpp


示例17: AI_SetRoambox

void NPC::AI_SetRoambox(float iDist, float iRoamDist, uint32 iDelay, uint32 iMinDelay) {
	AI_SetRoambox(iDist, GetX()+iRoamDist, GetX()-iRoamDist, GetY()+iRoamDist, GetY()-iRoamDist, iDelay, iMinDelay);
}
开发者ID:UnityEQ,项目名称:UnityEQServer,代码行数:3,代码来源:waypoints.cpp


示例18: Choose

func Choose()
{
	aTrans[GetLength(aTrans)] = FindObject2(Find_ID(ASTE),Find_Distance(100,GetX(User)-GetX(),GetY(User)-GetY()),Sort_Distance());
	CallMessageBoard(0,false,"Bitte geben Sie eine passende Beschreibung ein:",GetOwner(User));
}
开发者ID:maxmitti,项目名称:SGGP,代码行数:5,代码来源:Script.c


示例19: GetX

int Api::_GetX(Object* target){
  return GetX(target);
}
开发者ID:RKX1209,项目名称:Dnscript,代码行数:3,代码来源:Api.cpp


示例20: GetID

Beacon::~Beacon()
{
#ifdef SOLAR
	entity_list.Message(0, 0, "Beacon %d being removed at %0.2f %0.2f %0.2f heading %0.2f", GetID(), GetX(), GetY(), GetZ(), GetHeading());
#endif
}
开发者ID:fizzgig16,项目名称:Server,代码行数:6,代码来源:beacon.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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