Promising approach to medial axis pruning

This commit is contained in:
Alessandro Ranellucci 2014-03-04 23:33:13 +01:00
parent 8644440070
commit 3c77b301a7
13 changed files with 126 additions and 326 deletions

View file

@ -1,6 +1,7 @@
#include "Line.hpp"
#include "Polyline.hpp"
#include <algorithm>
#include <cmath>
#include <sstream>
namespace Slic3r {
@ -85,6 +86,21 @@ Line::distance_to(const Point* point) const
return point->distance_to(this);
}
double
Line::atan2_() const
{
return atan2(this->b.y - this->a.y, this->b.x - this->a.x);
}
double
Line::direction() const
{
double atan2 = this->atan2_();
return (atan2 == PI) ? 0
: (atan2 < 0) ? (atan2 + PI)
: atan2;
}
#ifdef SLIC3RXS
void
Line::from_SV(SV* line_sv)