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;
|
||||
$self->last_pos($path->last_point->clone);
|
||||
$self->last_pos($path->last_point);
|
||||
|
||||
if ($self->config->cooling) {
|
||||
my $path_time = $path_length / $F * 60;
|
||||
|
@ -252,7 +252,7 @@ sub make_perimeters {
|
||||
# use a nearest neighbor search to order these children
|
||||
# TODO: supply second argument to chained_path_items() too?
|
||||
my @nodes = @{Slic3r::Geometry::chained_path_items(
|
||||
[ map [ ($_->{outer} // $_->{hole})->first_point->clone, $_ ], @$polynodes ],
|
||||
[ map [ ($_->{outer} // $_->{hole})->first_point, $_ ], @$polynodes ],
|
||||
)};
|
||||
|
||||
my @loops = ();
|
||||
|
@ -15,15 +15,15 @@ ExtrusionPath::reverse()
|
||||
}
|
||||
|
||||
Point*
|
||||
ExtrusionPath::first_point()
|
||||
ExtrusionPath::first_point() const
|
||||
{
|
||||
return &(this->polyline.points.front());
|
||||
return new Point(this->polyline.points.front());
|
||||
}
|
||||
|
||||
Point*
|
||||
ExtrusionPath::last_point()
|
||||
ExtrusionPath::last_point() const
|
||||
{
|
||||
return &(this->polyline.points.back());
|
||||
return new Point(this->polyline.points.back());
|
||||
}
|
||||
|
||||
ExtrusionLoop*
|
||||
@ -66,15 +66,15 @@ ExtrusionLoop::reverse()
|
||||
}
|
||||
|
||||
Point*
|
||||
ExtrusionLoop::first_point()
|
||||
ExtrusionLoop::first_point() const
|
||||
{
|
||||
return &(this->polygon.points.front());
|
||||
return new Point(this->polygon.points.front());
|
||||
}
|
||||
|
||||
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 flow_spacing;
|
||||
virtual void reverse() = 0;
|
||||
virtual Point* first_point() = 0;
|
||||
virtual Point* last_point() = 0;
|
||||
virtual Point* first_point() const = 0;
|
||||
virtual Point* last_point() const = 0;
|
||||
};
|
||||
|
||||
typedef std::vector<ExtrusionEntity*> ExtrusionEntitiesPtr;
|
||||
@ -43,8 +43,8 @@ class ExtrusionPath : public ExtrusionEntity
|
||||
ExtrusionPath* clone() const;
|
||||
Polyline polyline;
|
||||
void reverse();
|
||||
Point* first_point();
|
||||
Point* last_point();
|
||||
Point* first_point() const;
|
||||
Point* last_point() const;
|
||||
};
|
||||
|
||||
class ExtrusionLoop : public ExtrusionEntity
|
||||
@ -56,8 +56,8 @@ class ExtrusionLoop : public ExtrusionEntity
|
||||
ExtrusionPath* split_at_first_point();
|
||||
bool make_counter_clockwise();
|
||||
void reverse();
|
||||
Point* first_point();
|
||||
Point* last_point();
|
||||
Point* first_point() const;
|
||||
Point* last_point() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -22,13 +22,13 @@ ExtrusionEntityCollection::reverse()
|
||||
}
|
||||
|
||||
Point*
|
||||
ExtrusionEntityCollection::first_point()
|
||||
ExtrusionEntityCollection::first_point() const
|
||||
{
|
||||
return this->entities.front()->first_point();
|
||||
}
|
||||
|
||||
Point*
|
||||
ExtrusionEntityCollection::last_point()
|
||||
ExtrusionEntityCollection::last_point() const
|
||||
{
|
||||
return this->entities.back()->last_point();
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ class ExtrusionEntityCollection : public ExtrusionEntity
|
||||
ExtrusionEntityCollection* chained_path(bool no_reverse) const;
|
||||
ExtrusionEntityCollection* chained_path_from(Point* start_near, bool no_reverse) const;
|
||||
void reverse();
|
||||
Point* first_point();
|
||||
Point* last_point();
|
||||
Point* first_point() const;
|
||||
Point* last_point() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -33,15 +33,9 @@ MultiPoint::reverse()
|
||||
}
|
||||
|
||||
Point*
|
||||
MultiPoint::first_point()
|
||||
{
|
||||
return &(this->points.front());
|
||||
}
|
||||
|
||||
const Point*
|
||||
MultiPoint::first_point() const
|
||||
{
|
||||
return &(this->points.front());
|
||||
return new Point(this->points.front());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -19,9 +19,8 @@ class MultiPoint
|
||||
void translate(double x, double y);
|
||||
void rotate(double angle, Point* center);
|
||||
void reverse();
|
||||
Point* first_point();
|
||||
const Point* first_point() const;
|
||||
virtual Point* last_point() = 0;
|
||||
Point* first_point() const;
|
||||
virtual Point* last_point() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
namespace Slic3r {
|
||||
|
||||
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*
|
||||
|
@ -11,7 +11,7 @@ namespace Slic3r {
|
||||
|
||||
class Polygon : public MultiPoint {
|
||||
public:
|
||||
Point* last_point();
|
||||
Point* last_point() const;
|
||||
SV* to_SV_ref() const;
|
||||
SV* to_SV_clone_ref() const;
|
||||
Lines lines();
|
||||
|
@ -3,15 +3,9 @@
|
||||
namespace Slic3r {
|
||||
|
||||
Point*
|
||||
Polyline::last_point()
|
||||
{
|
||||
return &(this->points.back());
|
||||
}
|
||||
|
||||
const Point*
|
||||
Polyline::last_point() const
|
||||
{
|
||||
return &(this->points.back());
|
||||
return new Point(this->points.back());
|
||||
}
|
||||
|
||||
Lines
|
||||
|
@ -8,8 +8,7 @@ namespace Slic3r {
|
||||
|
||||
class Polyline : public MultiPoint {
|
||||
public:
|
||||
Point* last_point();
|
||||
const Point* last_point() const;
|
||||
Point* last_point() const;
|
||||
Lines lines();
|
||||
SV* to_SV_ref() const;
|
||||
SV* to_SV_clone_ref() const;
|
||||
|
Loading…
Reference in New Issue
Block a user