Don't return first_point() and last_point() by reference
This commit is contained in:
parent
0ffb0f6a58
commit
275422fac7
@ -356,7 +356,7 @@ sub extrude_path {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$gcode .= ";_BRIDGE_FAN_END\n" if $path->is_bridge;
|
$gcode .= ";_BRIDGE_FAN_END\n" if $path->is_bridge;
|
||||||
$self->last_pos($path->last_point->clone);
|
$self->last_pos($path->last_point);
|
||||||
|
|
||||||
if ($self->config->cooling) {
|
if ($self->config->cooling) {
|
||||||
my $path_time = $path_length / $F * 60;
|
my $path_time = $path_length / $F * 60;
|
||||||
|
@ -252,7 +252,7 @@ sub make_perimeters {
|
|||||||
# use a nearest neighbor search to order these children
|
# use a nearest neighbor search to order these children
|
||||||
# TODO: supply second argument to chained_path_items() too?
|
# TODO: supply second argument to chained_path_items() too?
|
||||||
my @nodes = @{Slic3r::Geometry::chained_path_items(
|
my @nodes = @{Slic3r::Geometry::chained_path_items(
|
||||||
[ map [ ($_->{outer} // $_->{hole})->first_point->clone, $_ ], @$polynodes ],
|
[ map [ ($_->{outer} // $_->{hole})->first_point, $_ ], @$polynodes ],
|
||||||
)};
|
)};
|
||||||
|
|
||||||
my @loops = ();
|
my @loops = ();
|
||||||
|
@ -15,15 +15,15 @@ ExtrusionPath::reverse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
ExtrusionPath::first_point()
|
ExtrusionPath::first_point() const
|
||||||
{
|
{
|
||||||
return &(this->polyline.points.front());
|
return new Point(this->polyline.points.front());
|
||||||
}
|
}
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
ExtrusionPath::last_point()
|
ExtrusionPath::last_point() const
|
||||||
{
|
{
|
||||||
return &(this->polyline.points.back());
|
return new Point(this->polyline.points.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtrusionLoop*
|
ExtrusionLoop*
|
||||||
@ -66,15 +66,15 @@ ExtrusionLoop::reverse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
ExtrusionLoop::first_point()
|
ExtrusionLoop::first_point() const
|
||||||
{
|
{
|
||||||
return &(this->polygon.points.front());
|
return new Point(this->polygon.points.front());
|
||||||
}
|
}
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
ExtrusionLoop::last_point()
|
ExtrusionLoop::last_point() const
|
||||||
{
|
{
|
||||||
return &(this->polygon.points.front()); // in polygons, first == last
|
return new Point(this->polygon.points.front()); // in polygons, first == last
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ class ExtrusionEntity
|
|||||||
double height; // vertical thickness of the extrusion expressed in mm
|
double height; // vertical thickness of the extrusion expressed in mm
|
||||||
double flow_spacing;
|
double flow_spacing;
|
||||||
virtual void reverse() = 0;
|
virtual void reverse() = 0;
|
||||||
virtual Point* first_point() = 0;
|
virtual Point* first_point() const = 0;
|
||||||
virtual Point* last_point() = 0;
|
virtual Point* last_point() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<ExtrusionEntity*> ExtrusionEntitiesPtr;
|
typedef std::vector<ExtrusionEntity*> ExtrusionEntitiesPtr;
|
||||||
@ -43,8 +43,8 @@ class ExtrusionPath : public ExtrusionEntity
|
|||||||
ExtrusionPath* clone() const;
|
ExtrusionPath* clone() const;
|
||||||
Polyline polyline;
|
Polyline polyline;
|
||||||
void reverse();
|
void reverse();
|
||||||
Point* first_point();
|
Point* first_point() const;
|
||||||
Point* last_point();
|
Point* last_point() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExtrusionLoop : public ExtrusionEntity
|
class ExtrusionLoop : public ExtrusionEntity
|
||||||
@ -56,8 +56,8 @@ class ExtrusionLoop : public ExtrusionEntity
|
|||||||
ExtrusionPath* split_at_first_point();
|
ExtrusionPath* split_at_first_point();
|
||||||
bool make_counter_clockwise();
|
bool make_counter_clockwise();
|
||||||
void reverse();
|
void reverse();
|
||||||
Point* first_point();
|
Point* first_point() const;
|
||||||
Point* last_point();
|
Point* last_point() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,13 @@ ExtrusionEntityCollection::reverse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
ExtrusionEntityCollection::first_point()
|
ExtrusionEntityCollection::first_point() const
|
||||||
{
|
{
|
||||||
return this->entities.front()->first_point();
|
return this->entities.front()->first_point();
|
||||||
}
|
}
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
ExtrusionEntityCollection::last_point()
|
ExtrusionEntityCollection::last_point() const
|
||||||
{
|
{
|
||||||
return this->entities.back()->last_point();
|
return this->entities.back()->last_point();
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ class ExtrusionEntityCollection : public ExtrusionEntity
|
|||||||
ExtrusionEntityCollection* chained_path(bool no_reverse) const;
|
ExtrusionEntityCollection* chained_path(bool no_reverse) const;
|
||||||
ExtrusionEntityCollection* chained_path_from(Point* start_near, bool no_reverse) const;
|
ExtrusionEntityCollection* chained_path_from(Point* start_near, bool no_reverse) const;
|
||||||
void reverse();
|
void reverse();
|
||||||
Point* first_point();
|
Point* first_point() const;
|
||||||
Point* last_point();
|
Point* last_point() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,15 +33,9 @@ MultiPoint::reverse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
MultiPoint::first_point()
|
|
||||||
{
|
|
||||||
return &(this->points.front());
|
|
||||||
}
|
|
||||||
|
|
||||||
const Point*
|
|
||||||
MultiPoint::first_point() const
|
MultiPoint::first_point() const
|
||||||
{
|
{
|
||||||
return &(this->points.front());
|
return new Point(this->points.front());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -19,9 +19,8 @@ class MultiPoint
|
|||||||
void translate(double x, double y);
|
void translate(double x, double y);
|
||||||
void rotate(double angle, Point* center);
|
void rotate(double angle, Point* center);
|
||||||
void reverse();
|
void reverse();
|
||||||
Point* first_point();
|
Point* first_point() const;
|
||||||
const Point* first_point() const;
|
virtual Point* last_point() const = 0;
|
||||||
virtual Point* last_point() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
Polygon::last_point()
|
Polygon::last_point() const
|
||||||
{
|
{
|
||||||
return &(this->points.front()); // last point == first point for polygons
|
return new Point(this->points.front()); // last point == first point for polygons
|
||||||
}
|
}
|
||||||
|
|
||||||
SV*
|
SV*
|
||||||
|
@ -11,7 +11,7 @@ namespace Slic3r {
|
|||||||
|
|
||||||
class Polygon : public MultiPoint {
|
class Polygon : public MultiPoint {
|
||||||
public:
|
public:
|
||||||
Point* last_point();
|
Point* last_point() const;
|
||||||
SV* to_SV_ref() const;
|
SV* to_SV_ref() const;
|
||||||
SV* to_SV_clone_ref() const;
|
SV* to_SV_clone_ref() const;
|
||||||
Lines lines();
|
Lines lines();
|
||||||
|
@ -3,15 +3,9 @@
|
|||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
Point*
|
Point*
|
||||||
Polyline::last_point()
|
|
||||||
{
|
|
||||||
return &(this->points.back());
|
|
||||||
}
|
|
||||||
|
|
||||||
const Point*
|
|
||||||
Polyline::last_point() const
|
Polyline::last_point() const
|
||||||
{
|
{
|
||||||
return &(this->points.back());
|
return new Point(this->points.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
Lines
|
Lines
|
||||||
|
@ -8,8 +8,7 @@ namespace Slic3r {
|
|||||||
|
|
||||||
class Polyline : public MultiPoint {
|
class Polyline : public MultiPoint {
|
||||||
public:
|
public:
|
||||||
Point* last_point();
|
Point* last_point() const;
|
||||||
const Point* last_point() const;
|
|
||||||
Lines lines();
|
Lines lines();
|
||||||
SV* to_SV_ref() const;
|
SV* to_SV_ref() const;
|
||||||
SV* to_SV_clone_ref() const;
|
SV* to_SV_clone_ref() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user