|
|
#include "MLPlNode.h"
|
|
|
#include "MLFuncom.h"
|
|
|
|
|
|
|
|
|
MLPlNode::MLPlNode(void)
|
|
|
:MLVector()
|
|
|
{
|
|
|
m_l = 0;
|
|
|
m_a = 0;
|
|
|
}
|
|
|
|
|
|
MLPlNode::MLPlNode( double x, double y )
|
|
|
:MLVector(x, y)
|
|
|
{
|
|
|
m_z = 0;
|
|
|
m_l = 0;
|
|
|
m_a = 0;
|
|
|
}
|
|
|
|
|
|
MLPlNode::MLPlNode( double x, double y, double z )
|
|
|
:MLVector(x, y, z)
|
|
|
{
|
|
|
m_l = 0;
|
|
|
m_a = 0;
|
|
|
}
|
|
|
|
|
|
MLPlNode::MLPlNode(const MLPlNode& point)
|
|
|
{
|
|
|
m_x = point.x;
|
|
|
m_y = point.y;
|
|
|
m_z = point.z;
|
|
|
m_l = point.l;
|
|
|
m_a = point.a;
|
|
|
}
|
|
|
|
|
|
MLPlNode::MLPlNode(const MLPoint& point)
|
|
|
{
|
|
|
m_x = point.x;
|
|
|
m_y = point.y;
|
|
|
m_z = point.z;
|
|
|
m_l = point.l;
|
|
|
m_a = 0;
|
|
|
}
|
|
|
|
|
|
MLPlNode::MLPlNode( const QPointF& point )
|
|
|
{
|
|
|
m_x = point.x();
|
|
|
m_y = point.y();
|
|
|
m_z = 0;
|
|
|
m_l = 0;
|
|
|
m_a = 0;
|
|
|
}
|
|
|
|
|
|
MLPlNode::~MLPlNode(void)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
|
|
|
double MLPlNode::getL() const
|
|
|
{
|
|
|
return m_l;
|
|
|
}
|
|
|
|
|
|
double& MLPlNode::getL()
|
|
|
{
|
|
|
return m_l;
|
|
|
}
|
|
|
|
|
|
void MLPlNode::setL( double l )
|
|
|
{
|
|
|
m_l = l;
|
|
|
}
|
|
|
|
|
|
double MLPlNode::getA() const
|
|
|
{
|
|
|
return m_a;
|
|
|
}
|
|
|
|
|
|
double& MLPlNode::getA()
|
|
|
{
|
|
|
return m_a;
|
|
|
}
|
|
|
|
|
|
void MLPlNode::setA(double a)
|
|
|
{
|
|
|
m_a = a;
|
|
|
}
|
|
|
|
|
|
//判断两点是否相等
|
|
|
bool operator==(const MLPlNode &p1, const MLPlNode &p2)
|
|
|
{
|
|
|
return (Equ(p1.x, p2.x) && Equ(p1.y, p2.y));
|
|
|
}
|
|
|
|
|
|
//比较两点坐标大小,先比较x坐标,若相同则比较y坐标
|
|
|
|
|
|
bool operator>(const MLPlNode &p1, const MLPlNode &p2)
|
|
|
{
|
|
|
return (p1.x > p2.x || (Equ(p1.x, p2.x) && p1.y > p2.y));
|
|
|
}
|
|
|
|
|
|
//计算两向量外积
|
|
|
|
|
|
double operator^(const MLPlNode &p1, const MLPlNode &p2)
|
|
|
{
|
|
|
return (p1.x * p2.y - p1.y * p2.x);
|
|
|
}
|
|
|
|
|
|
// 转点坐标
|
|
|
|
|
|
MLPoint MLPlNode::toPoint()const
|
|
|
{
|
|
|
return MLPoint(m_x, m_y, m_z);
|
|
|
}
|
|
|
|
|
|
QPoint MLPlNode::toQPoint()const
|
|
|
{
|
|
|
return QPoint(m_x, m_y);
|
|
|
}
|
|
|
|
|
|
QPointF MLPlNode::toQPointF()const
|
|
|
{
|
|
|
return QPointF(m_x, m_y);
|
|
|
}
|
|
|
|
|
|
MLPlNode &MLPlNode::operator =(const MLPlNode &other)
|
|
|
{
|
|
|
m_x = other.x;
|
|
|
m_y = other.y;
|
|
|
m_z = other.z;
|
|
|
m_l = other.l;
|
|
|
return *this;
|
|
|
}
|