⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interception.cpp

📁 robocup3d源化码 Nexus3D.tar.gz
💻 CPP
字号:
/*Copyright (C) 2005 Ferdowsi University*/#include "interception.h"#include "global.h"Intercept::Intercept(){ }bool Intercept::TryIntercept(){	Vector3f target;	target[2] = self.pos[2];	if(ball.vel.Length() > 0.5 && ball.distance > 0.5){		for(int i = 1; i<12; i++)		{			if(i != MyNumber && (MyPlayer[i].pos-predicted_ball_pos[stop_index]).Length() < (self.pos-predicted_ball_pos[stop_index]).Length() - 0.01)				return false;		}		DoLog(LOG_INTERCEPT,"using prediction,interception done");		target[0] = predicted_ball_pos[stop_index][0];		target[1] = predicted_ball_pos[stop_index][1];	}	else{		for(int i = 1; i<12; i++)		{			if(i != MyNumber && MyPlayer[i].dist2ball < ball.distance - 0.01)				return false;		}		DoLog(LOG_INTERCEPT,"interception done");		target[0] = ball.pos[0];		target[1] = ball.pos[1];	}	if((self.pos - target).Length() > 1 && ball.vel.Length() < 2)	{		float angle = NormalizeAngle(Rad2Deg(atan2((0 - target[1]),(FieldLength/2 - target[0]))),-180.0);		Vector3f pos = AdjustKickPos.MoveAroundBall(angle);		//target[0] -= 0.3 * cos(Deg2Rad(angle));		//target[1] -= 0.3 * sin(Deg2Rad(angle));		target[0] = pos[0];		target[1] = pos[1];		DoLog(LOG_INTERCEPT,"interception Adjusted. target = (%.2f,%.2f)",target[0],target[1]);	}	action_info.x = target[0];	action_info.y = target[1];	action_info.do_drive = true;	return true;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -