您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetDistance函数代码示例

51自学网 2021-06-01 21:06:44
  C++
这篇教程C++ GetDistance函数代码示例写得很实用,希望能帮到您。

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

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

示例1: D3DXMatrixInverse

route_node* CRouter::InitCurDest(const D3DXMATRIX *mat){	route_node *pDest = NULL;	route_node *temp = m_pRouteList->GetRouteList();	if (temp == NULL)		return NULL;	D3DXVECTOR3 vCur, vPrev;	D3DXMATRIX mInverse;	D3DXMatrixInverse(&mInverse, NULL, mat);	float	fDistance = 1e10;	do 	{		D3DXVec3TransformCoord(&vCur, temp->pPos, &mInverse);		D3DXVec3TransformCoord(&vPrev, temp->pPrev->pPos, &mInverse);		if ((vCur.z > 0) && (vPrev.z < 0))		{			vCur.y = vPrev.y = 0.0f;//消除俯仰偏角			//避免存在平行街道,如果存在,取最近的一条			if (fDistance > GetDistance(&vCur, &vPrev))			{				fDistance = GetDistance(&vCur, &vPrev);				pDest = temp;			}		}		temp = temp->pNext;	}	while (temp != m_pRouteList->GetRouteList());	return pDest;}
开发者ID:flair2005,项目名称:vr-bike,代码行数:31,


示例2: GetDistance

void InterpolatorDistance2::GetInterpolationWeight(NNCandidate candidates[3], 	int* indices, float* weights, Vertex v) {	int K=3;	float dist_v_c1 = GetDistance(v.pos, candidates[0].vertex.pos);	float dist_v_c2 = GetDistance(v.pos, candidates[1].vertex.pos);	float dist_v_c3 = GetDistance(v.pos, candidates[2].vertex.pos);		float normalize = dist_v_c1 * dist_v_c2 + 										dist_v_c1 * dist_v_c3 + 										dist_v_c2 * dist_v_c3;	if(normalize == 0.0f){		for(int i=0; i<K; ++i){			weights[i] = 1.0f/3.0f;		}	}	else{		weights[0] = dist_v_c2 * dist_v_c3 / normalize;		weights[1] = dist_v_c1 * dist_v_c3 / normalize;		weights[2] = dist_v_c1 * dist_v_c2 / normalize;	}	for(int i=0; i<K; ++i){		indices[i] = candidates[i].index;	}}
开发者ID:flosmn,项目名称:MeshPRT,代码行数:27,


示例3: while

/***  @brief*    Sets the node position*/void GraphNode::SetPos(float fX, float fY, float fZ){	// Set new position	m_vPos.SetXYZ(fX, fY, fZ);	{ // Calculate all node distances		Iterator<Neighbour*> cIterator = m_lstNeighbours.GetIterator();		while (cIterator.HasNext()) {			Neighbour *pNeighbour = cIterator.Next();			pNeighbour->fDistance = GetDistance(*pNeighbour->pNode);		}	}	{ // Update all neighbour node distances		Iterator<GraphNode*> cIterator = m_lstIsNeighbourFrom.GetIterator();		while (cIterator.HasNext()) {			// Find this node within the neighbour			Iterator<Neighbour*> cNeighbourIterator = cIterator.Next()->m_lstNeighbours.GetIterator();			while (cNeighbourIterator.HasNext()) {				Neighbour *pNeighbour = cNeighbourIterator.Next();				if (pNeighbour->pNode == this) {					pNeighbour->fDistance = GetDistance(*pNeighbour->pNode);					break;				}			}		}	}}
开发者ID:ByeDream,项目名称:pixellight,代码行数:32,


示例4: CheckNewPoint

void CheckNewPoint(void) {    // 检查是不是有没有处理的新点    if (chkedPntsN < spcPntsN && spcPnts[spcPntsN].dist + 4 < GetDistance() ) {        if (lastAllWhiteDist == 0 || lastAllWhiteDist + 70 < GetDistance()) {            if (spcPnts[spcPntsN].allWhite > 0) {                // 进入坡道                //PORTB = ~(1);                lastAllWhiteDist = GetDistance();                ProcRamp();            }            if (spcPnts[spcPntsN].allBlack > 0 || spcPnts[spcPntsN].likeStart > 0) {                // 此处 乘3 因为allBlack 往往比 likeStart 大很多                if (spcPnts[spcPntsN].allBlack > spcPnts[spcPntsN].likeStart * 3) {                    // 交叉点                    //PORTB = ~PORTB;                    ProcCrossLine();                } else {                    // 出发线                    //PORTB = 0x9;                    ProcStartLine();                }            }        }        chkedPntsN++;    }}
开发者ID:xfguo,项目名称:freescalesmartcar,代码行数:32,


示例5:

GameObject* S013010C_Aaron_Smith_Steering::GetClosestObject(Vector2D ahead1, Vector2D ahead2){	GameObject* closestObj = nullptr;	obstacles = ObstacleManager::Instance()->GetObstacles();	for (GameObject* obj : obstacles)	{		//bool collision = CheckLineInstersect(ahead1, ahead2, obj);				bool collision = Collisions::Instance()->PointInBox(ahead2, obj->GetAdjustedBoundingBox());		if (collision)		{					if (closestObj == NULL)				closestObj = obj;			else			{				if (GetDistance(mTank->GetCentrePosition(), obj->GetCentralPosition()) < GetDistance(mTank->GetCentrePosition(), closestObj->GetCentralPosition()))					closestObj = obj;			}		}			}	return closestObj;}
开发者ID:CrohnsAndMe,项目名称:Test,代码行数:28,


示例6: GetMinDistance

f32 Toolkit :: GetMinDistance(position2df p, Node2DInfo* pNode2DInfo){	core::line2df l[4];	f32 minDis = 0.f;	l[0].start = pNode2DInfo->corner[0];	l[0].end = pNode2DInfo->corner[1];	l[1].start = pNode2DInfo->corner[1];	l[1].end = pNode2DInfo->corner[2];	l[2].start = pNode2DInfo->corner[2];	l[2].end = pNode2DInfo->corner[3];	l[3].start = pNode2DInfo->corner[3];	l[3].end = pNode2DInfo->corner[0];	minDis = GetDistance(l[0].getClosestPoint(p), p);	for (int i = 0; i < 4; i++)	{		f32 t = GetDistance(l[i].getClosestPoint(p), p);		if ( minDis > t )		{			minDis = t;		}	}		return minDis;}
开发者ID:HermanYang,项目名称:Scar,代码行数:27,


示例7: FindWaypoint

bool NPC::DoWaypointNav (void){	if (m_currentWaypointIndex < 0 || m_currentWaypointIndex >= g_numWaypoints)		FindWaypoint();	float waypointDistance = GetDistance(pev->origin, m_waypointOrigin);	float desiredDistance = g_waypoint->g_waypointPointRadius[m_currentWaypointIndex];	if (desiredDistance < 16.0f && waypointDistance < 30.0f)	{		Vector nextFrameOrigin = pev->origin + (pev->velocity * m_frameInterval);		if (GetDistance(nextFrameOrigin, m_waypointOrigin) >= waypointDistance)			desiredDistance = waypointDistance + 1.0f;	}		if (waypointDistance < desiredDistance)	{		if (m_goalWaypoint == m_currentWaypointIndex)			return true;		else if (m_navNode == null)			return false;		HeadTowardWaypoint();		return false;	}	if (GetDistance(m_waypointOrigin, pev->origin) <= 2.0f)		HeadTowardWaypoint();	return false;}
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:32,


示例8: hgeCreate

void Hero::Dash(){	HGE *hge = hgeCreate(HGE_VERSION);	GameObject *temp = GameObject::MakePosObject(TargetX2, TargetY2);	if (locked == false)	{		SowrdCharge -= GetDistance(temp);		if ((int)SowrdCharge > 0) 		{			locked = true;			adddmg = GetDistance(temp) / 20;			TargetX = TargetX2;			TargetY = TargetY2;		}		else		{			SowrdCharge += GetDistance(temp);			return;		}	}	if (locked)	{			SetSpeed(SPEED + (GetDistance(temp) * 8));	}}
开发者ID:Hiseen,项目名称:HGE1,代码行数:26,


示例9: ClickDoor

void MQ2NavigationPlugin::AttemptClick(){	if (!m_isActive && !m_bSpamClick)		return;	// don't execute if we've got an item on the cursor.	if (GetCharInfo2()->pInventoryArray && GetCharInfo2()->pInventoryArray->Inventory.Cursor)		return;	clock::time_point now = clock::now();	// only execute every 500 milliseconds	if (now < m_lastClick + std::chrono::milliseconds(500))		return;	m_lastClick = now;	if (m_pEndingDoor && GetDistance(m_pEndingDoor->X, m_pEndingDoor->Y) < 25)	{		ClickDoor(m_pEndingDoor);	}	else if (m_pEndingItem && GetDistance(m_pEndingItem->X, m_pEndingItem->Y) < 25)	{		ClickGroundItem(m_pEndingItem);	}}
开发者ID:dannuic,项目名称:MQ2Nav,代码行数:25,


示例10: ProcStartLine

void ProcStartLine(void) {    nowLoop++;    switch (nowLoop) {    case 1:        PORTB = ~0x22;        StartLineDist[0] = GetDistance();        break;    case 2:        StartLineDist[1] = GetDistance();        PORTB = 0xA5;        // 跑完第二圈后停下        DistLimit = ( GetDistance() + (StartLineDist[1] - StartLineDist[0]) ) / 25 + 4;        /** 在这里触发路径播放 **/        StartPathPlay();        //maxSpeed = 110;        //minSpeed = 75;        break;    case 3:        // 到第三圈后停下        StartLineDist[2] = GetDistance();        PORTB = 0x81;        //DistLimit = GetDistance() / 25 + 2;        break;    default:        break;    }}
开发者ID:xfguo,项目名称:freescalesmartcar,代码行数:34,


示例11: sort

void PreRanker::Filter(bool viewportSearch){  using TSet = set<impl::PreResult1, LessFeatureID>;  TSet theSet;  sort(m_results.begin(), m_results.end(), ComparePreResult1());  m_results.erase(unique(m_results.begin(), m_results.end(), EqualFeatureID()), m_results.end());  sort(m_results.begin(), m_results.end(), &impl::PreResult1::LessDistance);  if (m_limit != 0 && m_results.size() > m_limit)  {    // Priority is some kind of distance from the viewport or    // position, therefore if we have a bunch of results with the same    // priority, we have no idea here which results are relevant.  To    // prevent bias from previous search routines (like sorting by    // feature id) this code randomly selects tail of the    // sorted-by-priority list of pre-results.    double const last = m_results[m_limit - 1].GetDistance();    auto b = m_results.begin() + m_limit - 1;    for (; b != m_results.begin() && b->GetDistance() == last; --b)      ;    if (b->GetDistance() != last)      ++b;    auto e = m_results.begin() + m_limit;    for (; e != m_results.end() && e->GetDistance() == last; ++e)      ;    // The main reason of shuffling here is to select a random subset    // from the low-priority results. We're using a linear    // congruential method with default seed because it is fast,    // simple and doesn't need an external entropy source.    //    // TODO (@y, @m, @vng): consider to take some kind of hash from    // features and then select a subset with smallest values of this    // hash.  In this case this subset of results will be persistent    // to small changes in the original set.    minstd_rand engine;    shuffle(b, e, engine);  }  theSet.insert(m_results.begin(), m_results.begin() + min(m_results.size(), m_limit));  if (!viewportSearch)  {    size_t n = min(m_results.size(), m_limit);    nth_element(m_results.begin(), m_results.begin() + n, m_results.end(),                &impl::PreResult1::LessRank);    theSet.insert(m_results.begin(), m_results.begin() + n);  }  m_results.reserve(theSet.size());  m_results.clear();  copy(theSet.begin(), theSet.end(), back_inserter(m_results));}
开发者ID:igortomko,项目名称:omim,代码行数:57,


示例12: NodeFromWorldPoint

vector<PositionNode*> AstarPathfind::FindPath(Vector2 startPos, Vector2 targetPos){	PositionNode* startNode = NodeFromWorldPoint(startPos);	PositionNode* targetNode = NodeFromWorldPoint(targetPos);	vector<PositionNode*> openSet;	vector<PositionNode*> closeSet;	openSet.push_back(startNode);	while(openSet.size() > 0)	{		PositionNode* currentNode = openSet[0];				for(int i = 1; i < openSet.size(); ++i)		{			if(openSet[i]->GetfCost() < currentNode->GetfCost() || (openSet[i]->GetfCost() == currentNode->GetfCost() && openSet[i]->GethCost() < currentNode->GethCost()))			{				currentNode = openSet[i];			}		}		openSet.erase(std::remove(openSet.begin(), openSet.end(), currentNode), openSet.end());		closeSet.push_back(currentNode);		if(currentNode == targetNode)		{			openSet.clear();			closeSet.clear();			return RetracePath(startNode, targetNode);		}		vector<PositionNode*> neighbours = GetNeighbours(currentNode);		for(int i = 0; i < neighbours.size(); ++i)		{			if(!neighbours[i]->GetWalkable() || (std::find(closeSet.begin(), closeSet.end(), neighbours[i]) != closeSet.end()))			{				continue;			}			int newMovementCostToNeighbour = currentNode->GetgCost() + GetDistance(currentNode, neighbours[i]);			if(newMovementCostToNeighbour < neighbours[i]->GetgCost() || !(std::find(openSet.begin(), openSet.end(), neighbours[i]) != openSet.end()))			{				neighbours[i]->SetgCost(newMovementCostToNeighbour);				neighbours[i]->SethCost(GetDistance(neighbours[i], targetNode));				neighbours[i]->SetParentNode(currentNode);				if(!(std::find(openSet.begin(), openSet.end(), neighbours[i]) != openSet.end()))				{					openSet.push_back(neighbours[i]);				}			}		}	}}
开发者ID:blazetrinity,项目名称:SP3,代码行数:57,


示例13: ln

double F::DISTANCE::GetLineSegmentPointDistance(const CLineSegment &_ls, const CVector &_p ){	CLine ln(_ls);	double dist = GetLinePointDistance(ln,_p);	if(F::INTERSECTION::PointProjectionOnLineSegment(_p, _ls))		return dist;	return F::MISC::Min(GetDistance(_ls.a,_p), GetDistance(_ls.b,_p));}
开发者ID:vladamakaric,项目名称:softBodyDynamics,代码行数:10,


示例14: NewSpecialPoint

// 检测是不是同一个点, 不是则新开一个void NewSpecialPoint(void) {    if (GetDistance() - spcPnts[spcPntsN].dist > 8) {        if (spcPntsN > 28) return;        spcPntsN++;        spcPnts[spcPntsN].allWhite = 0;        spcPnts[spcPntsN].allBlack = 0;        spcPnts[spcPntsN].likeStart = 0;        spcPnts[spcPntsN].dist = GetDistance();    }}
开发者ID:xfguo,项目名称:freescalesmartcar,代码行数:11,


示例15: IsInside

	Side Plane::IsInside(const BoxBounds& aabb) const	{		if (GetDistance(aabb.GetVertexP(mNormal)) < 0) {			return Side::Out;		}		if (GetDistance(aabb.GetVertexN(mNormal)) > 0)		{			return Side::In;		}		return Side::Cross;	}
开发者ID:luxuia,项目名称:JustEngine,代码行数:11,


示例16: ComputeDistance

long ComputeDistance(struct person **company, unsigned char count){	long retVal = 0;	int i = 0;	while (i < count-1) {		retVal += GetDistance(company[i], company[i+1]);		i++;	}	retVal += GetDistance(company[i], company[0]);	return retVal;}
开发者ID:adventofcode,项目名称:2015solutions,代码行数:11,


示例17: AddLastInfo

void GpsTrackFilter::Process(vector<location::GpsInfo> const & inPoints,                             vector<location::GpsTrackInfo> & outPoints){  outPoints.reserve(inPoints.size());  if (m_minAccuracy == 0)  {    // Debugging trick to turn off filtering    outPoints.insert(outPoints.end(), inPoints.begin(), inPoints.end());    return;  }  for (location::GpsInfo const & currInfo : inPoints)  {    // Do not accept points from the predictor    if (currInfo.m_source == location::EPredictor)      continue;    // Skip any function without speed    if (!currInfo.HasSpeed())      continue;    if (m_countAcceptedInfo < 2 || currInfo.m_timestamp < GetLastAcceptedInfo().m_timestamp)    {      AddLastInfo(currInfo);      AddLastAcceptedInfo(currInfo);      continue;    }    if (IsGoodPoint(currInfo))    {      double const predictionDistance = GetDistance(m_lastInfo[1], m_lastInfo[0]); // meters      double const realDistance = GetDistance(m_lastInfo[0], currInfo); // meters      m2::PointD const predictionDirection = GetDirection(m_lastInfo[1], m_lastInfo[0]);      m2::PointD const realDirection = GetDirection(m_lastInfo[0], currInfo);      // Cosine of angle between prediction direction and real direction is      double const cosine = m2::DotProduct(predictionDirection, realDirection);      // Acceptable angle must be from 0 to 45 or from 0 to -45.      // Acceptable distance must be not great than 2x than predicted, otherwise it is jump.      if (cosine >= kCosine45degrees &&          realDistance <= std::max(kClosePointDistanceMeters, 2. * predictionDistance))      {        outPoints.emplace_back(currInfo);        AddLastAcceptedInfo(currInfo);      }    }    AddLastInfo(currInfo);  }}
开发者ID:milchakov,项目名称:omim,代码行数:53,


示例18: GetDistance

// Description: Calculates tour distanceint TSPSolver::CalcTourDistance(){	int dist = 0;	int size = tour.size();	for (int i = 0; i < size - 1; i++)		dist += GetDistance(tour.at(i), tour.at(i + 1));	// accumulate all distances	// And back to the beginning	dist += GetDistance(tour.at(size - 1), tour.at(0));	return dist;}
开发者ID:MadredZ,项目名称:KSPT-TRPO-2012-Supaplex,代码行数:14,


示例19: IsStable

int IsStable(REAL ax,REAL ay,REAL ra,REAL ex,REAL ey,REAL re){	if((GetDistance(ax,ay,ex,ey)-GetPlateauEqual(ra,re))<0.01/*&&(GetDistance(ax,ay,ex,ey)-GetPlateauEqual(ra,re))>-0.01*/)=======	if((GetDistance(ax,ay,ex,ey)-GetPlateauEqual(ra,re))<0.001/*&&(GetDistance(ax,ay,ex,ey)-GetPlateauEqual(ra,re))>-0.01*/)	{ cout<<GetDistance(ax,ay,ex,ey)-GetPlateauEqual(ra,re)<<endl;		cout<<GetDistance(ax,ay,ex,ey)<<endl;		cout<<GetPlateauEqual(ra,re)<<endl;		return 1;	}	else return 0;}
开发者ID:guningbo,项目名称:bubble,代码行数:13,


示例20: Zombie_UseBrain

void Zombie_UseBrain(Scene* scene, GameObject* zombie, int index, bool netUpdate){    int dx, dy;        if(zombie->ai.atkTimer > 0)    {        zombie->ai.atkTimer--;    }    if(zombie->ai.tsCounter>0)    {        zombie->ai.tsCounter--;    }    else    {        zombie->ai.target = NULL;        zombie->ai.tsCounter=zombie->ai.tsFreq;    }    if(zombie->ai.target == NULL)//Searching for a target    {        zombie->ai.target = FindPlayer(scene, zombie, zombie->ai.detectRange);    }    if(zombie->ai.target == NULL)        return;        dx = zombie->rect.x - (zombie->ai.target->x + (zombie->ai.target->w /2));    dy = zombie->rect.y - (zombie->ai.target->y + (zombie->ai.target->h /2));    zombie->rotation = 270 + (atan2(dy,dx)*180/M_PI);        dx = 0;    dy = 0;        dy -= sin((zombie->rotation + 90) * M_PI / 180.0f) * zombie->ai.speed; //object y's speed    dx -= cos((zombie->rotation + 90) * M_PI / 180.0f) * zombie->ai.speed; //object x's speed        if(GetDistance(*zombie->ai.target,zombie->rect) > zombie->ai.attackRange)//Sent object pos to server    {        MoveObject(zombie, scene, dx,dy, index);            }    else if(GetDistance(*zombie->ai.target,zombie->rect) <= zombie->ai.attackRange)    {        if(zombie->ai.ai == AI_SPITTER)            Zombie_Shoot(zombie, scene);        else if(zombie->ai.ai == AI_ZOMBIE)            Zombie_Attack(zombie, scene);    }    if(netUpdate)        SendObjectPos(zombie->obj_id, zombie->rect.x, zombie->rect.y, (int)zombie->rotation);}
开发者ID:antonwass,项目名称:zombiespel_server,代码行数:49,


示例21: ClearObjectives

void isdf07Mission::handlePlayerMistakes() {	if (missionState < 6) {	//Not enough scrap		if ((missionState>3) &&			(GetScrap(1) < 6) && (GetTime() > errorRemTime1)) {			ClearObjectives();			AddObjective("isdf0709.otf", WHITE);			AudioMessage("isdf0709.wav");			errorRemTime1 = (GetTime() + 60.0f);		}	}	if (!IsAlive(shabayev)) {	//kills shabayev	//	AudioMessage("Demo0304.wav"); // "Cooke.  You're being shipped back to Earth where you'll face court marshall for killing a commanding officer.	//	FailMission(GetTime() + 15.0f);	}/*	if (!IsAlive(player)) { //gets killed	//	AudioMessage("Demo0304.wav"); // you loose go to shell screen		FailMission(GetTime() + 15.0f);	}*/	if (missionState == 6) {//does not follow shabayev		if ((GetDistance(player, shabayev) > 400.0f) && (GetTime() < timeToFail)) {		//	AudioMessage("tooFar.wav"); //"Cooke, you're getting too far from my wing.  Fall in.			timeToFail = GetTime() + 60.0f;		}		else 		if (GetDistance(player, shabayev) < 400.0f) {			timeToFail = 0.0f;		}	}	if (missionState == 7) {//does not get out of his vehicle	}	if (missionState == 9) {//ignores shabayev's need for help		if ((GetDistance(player, shabayev) > 40.0f) && (GetTime() < timeToFail)) {		//	AudioMessage("tooFar.wav"); //"Cooke, you're getting too far from my wing.  Fall in.			timeToFail = GetTime() + 60.0f;		}		if  (GetDistance(player, shabayev) < 40.0f) {			timeToFail = 0.0f;		}	}}
开发者ID:Nielk1,项目名称:bz2-sp-fixes,代码行数:49,


示例22: GetCharInfo

bool MQ2NavigationPlugin::ClickNearestClosedDoor(float cDistance){	if (!ppSwitchMgr || !pSwitchMgr) return false;	PDOORTABLE pDoorTable = (PDOORTABLE)pSwitchMgr;	PDOOR pDoor = NULL;	PSPAWNINFO pChar = GetCharInfo()->pSpawn;	for (DWORD index = 0; index < pDoorTable->NumEntries; index++)	{		if (pDoorTable->pDoor[index]->Z <= pChar->Z + gZFilter &&			pDoorTable->pDoor[index]->Z >= pChar->Z - gZFilter)		{			FLOAT Distance = GetDistance(pDoorTable->pDoor[index]->X, pDoorTable->pDoor[index]->Y);			if (Distance < cDistance) {				pDoor = pDoorTable->pDoor[index];				cDistance = Distance;			}		}	}	if (pDoor) {		ClickDoor(pDoor);		return true;	}	return false;}
开发者ID:dannuic,项目名称:MQ2Nav,代码行数:26,


示例23: ProcRamp

void ProcRamp(void) {    PORTB = 0x77;    RampDist[RampDistN] = GetDistance();    RampDistN++;}
开发者ID:xfguo,项目名称:freescalesmartcar,代码行数:7,


示例24: do_GMKillNPC

void do_GMKillNPC(CPC *a1, char *a2){    CCharacter *v3; // [sp+20h] [bp-38h]@15    CCharacter *v4; // [sp+24h] [bp-34h]@16    int v8; // [sp+44h] [bp-14h]@5    int v9; // [sp+48h] [bp-10h]@5    int v10; // [sp+4Ch] [bp-Ch]@5    int v11; // [sp+50h] [bp-8h]@5    int v12; // [sp+54h] [bp-4h]@4    if(a2 && *a2)    {        AnyOneArg(a2, g_buf, 0);        v12 = atoi(g_buf);        if(v12 > 0)        {            v11 = a1->Unk140 - 2;            v10 = a1->Unk140 + 2;            v9 = a1->Unk144 - 2;            v8 = a1->Unk144 + 2;            CNetMsg v5;            for(int i = v11; i <= v10; ++i)            {                if(i >= 0 && i < a1->Unk412->Unk12)                {                    for(int j = v9; j <= v8; ++j)                    {                        if(j >= 0 && j < a1->Unk412->Unk16)                        {                            v3 = a1->Unk412->Unk28[i][j].Unk0;                            while(1)                            {                                v4 = v3;                                if(!v3)                                    break;                                v3 = v3->Unk404;                                if(v4->Unk0 == 1 && v12 > GetDistance(a1, v4))                                {                                    DamageMsg(v5, a1, v4, 0, -1, v4->Unk78, 4);                                    v4->Unk412->SendToCell(v5, v4, 0, 4);                                    v4->Unk76 = 0;                                    if(v4->Unk76 <= 0)                                    {                                        DelAttackList(v4);                                        a1->Unk412->CharFromCell(v4);                                        a1->Unk412->DelNPC((CNPC *)v4);                                    }                                }                            }                        }                    }                }            }        }    }}
开发者ID:Christian-Roggia,项目名称:open-last-chaos,代码行数:60,


示例25: GetDistance

double ribi::pvdb::GetDistance(const double x1, const double y1, const double x2, const double y2){  #ifndef NDEBUG  pvdb::TestHelperFunctions();  #endif  return GetDistance(x1-x2,y1-y2);}
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:7,


示例26: UVToLongitudeLatitude

/** * @brief CoordinateTransform::UVToLatitudeLongitude    将图像坐标转换成经纬度坐标* @param u_v* 图像坐标 * @param latitude_longitude * 经纬度坐标 */void CoordinateTransform::UVToLongitudeLatitude(cv::Point2d u_v,cv::Point2d &local_longitude_latitude,                                                cv::Point2d &dst_longitude_latitude,double heading_angle){    cv::Point2d uv_dis;    uv_dis.y=GetDistance(u_v).y; //标定法求纵向距离    uv_dis.x=getPerspectiveDistance(u_v).x; //透视变换法求横向距离    std::cout << "v_dis = "<< uv_dis.y << std::endl;    std::cout << "u_dis = "<< uv_dis.x << std::endl;    straight_dis_ = sqrt(uv_dis.x*uv_dis.x + uv_dis.y*uv_dis.y);    std::cout<<" straight_dis_ = "<< straight_dis_<< std::endl;    //计算目标的经纬度    uv_dis_mat_.at<double>(0,0) = uv_dis.x;    uv_dis_mat_.at<double>(1,0) = uv_dis.y;    if(heading_angle > 0)    {        clkwise_mat_ = init_clkwise_mat(heading_angle);        lng_lat_dis_mat_ = clkwise_mat_*uv_dis_mat_;    }else{        counter_clkwise_mat_ = init_counter_clkwise_mat(heading_angle);         //std::cout<<" counter_clkwise_mat_ = "<< counter_clkwise_mat_<< std::endl;       //  std::cout<<" uv_dis_mat_ = "<< uv_dis_mat_<< std::endl;        lng_lat_dis_mat_ = counter_clkwise_mat_*uv_dis_mat_;    }  // std::cout<<"lng_lat_dis_mat_.at<double>(0,0) = "<<lng_lat_dis_mat_.at<double>(0,0)<<std::endl;  // std::cout<<"lng_lat_dis_mat_.at<double>(1,0) = "<<lng_lat_dis_mat_.at<double>(1,0)<<std::endl;    dst_longitude_latitude.x = local_longitude_latitude.x+lng_lat_dis_mat_.at<double>(0,0)/1000.0/per_longitute_dis_;    dst_longitude_latitude.y = local_longitude_latitude.y+lng_lat_dis_mat_.at<double>(1,0)/1000.0/per_latitude_dis_;}
开发者ID:zipeilu,项目名称:computer-vision,代码行数:42,


示例27: GetOwner

bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const{    // Not in world    if(!IsInWorld() || !u->IsInWorld())        return false;    // Transport always visible at this step implementation    if(IsTransport() && IsInMap(u))        return true;    // quick check visibility false cases for non-GM-mode    if(!u->isGameMaster())    {        // despawned and then not visible for non-GM in GM-mode        if(!isSpawned())            return false;        // special invisibility cases        if(GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && GetGOInfo()->trap.stealthed)        {            Unit *owner = GetOwner();            if(owner && u->IsHostileTo(owner) && !canDetectTrap(u, GetDistance(u)))                return false;        }        // Smuggled Mana Cell required 10 invisibility type detection/state        if(GetEntry()==187039 && ((u->m_detectInvisibilityMask | u->m_invisibilityMask) & (1<<10))==0)            return false;    }    // check distance    return IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject() +        (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);}
开发者ID:de-dima,项目名称:243,代码行数:34,


示例28: GetRate

void Encoder::UpdateTable() {  if (m_table != nullptr) {    m_table->PutNumber("Speed", GetRate());    m_table->PutNumber("Distance", GetDistance());    m_table->PutNumber("Distance per Tick", m_distancePerPulse);  }}
开发者ID:frc1678,项目名称:third-party,代码行数:7,


示例29: FindSpeed

void MQ2NavigationPlugin::StuckCheck(){	if (m_isPaused)		return;	if (!mq2nav::GetSettings().attempt_unstuck)		return;	clock::time_point now = clock::now();	// check every 100 ms	if (now > m_stuckTimer + std::chrono::milliseconds(100))	{		m_stuckTimer = now;		if (GetCharInfo())		{			if (GetCharInfo()->pSpawn->SpeedMultiplier != -10000				&& FindSpeed(GetCharInfo()->pSpawn)				&& (GetDistance(m_stuckX, m_stuckY) < FindSpeed(GetCharInfo()->pSpawn) / 600)				&& !ClickNearestClosedDoor(25)				&& !GetCharInfo()->pSpawn->Levitate				&& !GetCharInfo()->pSpawn->UnderWater				&& !GetCharInfo()->Stunned				&& m_isActive)			{				int jumpCmd = FindMappableCommand("JUMP");				MQ2Globals::ExecuteCmd(jumpCmd, 1, 0);				MQ2Globals::ExecuteCmd(jumpCmd, 0, 0);			}			m_stuckX = GetCharInfo()->pSpawn->X;			m_stuckY = GetCharInfo()->pSpawn->Y;		}	}}
开发者ID:dannuic,项目名称:MQ2Nav,代码行数:35,



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


C++ GetDlgCtrlID函数代码示例
C++ GetDisplayName函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。