Fixed error in porting causing wrong moves with avoid_crossing_perimeters

This commit is contained in:
Alessandro Ranellucci 2015-12-19 14:49:29 +01:00
parent 9dc0514844
commit 667a121ddb
6 changed files with 16 additions and 8 deletions

View File

@ -203,8 +203,8 @@ GCode::GCode()
{
}
Point&
GCode::last_pos()
const Point&
GCode::last_pos() const
{
return this->_last_pos;
}
@ -249,13 +249,12 @@ void
GCode::set_origin(const Pointf &pointf)
{
// if origin increases (goes towards right), last_pos decreases because it goes towards left
Point translate(
const Point translate(
scale_(this->origin.x - pointf.x),
scale_(this->origin.y - pointf.y)
);
this->_last_pos.translate(translate);
this->wipe.path.translate(translate);
this->origin = pointf;
}

View File

@ -86,7 +86,7 @@ class GCode {
double volumetric_speed;
GCode();
Point& last_pos();
const Point& last_pos() const;
void set_last_pos(const Point &pos);
bool last_pos_defined() const;
void apply_print_config(const PrintConfig &print_config);

View File

@ -171,7 +171,7 @@ MotionPlanner::shortest_path(const Point &from, const Point &to)
svg.draw(inner_from, "red");
svg.draw(to);
svg.draw(inner_to, "red");
svg.draw(*polyline, "red");
svg.draw(polyline, "red");
svg.Close();
*/

View File

@ -305,6 +305,14 @@ operator<<(std::ostream &stm, const Pointf &pointf)
return stm << pointf.x << "," << pointf.y;
}
std::string
Pointf::wkt() const
{
std::ostringstream ss;
ss << "POINT(" << this->x << " " << this->y << ")";
return ss.str();
}
void
Pointf::scale(double factor)
{

View File

@ -86,6 +86,7 @@ class Pointf
static Pointf new_unscale(const Point &p) {
return Pointf(unscale(p.x), unscale(p.y));
};
std::string wkt() const;
void scale(double factor);
void translate(double x, double y);
void translate(const Vectorf &vector);

View File

@ -17,8 +17,8 @@
#define SMALL_PERIMETER_LENGTH (6.5 / SCALING_FACTOR) * 2 * PI
#define INSET_OVERLAP_TOLERANCE 0.4
#define EXTERNAL_INFILL_MARGIN 3
#define scale_(val) (val / SCALING_FACTOR)
#define unscale(val) (val * SCALING_FACTOR)
#define scale_(val) ((val) / SCALING_FACTOR)
#define unscale(val) ((val) * SCALING_FACTOR)
#define SCALED_EPSILON scale_(EPSILON)
typedef long coord_t;
typedef double coordf_t;