mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-07 03:39:13 +08:00
Move struct format to constant
This commit is contained in:
parent
34e3dfdb08
commit
e383d5e02d
@ -15,6 +15,7 @@ has 'edges_facets' => (is => 'ro', default => sub { [] }); # id => [ $f1_id, $f
|
|||||||
use constant MIN => 0;
|
use constant MIN => 0;
|
||||||
use constant MAX => 1;
|
use constant MAX => 1;
|
||||||
|
|
||||||
|
use constant I_FMT => 'ffLLLLLc';
|
||||||
use constant I_B => 0;
|
use constant I_B => 0;
|
||||||
use constant I_A_ID => 1;
|
use constant I_A_ID => 1;
|
||||||
use constant I_B_ID => 2;
|
use constant I_B_ID => 2;
|
||||||
@ -139,7 +140,7 @@ sub make_loops {
|
|||||||
my ($layer) = @_;
|
my ($layer) = @_;
|
||||||
|
|
||||||
my @lines = map {
|
my @lines = map {
|
||||||
my @data = unpack 'ffLLLLLc', $_;
|
my @data = unpack I_FMT, $_;
|
||||||
splice @data, 0, 2, [ @data[0,1] ];
|
splice @data, 0, 2, [ @data[0,1] ];
|
||||||
$data[$_] ||= undef for I_A_ID, I_B_ID;
|
$data[$_] ||= undef for I_A_ID, I_B_ID;
|
||||||
$data[I_FACET_EDGE] = undef if $data[I_FACET_EDGE] == -1;
|
$data[I_FACET_EDGE] = undef if $data[I_FACET_EDGE] == -1;
|
||||||
@ -422,7 +423,7 @@ sub intersect_facet {
|
|||||||
($a, $b) = ($b, $a);
|
($a, $b) = ($b, $a);
|
||||||
($a_id, $b_id) = ($b_id, $a_id);
|
($a_id, $b_id) = ($b_id, $a_id);
|
||||||
}
|
}
|
||||||
push @lines, pack 'ffLLLLLc', (
|
push @lines, pack I_FMT, (
|
||||||
$b->[X], $b->[Y], # I_B
|
$b->[X], $b->[Y], # I_B
|
||||||
$a_id, # I_A_ID
|
$a_id, # I_A_ID
|
||||||
$b_id, # I_B_ID
|
$b_id, # I_B_ID
|
||||||
@ -482,7 +483,7 @@ sub intersect_facet {
|
|||||||
$next_facet_index = +(grep $_ != $facet_id, @{$self->edges_facets->[$points[A][3]]})[0]
|
$next_facet_index = +(grep $_ != $facet_id, @{$self->edges_facets->[$points[A][3]]})[0]
|
||||||
if defined $points[A][3];
|
if defined $points[A][3];
|
||||||
|
|
||||||
return pack 'ffLLLLLc', (
|
return pack I_FMT, (
|
||||||
$points[A][X], $points[A][Y], # I_B
|
$points[A][X], $points[A][Y], # I_B
|
||||||
$points[B][2] || 0, # I_A_ID
|
$points[B][2] || 0, # I_A_ID
|
||||||
$points[A][2] || 0, # I_B_ID
|
$points[A][2] || 0, # I_B_ID
|
||||||
|
Loading…
x
Reference in New Issue
Block a user