diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 2e06c4b1dc..921530a522 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -129,7 +129,6 @@ sub thread_cleanup { *Slic3r::ExtrusionPath::DESTROY = sub {}; *Slic3r::ExtrusionPath::Collection::DESTROY = sub {}; *Slic3r::Line::DESTROY = sub {}; - *Slic3r::Object::XS::ZTable::DESTROY = sub {}; *Slic3r::Point::DESTROY = sub {}; *Slic3r::Polygon::DESTROY = sub {}; *Slic3r::Polyline::DESTROY = sub {}; diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 9aab3850c1..77838ab8ff 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -18,7 +18,6 @@ has 'config_overrides' => (is => 'rw', default => sub { Slic3r::Config->new }); has 'config' => (is => 'rw'); has 'layer_height_ranges' => (is => 'rw', default => sub { [] }); # [ z_min, z_max, layer_height ] has 'fill_maker' => (is => 'lazy'); -has '_slice_z_table' => (is => 'lazy'); sub BUILD { my $self = shift; @@ -88,11 +87,6 @@ sub _build_fill_maker { return Slic3r::Fill->new(object => $self); } -sub _build__slice_z_table { - my $self = shift; - return Slic3r::Object::XS::ZTable->new([ map $_->slice_z, @{$self->layers} ]); -} - # This should be probably moved in Print.pm at the point where we sort Layer objects sub _trigger_copies { my $self = shift; @@ -112,17 +106,6 @@ sub layer_count { return scalar @{ $self->layers }; } -sub get_layer_range { - my $self = shift; - my ($min_z, $max_z) = @_; - - my $min_layer = $self->_slice_z_table->lower_bound($min_z); # first layer whose slice_z is >= $min_z - return ( - $min_layer, - $self->_slice_z_table->upper_bound($max_z, $min_layer)-1, # last layer whose slice_z is <= $max_z - ); -} - sub bounding_box { my $self = shift; diff --git a/xs/src/ZTable.hpp b/xs/src/ZTable.hpp deleted file mode 100644 index 4faa559410..0000000000 --- a/xs/src/ZTable.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef slic3r_ZTable_hpp_ -#define slic3r_ZTable_hpp_ - -#include - -namespace Slic3r { - -class ZTable -{ - public: - ZTable(std::vector* z_array); - std::vector get_range(unsigned int min_z, unsigned int max_z); - std::vector z; -}; - -ZTable::ZTable(std::vector* ztable) : - z(*ztable) -{ -} - -} - -#endif diff --git a/xs/t/02_object.t b/xs/t/02_object.t deleted file mode 100644 index 53a6f869b9..0000000000 --- a/xs/t/02_object.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Slic3r::XS; -use Test::More tests => 10; - -my $table = Slic3r::Object::XS::ZTable->new([ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ]); -is_deeply $table->get_range(31, 61), [2, 6], 'get_layer_range'; -is_deeply $table->get_range(39, 69), [2, 6], 'get_layer_range'; -is_deeply $table->get_range(30, 60), [2, 5], 'get_layer_range'; - -# upper_bound points to the first element that is greater than argument -is $table->upper_bound(30), 3, 'upper_bound'; -is $table->upper_bound(31), 3, 'upper_bound'; -is $table->upper_bound(39), 3, 'upper_bound'; -is $table->upper_bound(39, 4), 4, 'upper_bound with offset'; - -# lower_bound points to the first element that is not less than argument -is $table->lower_bound(31), 3, 'lower_bound'; -is $table->lower_bound(39), 3, 'lower_bound'; -is $table->lower_bound(40), 3, 'lower_bound'; - -__END__ diff --git a/xs/xsp/Object.xsp b/xs/xsp/Object.xsp deleted file mode 100644 index bdfef05390..0000000000 --- a/xs/xsp/Object.xsp +++ /dev/null @@ -1,80 +0,0 @@ -%module{Slic3r::XS}; - -%{ -#include -#include "ZTable.hpp" -#include -#include -%} - -%name{Slic3r::Object::XS::ZTable} class ZTable { - ZTable(std::vector* z_array); - ~ZTable(); - -%{ -std::vector -get_range(THIS, min_z, max_z) - ZTable* THIS; - unsigned int min_z; - unsigned int max_z; - CODE: - RETVAL.resize(2); - - unsigned int bottom = 0; - unsigned int top = THIS->z.size()-1; - while (1) { - unsigned int mid = bottom + floor((top - bottom)/2.0); - if (mid == top || mid == bottom) { - RETVAL[0] = mid; - break; - } - if (THIS->z[mid] > min_z) { - top = mid; - } else { - bottom = mid; - } - } - top = THIS->z.size()-1; - while (1) { - unsigned int mid = bottom + ceil((top - bottom)/2.0); - if (mid == top || mid == bottom) { - RETVAL[1] = mid; - break; - } - if (THIS->z[mid] < max_z) { - bottom = mid; - } else { - top = mid; - } - } - OUTPUT: - RETVAL - -unsigned int -ZTable::lower_bound(z, offset = 0) - unsigned int z - unsigned int offset - CODE: - RETVAL = std::lower_bound(THIS->z.begin() + offset, THIS->z.end(), z) - THIS->z.begin(); - OUTPUT: - RETVAL - -unsigned int -ZTable::upper_bound(z, offset = 0) - unsigned int z - unsigned int offset - CODE: - RETVAL = std::upper_bound(THIS->z.begin() + offset, THIS->z.end(), z) - THIS->z.begin(); - OUTPUT: - RETVAL - -%} - -}; - -%package{Slic3r::Object::XS}; - -%{ -#include -#include -%}