2016-09-13 11:30:00 +00:00
|
|
|
#include "BoundingBox.hpp"
|
2013-09-06 16:36:38 +00:00
|
|
|
#include "Surface.hpp"
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
2015-10-26 22:23:03 +00:00
|
|
|
Surface::operator Polygons() const
|
|
|
|
{
|
|
|
|
return this->expolygon;
|
|
|
|
}
|
|
|
|
|
2013-09-13 12:48:40 +00:00
|
|
|
double
|
|
|
|
Surface::area() const
|
|
|
|
{
|
|
|
|
return this->expolygon.area();
|
|
|
|
}
|
|
|
|
|
2013-11-22 23:07:04 +00:00
|
|
|
bool
|
|
|
|
Surface::is_solid() const
|
|
|
|
{
|
|
|
|
return this->surface_type == stTop
|
|
|
|
|| this->surface_type == stBottom
|
2014-03-25 00:11:28 +00:00
|
|
|
|| this->surface_type == stBottomBridge
|
2014-11-26 23:38:05 +00:00
|
|
|
|| this->surface_type == stInternalSolid
|
|
|
|
|| this->surface_type == stInternalBridge;
|
2013-11-22 23:07:04 +00:00
|
|
|
}
|
|
|
|
|
2014-02-10 12:19:44 +00:00
|
|
|
bool
|
|
|
|
Surface::is_external() const
|
|
|
|
{
|
|
|
|
return this->surface_type == stTop
|
2014-03-25 00:11:28 +00:00
|
|
|
|| this->surface_type == stBottom
|
|
|
|
|| this->surface_type == stBottomBridge;
|
2014-02-10 12:19:44 +00:00
|
|
|
}
|
|
|
|
|
2014-12-09 00:08:58 +00:00
|
|
|
bool
|
|
|
|
Surface::is_internal() const
|
|
|
|
{
|
|
|
|
return this->surface_type == stInternal
|
|
|
|
|| this->surface_type == stInternalBridge
|
|
|
|
|| this->surface_type == stInternalSolid
|
|
|
|
|| this->surface_type == stInternalVoid;
|
|
|
|
}
|
|
|
|
|
2013-11-22 23:07:04 +00:00
|
|
|
bool
|
2014-03-25 00:11:28 +00:00
|
|
|
Surface::is_bottom() const
|
2013-11-22 23:07:04 +00:00
|
|
|
{
|
|
|
|
return this->surface_type == stBottom
|
2014-03-25 00:11:28 +00:00
|
|
|
|| this->surface_type == stBottomBridge;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Surface::is_bridge() const
|
|
|
|
{
|
|
|
|
return this->surface_type == stBottomBridge
|
2013-11-22 23:07:04 +00:00
|
|
|
|| this->surface_type == stInternalBridge;
|
|
|
|
}
|
|
|
|
|
2016-09-13 11:30:00 +00:00
|
|
|
BoundingBox get_extents(const Surface &surface)
|
|
|
|
{
|
|
|
|
return get_extents(surface.expolygon.contour);
|
|
|
|
}
|
|
|
|
|
|
|
|
BoundingBox get_extents(const Surfaces &surfaces)
|
|
|
|
{
|
|
|
|
BoundingBox bbox;
|
|
|
|
if (! surfaces.empty()) {
|
|
|
|
bbox = get_extents(surfaces.front());
|
|
|
|
for (size_t i = 1; i < surfaces.size(); ++ i)
|
|
|
|
bbox.merge(get_extents(surfaces[i]));
|
|
|
|
}
|
|
|
|
return bbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
BoundingBox get_extents(const SurfacesPtr &surfaces)
|
|
|
|
{
|
|
|
|
BoundingBox bbox;
|
|
|
|
if (! surfaces.empty()) {
|
|
|
|
bbox = get_extents(*surfaces.front());
|
|
|
|
for (size_t i = 1; i < surfaces.size(); ++ i)
|
|
|
|
bbox.merge(get_extents(*surfaces[i]));
|
|
|
|
}
|
|
|
|
return bbox;
|
|
|
|
}
|
|
|
|
|
2013-09-06 16:36:38 +00:00
|
|
|
}
|