owlps/GuiNuMo-server/area.cc

51 lines
910 B
C++

#include "area.hh"
Area::Area(const string &_name, const float &_x1, const float &_x2, const float &_y1, const float &_y2, const float &_z1, const float &_z2)
{
area_name = _name ;
x_min = _x1 ;
x_max = _x2 ;
y_min = _y1 ;
y_max = _y2 ;
z_min = _z1 ;
z_max = _z2 ;
}
Area::Area(const Area &a)
{
area_name = a.area_name;
x_min = a.x_min;
x_max = a.x_max;
y_min = a.y_min;
y_max = a.y_max;
z_min = a.z_min;
z_max = a.z_max;
}
bool Area::containsPoint(const Point &p)const
{
if((p.getX() >= x_min)
&& (p.getX() <= x_max)
&& (p.getY() >= y_min)
&& (p.getY() <= y_max)
&& (p.getZ() >= z_min)
&& (p.getZ() <= z_max))
return true;
return false;
}
ostream &operator<<(ostream &os, const Area &a)
{
os << a.area_name << ';' << a.x_min << ';' << a.x_max << ';' << a.y_min << ';' << a.y_max << ';' << a.z_min << ';' << a.z_max ;
return os ;
}