82 lines
980 B
C++
82 lines
980 B
C++
//Line Class
|
|
|
|
#include "Line.h"
|
|
#include <limits>
|
|
|
|
|
|
int Line::current_id = 0;
|
|
|
|
Line::Line(double x, double y)
|
|
{
|
|
set_slope(x);
|
|
set_ycept(y);
|
|
id = 0;
|
|
set_vis_start(-std::numeric_limits<double>::max());
|
|
set_vis_end(std::numeric_limits<double>::max());
|
|
}
|
|
|
|
void Line::set_slope(double &x)
|
|
{
|
|
slope = x;
|
|
}
|
|
|
|
void Line::set_ycept(double &y)
|
|
{
|
|
ycept = y;
|
|
}
|
|
|
|
double Line::get_slope() const
|
|
{
|
|
return slope;
|
|
}
|
|
|
|
double Line::get_ycept() const
|
|
{
|
|
return ycept;
|
|
}
|
|
|
|
double Line::get_vis_start() const
|
|
{
|
|
return vis_start;
|
|
}
|
|
|
|
double Line::get_vis_end() const
|
|
{
|
|
return vis_end;
|
|
}
|
|
|
|
bool Line::is_vis()
|
|
{
|
|
return vis;
|
|
}
|
|
|
|
void Line::set_id()
|
|
{
|
|
id = current_id++;
|
|
}
|
|
|
|
int Line::get_id() const
|
|
{
|
|
return id;
|
|
}
|
|
|
|
bool Line::operator==(const Line &l2) const
|
|
{
|
|
return get_slope() == l2.get_slope();
|
|
}
|
|
|
|
bool Line::operator<(const Line &l2) const
|
|
{
|
|
return get_slope() < l2.get_slope();
|
|
}
|
|
|
|
void Line::set_vis_start(double x)
|
|
{
|
|
vis_start = x;
|
|
}
|
|
|
|
void Line::set_vis_end(double x)
|
|
{
|
|
vis_end = x;
|
|
}
|