Fixed regression which prevented horizontal shells to be processed for external top surfaces

degen-loop-screen
Alessandro Ranellucci 2011-09-26 16:19:32 +02:00
parent 404c76adc8
commit c16ecb4316
1 changed files with 4 additions and 4 deletions

View File

@ -121,16 +121,16 @@ sub _facet {
my $clockwise = !is_counter_clockwise([@vertices]);
# defensive programming and/or input check
if (($normal->[Z] > 0 && $clockwise > 0) || ($normal->[Z] < 0 && $clockwise < 0)) {
if (($normal->[Z] > 0 && $clockwise) || ($normal->[Z] < 0 && !$clockwise)) {
YYY $normal;
die sprintf "STL normal (%.0f) and right-hand rule computation (%s) differ!\n",
$normal->[Z], $clockwise > 0 ? 'clockwise' : 'counter-clockwise';
$normal->[Z], $clockwise ? 'clockwise' : 'counter-clockwise';
}
if ($layer->id == 0 && $clockwise < 0) {
if ($layer->id == 0 && !$clockwise) {
die "Right-hand rule gives bad result for facets on base layer!\n";
}
$surface->surface_type($clockwise < 0 ? 'top' : 'bottom');
$surface->surface_type($clockwise ? 'bottom' : 'top');
return;
}