1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 03:02:25 +02:00

cameo/fped2stl.pl: hack: maintain decimal point across flipping

Since our regexps expect numbers to contain a decimal point, any result
that was an integer tripped the re-match after flipping. This hack works
around the problem by formatting the result such that it also has a decimal
point.
This commit is contained in:
Werner Almesberger 2013-12-06 19:07:30 -03:00
parent ff5b4a1ae8
commit 0fc785d3a1

View File

@ -100,7 +100,8 @@ for $z (keys %s) {
undef $t; undef $t;
for $s (split(/\n/, $s{$z})) { for $s (split(/\n/, $s{$z})) {
if ($s =~ /^(-?[0-9]*\.[0-9]*)\s+(-?[0-9]*\.[0-9]*)/) { if ($s =~ /^(-?[0-9]*\.[0-9]*)\s+(-?[0-9]*\.[0-9]*)/) {
$s = (($xmax+$xmin)/2-$1)." $2" if $flip_y; $s = sprintf("%.6f", ($xmax+$xmin)/2-$1)." $2"
if $flip_y;
# re-scan, so that we can flip on both axes # re-scan, so that we can flip on both axes
die unless die unless