sla::Raster interface clarified and covered with tests.

Also renamed sla::SupportTreeAlgorithm to SupportTreeBuildsteps.
This commit is contained in:
tamasmeszaros
2019-10-01 13:27:58 +02:00
parent 705e82ec8e
commit be7428d66e
15 changed files with 484 additions and 361 deletions

View File

@@ -21,37 +21,12 @@ std::string RasterWriter::createIniContent(const std::string& projectname) const
return out;
}
void RasterWriter::flpXY(ClipperLib::Polygon &poly)
{
for(auto& p : poly.Contour) std::swap(p.X, p.Y);
std::reverse(poly.Contour.begin(), poly.Contour.end());
for(auto& h : poly.Holes) {
for(auto& p : h) std::swap(p.X, p.Y);
std::reverse(h.begin(), h.end());
}
}
void RasterWriter::flpXY(ExPolygon &poly)
{
for(auto& p : poly.contour.points) p = Point(p.y(), p.x());
std::reverse(poly.contour.points.begin(), poly.contour.points.end());
for(auto& h : poly.holes) {
for(auto& p : h.points) p = Point(p.y(), p.x());
std::reverse(h.points.begin(), h.points.end());
}
}
RasterWriter::RasterWriter(const Raster::Resolution &res,
const Raster::PixelDim &pixdim,
const std::array<bool, 2> &mirror,
double gamma)
: m_res(res), m_pxdim(pixdim), m_mirror(mirror), m_gamma(gamma)
{
// PNG raster will implicitly do an Y mirror
m_mirror[1] = !m_mirror[1];
}
RasterWriter::RasterWriter(const Raster::Resolution &res,
const Raster::PixelDim & pixdim,
const Raster::Trafo & trafo,
double gamma)
: m_res(res), m_pxdim(pixdim), m_trafo(trafo), m_gamma(gamma)
{}
void RasterWriter::save(const std::string &fpath, const std::string &prjname)
{