mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Optimization in Polyline instantiation
This commit is contained in:
		
							parent
							
								
									27c421c27f
								
							
						
					
					
						commit
						8061cc6e30
					
				
					 14 changed files with 40 additions and 45 deletions
				
			
		| 
						 | 
				
			
			@ -10,13 +10,8 @@ use Slic3r::Geometry::Clipper qw(JT_SQUARE);
 | 
			
		|||
# the constructor accepts an array(ref) of points
 | 
			
		||||
sub new {
 | 
			
		||||
    my $class = shift;
 | 
			
		||||
    my $self;
 | 
			
		||||
    if (@_ == 1) {
 | 
			
		||||
        $self = [ @{$_[0]} ];
 | 
			
		||||
    } else {
 | 
			
		||||
        $self = [ @_ ];
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    my $self = [ @_ ];
 | 
			
		||||
    bless $self, $class;
 | 
			
		||||
    bless $_, 'Slic3r::Point' for @$self;
 | 
			
		||||
    $self;
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +60,7 @@ sub simplify {
 | 
			
		|||
    my $tolerance = shift || 10;
 | 
			
		||||
    
 | 
			
		||||
    my $simplified = Boost::Geometry::Utils::linestring_simplify($self, $tolerance);
 | 
			
		||||
    return (ref $self)->new($simplified);
 | 
			
		||||
    return (ref $self)->new(@$simplified);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub reverse {
 | 
			
		||||
| 
						 | 
				
			
			@ -83,9 +78,9 @@ sub grow {
 | 
			
		|||
    my ($distance, $scale, $joinType, $miterLimit) = @_;
 | 
			
		||||
    $joinType //= JT_SQUARE;
 | 
			
		||||
    
 | 
			
		||||
    return map Slic3r::Polygon->new($_),
 | 
			
		||||
    return map Slic3r::Polygon->new(@$_),
 | 
			
		||||
        Slic3r::Geometry::Clipper::offset(
 | 
			
		||||
            [ Slic3r::Polygon->new(@$self, CORE::reverse @$self[1..($#$self-1)]) ],
 | 
			
		||||
            [ [ @$self, CORE::reverse @$self[1..($#$self-1)] ] ],
 | 
			
		||||
            $distance, $scale, $joinType, $miterLimit,
 | 
			
		||||
        );
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue