Minor fixes to time computation and right-hand rule
This commit is contained in:
parent
478047fad3
commit
742f646372
@ -2,6 +2,7 @@ package Slic3r::STL;
|
|||||||
use Moo;
|
use Moo;
|
||||||
|
|
||||||
use CAD::Format::STL;
|
use CAD::Format::STL;
|
||||||
|
use Math::Clipper qw(is_counter_clockwise);
|
||||||
use XXX;
|
use XXX;
|
||||||
|
|
||||||
use constant X => 0;
|
use constant X => 0;
|
||||||
@ -107,8 +108,7 @@ sub _facet {
|
|||||||
# the normal using the right-hand rule
|
# the normal using the right-hand rule
|
||||||
# (this relies on the STL to be well-formed)
|
# (this relies on the STL to be well-formed)
|
||||||
# recompute the normal using the right-hand rule
|
# recompute the normal using the right-hand rule
|
||||||
my $clockwise = ($vertices[2]->[X] - $vertices[0]->[X]) * ($vertices[1]->[Y] - $vertices[0]->[Y])
|
my $clockwise = !is_counter_clockwise([@vertices]);
|
||||||
- ($vertices[1]->[X] - $vertices[0]->[X]) * ($vertices[2]->[Y] - $vertices[0]->[Y]);
|
|
||||||
|
|
||||||
# defensive programming and/or input check
|
# defensive programming and/or input check
|
||||||
if (($normal->[Z] > 0 && $clockwise > 0) || ($normal->[Z] < 0 && $clockwise < 0)) {
|
if (($normal->[Z] > 0 && $clockwise > 0) || ($normal->[Z] < 0 && $clockwise < 0)) {
|
||||||
|
@ -119,7 +119,7 @@ if ($action eq 'skein') {
|
|||||||
|
|
||||||
my $processing_time = tv_interval($t0);
|
my $processing_time = tv_interval($t0);
|
||||||
printf "Done. Process took %d minutes and %.3f seconds\n",
|
printf "Done. Process took %d minutes and %.3f seconds\n",
|
||||||
int($processing_time/60), $processing_time - int($processing_time/60);
|
int($processing_time/60), $processing_time - int($processing_time/60)*60;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
|
Loading…
Reference in New Issue
Block a user