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

📄 line.cpp

📁 本程序是2005年参加中国机器人大赛的比赛程序
💻 CPP
字号:
// Line.cpp: implementation of the Line class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Robocup.h"
#include "Line.h"



#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Line::Line()
{
	k = 0;
	b = 0;
}

Line::~Line()
{

}

void Line::makeLine( const Vector &v, const double ang, BOOL rad )
{
	if( !rad )
		k = tan(ang*3.14159265/180.0);//角度
	else
		k = ang;//斜率
	b = v.y - k * v.x;
}

void Line::makeLine( const Vector& v1, const Vector& v2 )
{
	k = (v2.y-v1.y)/(v2.x-v1.x);
	b = v1.y - k * v1.x;
}

⌨️ 快捷键说明

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