1 Star 0 Fork 4

sjhscysk/LYGSim

forked from OSGLYG/LYGSim 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LYGPoint.cpp 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
#include "LYGPoint.h"
LYGPoint::LYGPoint()
:m_X(0.0),m_Y(0.0)
{
}
LYGPoint::LYGPoint(const double x, const double y)
{
m_X = x;
m_Y = y;
}
LYGPoint::LYGPoint(const LYGPoint & other)
{
m_X = other.m_X;
m_Y = other.m_Y;
}
bool LYGPoint::operator == (const LYGPoint & other)
{
if ((abs(m_X - other.m_X)< MINNUMBER) && (abs(m_Y - other.m_Y) < MINNUMBER))
{
return true;
}
return false;
}
LYGPoint LYGPoint::operator+(const LYGPoint & other)
{
this->m_X += other.GetX();
this->m_Y += other.GetY();
return *this;
}
LYGPoint LYGPoint::operator-(const LYGPoint & other)
{
this->m_X -= other.GetX();
this->m_Y -= other.GetY();
return *this;
}
LYGPoint::~LYGPoint()
{
}
double LYGPoint::getDistance(const LYGPoint & other)
{
double dis = 0;
dis = sqrt((m_X - other.m_X) * (m_X - other.m_X)
+ (m_Y - other.m_Y) * (m_Y - other.m_Y));
return dis;
}
void LYGPoint::SetX(const double x)
{
m_X = x;
}
double LYGPoint::GetX() const
{
return m_X;
}
void LYGPoint::SetY(const double y)
{
m_Y = y;
}
double LYGPoint::GetY() const
{
return m_Y;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/sjhscysk/lygsim.git
git@gitee.com:sjhscysk/lygsim.git
sjhscysk
lygsim
LYGSim
master

搜索帮助