Qhull/Util/Options.pm

filter: Statementstmt 94.7% 72 / 76 Branchbran 56.2% 9 / 16 Conditioncond 45.4% 10 / 22 MC/DCmcdc 25.0% 3 / 12 Subroutinesub 86.6% 13 / 15 Podpod 100% 1 / 1 totaltotal 76.0% 108 / 142 CC 14 SCAR 24.1
CC
14
Cov
80%
parse_options
21.8
__ANON__
12.0
croak
2.0
CRAP 11.1
« Qhull/PP.pm ↑ Summary Qhull/Util.pm »
1 package Qhull::Util::Options;
2  
3 # ABSTRACT: Options for Qhull and gang
4  
5 7 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 7 ▶use experimental 'signatures', 'lexical_subs', 'declared_refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶use Log::Any '$log';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 7 our $VERSION = '0.08';
12  
13 7 ▶use parent 'Exporter::Tiny';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 7 ▶use Readonly::Tiny 'readonly';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 7 ▶use Regexp::Common 'number';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 7 ▶use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 7 ▶use CXC::Exporter::Util ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 7 ▶use Ref::Util 'is_arrayref', 'is_hashref';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 7 our @CARP_NOT = qw( Qhull::PP Qhull::Options );
22  
23 7 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
24 install_CONSTANTS( {
25 CATEGORIES => {
26 7 map { ( "CAT_\U$_" => $_ ) }
27 qw(
28 compute
29 control
30 input
31 input_format
32 output
33 output_format
34 output_format_amend
35 output_geom
36 precision
37 print
38 trace
39 ),
40 },
41 } );
42 7 install_EXPORTS;
43 }
44  
45 7 install_EXPORTS( {
46 func => [qw( parse_options )],
47 Option => [qw( %Option )],
48 TypesQR => [
49 qw( $Int $PositiveOrZeroInt $NegativeInt
50 $Num $PositiveOrZeroNum $NegativeNum
51 ),
52 ],
53 } );
54  
55 0 ▶my sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
56 0 require Carp;
57 0 goto \&Carp::croak;
58 }
59  
60 ## no critic (Variables::ProhibitPackageVars)
61  
62 7 our $Int = $RE{num}{int};
63 7 our $PositiveOrZeroInt = $RE{num}{int}{ -sign => q{} };
64 7 our $NegativeInt = $RE{num}{int}{ -sign => q{-} };
65 7 our $Num = $RE{num}{real};
66 7 our $PositiveOrZeroNum = $RE{num}{real}{ -sign => q{} };
67 7 our $NegativeNum = $RE{num}{real}{ -sign => q{-} };
68  
69  
70 # our mapping of Qhull's esoteric options formulation onto
71 # something we can use. Validation of options is not the point
72 # here, just the ability to uniquely identify the option.
73 # At some point this might be extended to providing a more
74 # Perlish interface (or at the least, a more sane way of
75 # specifying options).
76  
77  
78 my %Option = map { ## no critic (BuiltinFunctions::ProhibitComplexMappings)
79 7 my $name;
80 819 ▶ if ( 'ARRAY' eq ref $_ ) { ## no critic (BuiltinFunctions::ProhibitUselessTopic)
Branch: 1 branch
BranchTrueFalseTotal
if ('ARRAY' eq ref $_) { } 70 749 819
81 70 $name = $_->[0]{name};
82 70 ▶ $_->{strip} //= !!0 for $_->@*;
Condition50%1/2
$_->{"strip"} //=
l!l
0140
MC/DC0%0/1
$_->{"strip"} //=
$_->{"strip"}
Truth table50%1/2
A
A= $_->{"strip"}
Aresult
11
00
83 }
84 else {
85 749 $name = $_->{name};
86 749 ▶ $_->{strip} //= !!0;
Condition100%2/2
$_->{"strip"} //=
l!l
28721
MC/DC100%1/1
$_->{"strip"} //=
$_->{"strip"}
Truth table100%2/2
A
A= $_->{"strip"}
Aresult
11
00
87 }
88 819 $name => $_;
89 } ( {
90 name => 'd',
91 category => CAT_COMPUTE,
92 what => 'delaunay',
93 cmd => ['qhull'],
94 },
95  
96 {
97 name => 'f',
98 category => CAT_OUTPUT_FORMAT,
99 what => 'facets',
100 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
101 },
102  
103 {
104 name => 'i',
105 category => CAT_OUTPUT_FORMAT,
106 what => 'incidences',
107 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
108 },
109  
110 {
111 name => 'm',
112 category => CAT_OUTPUT_FORMAT,
113 what => 'mathematica',
114 cmd => [ 'qhull', 'qconvex', 'qhalf', 'qdelaunay', ],
115 },
116  
117 {
118 name => 'n',
119 category => CAT_OUTPUT_FORMAT,
120 what => 'normals',
121 cmd => [ 'qhull', 'qconvex', ],
122 },
123  
124 {
125 name => 'o',
126 category => CAT_OUTPUT_FORMAT,
127 what => 'offFile',
128 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
129 },
130  
131 {
132 name => 'p',
133 category => CAT_OUTPUT_FORMAT,
134 what => 'points',
135 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
136 },
137  
138 {
139 name => 's',
140 category => CAT_OUTPUT_FORMAT,
141 what => 'summary',
142 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
143 },
144  
145 {
146 name => 'v',
147 category => CAT_COMPUTE,
148 what => 'voronoi',
149 cmd => ['qhull'],
150 },
151  
152 [ {
153 name => 'A',
154 regexp => qr/A $NegativeNum/x,
155 category => CAT_PRECISION,
156 what => 'angle-postmerge',
157 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
158 },
159  
160 {
161 name => 'A',
162 regexp => qr/A $PositiveOrZeroNum /x,
163 category => CAT_PRECISION,
164 what => 'angle-premerge',
165 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
166 },
167 ],
168  
169 [ {
170 name => 'C',
171 regexp => qr/C $NegativeNum /x,
172 category => CAT_PRECISION,
173 what => 'centrum-postmerge',
174 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
175 },
176  
177 {
178 name => 'C',
179 regexp => qr/C $PositiveOrZeroNum/x,
180 category => CAT_PRECISION,
181 what => 'centrum-premerge',
182 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
183 },
184 ],
185  
186 {
187 name => 'E',
188 regexp => qr/E $PositiveOrZeroNum/x,
189 category => CAT_PRECISION,
190 what => 'distance-roundoff',
191 cmd => [ 'qhull', ],
192 },
193  
194 [ {
195 name => 'H',
196 category => CAT_COMPUTE,
197 what => 'halfspace',
198 cmd => [ 'qhull', 'qhull', 'qhalf' ],
199 },
200  
201 {
202 name => 'H',
203 regexp => qr/H[.]+/x,
204 category => CAT_COMPUTE,
205 what => 'halfspace-about',
206 cmd => [ 'qhull', 'qhull', 'qhalf' ],
207 },
208 ],
209  
210 {
211 name => 'R',
212 regexp => qr/R $PositiveOrZeroNum/x,
213 category => CAT_PRECISION,
214 what => 'random-perturb',
215 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
216 },
217  
218 {
219 name => 'V',
220 regexp => qr/V $PositiveOrZeroNum/x,
221 category => CAT_PRECISION,
222 what => 'minimum-distance-visible',
223 cmd => [ 'qhull', ],
224 },
225  
226 {
227 name => 'U',
228 regexp => qr/U $PositiveOrZeroNum/x,
229 category => CAT_PRECISION,
230 what => 'maximum-coplanar-distance',
231 cmd => [ 'qhull', 'qhull', 'qconvex', 'qhalf', ],
232 },
233  
234 {
235 name => 'W',
236 regexp => qr/W $PositiveOrZeroNum/x,
237 category => CAT_PRECISION,
238 what => 'minimum-outside-width',
239 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
240 },
241  
242 {
243 name => 'Fa',
244 category => CAT_OUTPUT_FORMAT_AMEND,
245 what => 'area',
246 cmd => [ 'qhull', 'qconvex', 'qdelaunay', ],
247 },
248  
249 {
250 name => 'FA',
251 category => CAT_OUTPUT_FORMAT,
252 what => 'area-total',
253 cmd => [ 'qhull', 'qconvex', 'qdelaunay', ],
254 },
255  
256 {
257 name => 'Fc',
258 category => CAT_OUTPUT_FORMAT,
259 what => 'coplanars',
260 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
261 },
262  
263 {
264 name => 'FC',
265 category => CAT_OUTPUT_FORMAT,
266 what => 'centrums',
267 cmd => [ 'qhull', 'qconvex', ],
268 },
269  
270 {
271 name => 'Fd',
272 category => CAT_INPUT_FORMAT,
273 what => 'cdd-in',
274 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
275 },
276  
277 {
278 name => 'FD',
279 category => CAT_OUTPUT_FORMAT,
280 strip => !!1,
281 what => 'cdd-out',
282 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qdelaunay', ],
283 },
284  
285 {
286 name => 'FF',
287 category => CAT_OUTPUT_FORMAT,
288 what => 'facets-xridge',
289 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
290 },
291  
292 {
293 name => 'Fi',
294 category => CAT_OUTPUT_FORMAT,
295 what => 'facets-inner',
296 cmd => [ 'qhull', 'qconvex', 'qvoronoi', ],
297 },
298  
299 {
300 name => 'FI',
301 category => CAT_OUTPUT_FORMAT,
302 what => 'facet-ids',
303 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
304 },
305  
306 {
307 name => 'Fm',
308 category => CAT_OUTPUT_FORMAT,
309 what => 'merges',
310 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
311 },
312  
313 {
314 name => 'FM',
315 category => CAT_OUTPUT_FORMAT,
316 strip => !!1,
317 what => 'maple',
318 cmd => [ 'qhull', 'qconvex', 'qhalf', 'qdelaunay', ],
319 },
320  
321 {
322 name => 'Fn',
323 category => CAT_OUTPUT_FORMAT,
324 what => 'facet-neighbors',
325 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
326 },
327  
328 {
329 name => 'FN',
330 category => CAT_OUTPUT_FORMAT,
331 what => 'neighbors-vertex',
332 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
333 },
334  
335 {
336 name => 'Fo',
337 category => CAT_OUTPUT_FORMAT,
338 what => 'facet-outer',
339 cmd => [ 'qhull', 'qconvex', 'qvoronoi', ],
340 },
341  
342 {
343 name => 'FO',
344 category => CAT_OUTPUT_FORMAT,
345 strip => !!1,
346 what => 'names',
347 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
348 },
349  
350 {
351 name => 'Fp',
352 category => CAT_OUTPUT_FORMAT,
353 what => 'point-intersect',
354 cmd => [ 'qhull', 'qhalf', ],
355 },
356  
357 {
358 name => 'FP',
359 category => CAT_OUTPUT_FORMAT,
360 what => 'point-nearest',
361 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
362 },
363  
364 {
365 name => 'FQ',
366 category => CAT_OUTPUT_FORMAT,
367 strip => !!1,
368 what => 'command-line',
369 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
370 },
371  
372 {
373 name => 'Fs',
374 category => CAT_OUTPUT_FORMAT,
375 what => 'summary',
376 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
377 },
378  
379 {
380 name => 'FS',
381 category => CAT_OUTPUT_FORMAT,
382 what => 'size',
383 cmd => [ 'qhull', 'qconvex', 'qdelaunay', ],
384 },
385  
386 {
387 name => 'Ft',
388 category => CAT_OUTPUT_FORMAT,
389 what => 'triangles',
390 cmd => [ 'qhull', 'qconvex', ],
391 },
392  
393 {
394 name => 'Fv',
395 category => CAT_OUTPUT_FORMAT,
396 what => 'vertices',
397 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
398 },
399  
400 {
401 name => 'FV',
402 category => CAT_OUTPUT_FORMAT,
403 what => 'vertex-average',
404 cmd => [ 'qhull', 'qconvex', ],
405 },
406  
407 {
408 name => 'Fx',
409 category => CAT_OUTPUT_FORMAT,
410 what => 'extremes',
411 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
412 },
413  
414 {
415 name => 'G',
416 category => CAT_OUTPUT_GEOM,
417 what => 'geom',
418 cmd => [ 'qhull', 'qconvex', 'qhalf', 'qdelaunay', ],
419 },
420  
421 {
422 name => 'Ga',
423 category => CAT_OUTPUT_GEOM,
424 what => 'all-points',
425 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
426 },
427  
428 {
429 name => 'Gc',
430 category => CAT_OUTPUT_GEOM,
431 what => 'centrums',
432 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
433 },
434  
435 {
436 name => 'GD',
437 regexp => qr/GD $PositiveOrZeroInt/x,
438 category => CAT_OUTPUT_GEOM,
439 what => 'drop-dim',
440 cmd => [ 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
441 },
442  
443 {
444 name => 'Gh',
445 category => CAT_OUTPUT_GEOM,
446 what => 'intersections',
447 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
448 },
449  
450 {
451 name => 'Gi',
452 category => CAT_OUTPUT_GEOM,
453 what => 'inner',
454 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
455 },
456  
457 {
458 name => 'Gn',
459 category => CAT_OUTPUT_GEOM,
460 what => 'noplanes',
461 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
462 },
463  
464 {
465 name => 'Go',
466 category => CAT_OUTPUT_GEOM,
467 what => 'outer',
468 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
469 },
470  
471 {
472 name => 'Gp',
473 category => CAT_OUTPUT_GEOM,
474 what => 'coplanar',
475 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
476 },
477  
478 {
479 name => 'Gr',
480 category => CAT_OUTPUT_GEOM,
481 what => 'ridges',
482 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
483 },
484  
485 {
486 name => 'Gt',
487 category => CAT_OUTPUT_GEOM,
488 what => 'transparent',
489 cmd => [ 'qhull', 'qdelaunay', ],
490 },
491  
492 {
493 name => 'Gv',
494 category => CAT_OUTPUT_GEOM,
495 what => 'spheres',
496 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
497 },
498  
499 {
500 name => 'PA',
501 regexp => qr/PA $PositiveOrZeroInt/x,
502 category => CAT_PRINT,
503 what => 'area-keep',
504 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
505 },
506  
507 {
508 name => 'Pd',
509 regexp => qr/Pd .+/x,
510 category => CAT_PRINT,
511 what => 'drop-facets-dim-less',
512 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
513 },
514  
515 {
516 name => 'PD',
517 regexp => qr/PD .+/x,
518 category => CAT_PRINT,
519 what => 'drop-facets-dim-more',
520 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
521 },
522  
523 {
524 name => 'PF',
525 regexp => qr/PF $PositiveOrZeroNum/x,
526 category => CAT_PRINT,
527 what => 'facet-area-keep',
528 cmd => [ 'qhull', 'qdelaunay', ],
529 },
530  
531 {
532 name => 'Pg',
533 category => CAT_PRINT,
534 what => 'good-facets',
535 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
536 },
537  
538 {
539 name => 'PG',
540 category => CAT_PRINT,
541 what => 'good-facet-neighbors',
542 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
543 },
544  
545 {
546 name => 'PM',
547 regexp => qr/PM .+/x,
548 category => CAT_PRINT,
549 what => 'merge-keep',
550 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
551 },
552  
553 {
554 name => 'Po',
555 category => CAT_PRINT,
556 what => 'output-forced',
557 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
558 },
559  
560 {
561 name => 'Pp',
562 category => CAT_PRINT,
563 what => 'precision-ignore',
564 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
565 },
566  
567 {
568 name => 'Qa',
569 category => CAT_CONTROL,
570 what => 'allow-short',
571 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
572 },
573  
574 {
575 name => 'QbB',
576 category => CAT_CONTROL,
577 what => 'bound-unit-box',
578 cmd => [ 'qhull', 'qconvex', ],
579 },
580  
581 {
582 name => 'Qbb',
583 category => CAT_CONTROL,
584 what => 'bound-last',
585 cmd => [ 'qhull', ],
586 },
587  
588 [ {
589 name => 'Qb',
590 regexp => qr/Qb $PositiveOrZeroInt :0B $PositiveOrZeroInt :0 /x,
591 category => CAT_CONTROL,
592 what => 'project-dim',
593 cmd => [ 'qhull', 'qconvex', 'qhalf', ],
594 },
595  
596 {
597 name => 'Qb',
598 regexp => qr/Qb $PositiveOrZeroInt : $Num /x,
599 category => CAT_CONTROL,
600 what => 'bound-dim-low',
601 cmd => [ 'qhull', 'qconvex', ],
602 },
603 ],
604  
605 {
606 name => 'QB',
607 regexp => qr/QB $PositiveOrZeroInt : $Num /x,
608 category => CAT_CONTROL,
609 what => 'bound-dim-high',
610 cmd => [ 'qhull', 'qconvex', ],
611 },
612  
613 {
614 name => 'Qc',
615 category => CAT_CONTROL,
616 what => 'coplanar-keep',
617 cmd => [ 'qhull', 'qconvex', 'qhalf', ],
618 },
619  
620 {
621 name => 'Qf',
622 category => CAT_CONTROL,
623 what => 'furthest-outside',
624 cmd => [ 'qhull', ],
625 },
626  
627 {
628 name => 'Qg',
629 category => CAT_CONTROL,
630 what => 'good-facets-only',
631 cmd => [ 'qhull', ],
632 },
633  
634 [ {
635 name => 'QG',
636 regexp => qr/QG $PositiveOrZeroInt/x,
637 category => CAT_CONTROL,
638 what => 'good-if-see-point',
639 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
640 },
641  
642 {
643 name => 'QG',
644 regexp => qr/QG $NegativeInt /x,
645 category => CAT_CONTROL,
646 what => 'good-if-dont-see-point',
647 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
648 },
649 ],
650  
651 {
652 name => 'Qi',
653 category => CAT_CONTROL,
654 what => 'interior-keep',
655 cmd => [ 'qhull', 'qconvex', 'qhalf', ],
656 },
657  
658 [ {
659 name => 'QJ',
660 category => CAT_CONTROL,
661 what => 'joggle',
662 cmd => [ 'qconvex', 'qhalf', 'qdelaunay', ],
663 },
664  
665 {
666 name => 'QJ',
667 regexp => qr/QJ .+/x,
668 category => CAT_CONTROL,
669 what => 'joggle',
670 cmd => [ 'qconvex', 'qhalf', 'qdelaunay', ],
671 },
672 ],
673  
674 {
675 name => 'Qm',
676 category => CAT_CONTROL,
677 what => 'max-outside-only',
678 cmd => [ 'qhull', ],
679 },
680  
681 {
682 name => 'Qr',
683 category => CAT_CONTROL,
684 what => 'random-outside',
685 cmd => [ 'qhull', ],
686 },
687  
688 [ {
689 name => 'QR',
690 regexp => qr/QR $PositiveOrZeroInt /x,
691 category => CAT_CONTROL,
692 what => 'rotate-id',
693 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
694 },
695 {
696 name => 'QR',
697 regexp => qr/QR $NegativeInt /x,
698 category => CAT_CONTROL,
699 what => 'random-seed',
700 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', ],
701 },
702 ],
703  
704 {
705 name => 'Qs',
706 category => CAT_CONTROL,
707 what => 'search-initial-simplex',
708 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
709 },
710  
711 {
712 name => 'Qt',
713 category => CAT_CONTROL,
714 what => 'triangulate',
715 cmd => [ 'qhull', 'qconvex', 'qhalf', 'qdelaunay', ],
716 },
717  
718 {
719 name => 'QT',
720 category => CAT_CONTROL,
721 what => 'testpoints',
722 cmd => [ 'qhull', ],
723 },
724  
725 {
726 name => 'Qu',
727 category => CAT_CONTROL,
728 what => 'upper-delaunay',
729 cmd => [ 'qhull', 'qvoronoi', 'qdelaunay', ],
730 },
731  
732 {
733 name => 'Qv',
734 category => CAT_CONTROL,
735 what => 'vertex-neighbors-convex',
736 cmd => [ 'qhull', ],
737 },
738  
739 [ {
740 name => 'QV',
741 regexp => qr/QV $NegativeInt /x,
742 category => CAT_CONTROL,
743 what => 'good-facets-not-point',
744 cmd => [ 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
745 },
746 {
747 name => 'QV',
748 regexp => qr/QV $PositiveOrZeroInt /x,
749 category => CAT_CONTROL,
750 what => 'good-facets-point',
751 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', ],
752 },
753 ],
754  
755 {
756 name => 'Qw',
757 category => CAT_CONTROL,
758 what => 'warn-allow',
759 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
760 },
761  
762 {
763 name => 'Qx',
764 category => CAT_CONTROL,
765 what => 'exact-merge',
766 cmd => [ 'qhull', ],
767 },
768  
769 {
770 name => 'Qz',
771 category => CAT_CONTROL,
772 what => 'z-infinity-point',
773 cmd => [ 'qhull', 'qvoronoi', 'qdelaunay', ],
774 },
775  
776 {
777 name => 'Q0',
778 category => CAT_CONTROL,
779 what => 'no-premerge',
780 cmd => [ 'qhull', ],
781 },
782  
783 {
784 name => 'Q1',
785 category => CAT_CONTROL,
786 what => 'angle-merge',
787 cmd => [ 'qhull', ],
788 },
789  
790 {
791 name => 'Q2',
792 category => CAT_CONTROL,
793 what => 'no-merge-independent',
794 cmd => [ 'qhull', ],
795 },
796  
797 {
798 name => 'Q3',
799 category => CAT_CONTROL,
800 what => 'no-merge-vertices',
801 cmd => [ 'qhull', ],
802 },
803  
804 {
805 name => 'Q4',
806 category => CAT_CONTROL,
807 what => 'avoid-old-into-new',
808 cmd => [ 'qhull', ],
809 },
810  
811 {
812 name => 'Q5',
813 category => CAT_CONTROL,
814 what => 'no-check-outer',
815 cmd => [ 'qhull', ],
816 },
817  
818 {
819 name => 'Q6',
820 category => CAT_CONTROL,
821 what => 'no-concave-merge',
822 cmd => [ 'qhull', ],
823 },
824  
825 {
826 name => 'Q7',
827 category => CAT_CONTROL,
828 what => 'no-breadth-first',
829 cmd => [ 'qhull', ],
830 },
831  
832 {
833 name => 'Q8',
834 category => CAT_CONTROL,
835 what => 'no-near-inside',
836 cmd => [ 'qhull', ],
837 },
838  
839 {
840 name => 'Q9',
841 category => CAT_CONTROL,
842 what => 'pick-furthest',
843 cmd => [ 'qhull', ],
844 },
845  
846 {
847 name => 'Q10',
848 category => CAT_CONTROL,
849 what => 'no-narrow',
850 cmd => [ 'qhull', ],
851 },
852  
853 {
854 name => 'Q11',
855 category => CAT_CONTROL,
856 what => 'trinormals-triangulate',
857 cmd => [ 'qhull', ],
858 },
859  
860 {
861 name => 'Q12',
862 category => CAT_CONTROL,
863 what => 'allow-wide',
864 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
865 },
866  
867 {
868 name => 'Q14',
869 category => CAT_CONTROL,
870 what => 'merge-pinched-vertices',
871 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
872 },
873  
874 {
875 name => 'Q15',
876 category => CAT_CONTROL,
877 what => 'check-duplicates',
878 cmd => [ 'qhull', ],
879 },
880  
881 {
882 name => 'T',
883 regexp => qr/T $Int /x,
884 category => CAT_TRACE,
885 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
886 },
887  
888 {
889 name => 'Ta',
890 category => CAT_TRACE,
891 what => 'annotate-output',
892 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
893 },
894  
895 {
896 name => 'TA',
897 regexp => qr/TA $PositiveOrZeroInt/x,
898 category => CAT_TRACE,
899 what => 'stop-add',
900 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
901 },
902  
903 {
904 name => 'Tc',
905 category => CAT_TRACE,
906 what => 'check-frequently',
907 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
908 },
909  
910 {
911 name => 'Tf',
912 category => CAT_TRACE,
913 what => 'flush',
914 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
915 },
916  
917 {
918 name => 'Ts',
919 category => CAT_TRACE,
920 what => 'statistics',
921 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
922 },
923  
924 {
925 name => 'Tv',
926 category => CAT_TRACE,
927 what => 'verify',
928 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
929 },
930  
931 {
932 name => 'Tz',
933 category => CAT_TRACE,
934 what => 'z-stdout',
935 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
936 },
937  
938 {
939 name => 'TC',
940 regexp => qr/TC $PositiveOrZeroInt/x,
941 category => CAT_TRACE,
942 what => 'cone-stop',
943 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
944 },
945  
946 {
947 name => 'TF',
948 regexp => qr/TF $PositiveOrZeroInt/x,
949 category => CAT_TRACE,
950 what => 'facet-log',
951 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
952 },
953  
954 {
955 name => 'TI',
956 category => CAT_INPUT,
957 what => 'input-file',
958 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
959 },
960  
961 {
962 name => 'TO',
963 category => CAT_OUTPUT,
964 what => 'output-file',
965 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
966 },
967  
968 [ {
969 name => 'TP',
970 regexp => qr/TP $Int /x,
971 category => CAT_TRACE,
972 what => 'trace-point',
973 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
974 },
975  
976 {
977 name => 'TP-1',
978 category => CAT_TRACE,
979 what => 'trace-point_-1',
980 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
981 },
982 ],
983  
984 {
985 name => 'TM',
986 regexp => qr/TM $PositiveOrZeroInt /x,
987 category => CAT_TRACE,
988 what => 'trace-merge',
989 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
990 },
991  
992 {
993 name => 'TR',
994 regexp => qr/TR $PositiveOrZeroInt /x,
995 category => CAT_TRACE,
996 what => 'rerun',
997 cmd => [ 'qhull', ],
998 },
999  
1000 [ {
1001 name => 'TV',
1002 regexp => qr/TV $NegativeInt /x,
1003 category => CAT_TRACE,
1004 what => 'stop-before-point',
1005 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
1006 },
1007  
1008 {
1009 name => 'TV',
1010 regexp => qr/TV $PositiveOrZeroInt /x,
1011 category => CAT_TRACE,
1012 what => 'stop-after-point',
1013 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', ],
1014 },
1015 ],
1016  
1017 {
1018 name => 'TW',
1019 regexp => qr/TW $PositiveOrZeroNum/x,
1020 category => CAT_TRACE,
1021 what => 'wide-trace',
1022 cmd => [ 'qhull', 'qconvex', 'qvoronoi', 'qhalf', 'qdelaunay', ],
1023 },
1024  
1025 );
1026 7 readonly \%Option;
1027  
1028 install_CONSTANTS( {
1029 7 OPTIONS => { map { ( "OPTION_$_", $_ ) } keys %Option },
1030 } );
1031 7 install_EXPORTS;
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067 13 ▶sub parse_options ( $user_options ) {
Subroutine parse_options: called CC=12 SCAR=30.8
Pod documented
1068  
1069 13 my @user_options = $user_options->@*;
1070  
1071 13 my @specs;
1072  
1073 13 ▶ while ( @user_options ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@user_options) 22 13 35
1074 22 my $option = shift @user_options;
1075  
1076 # these are the only options which have a separate argument;
1077 # for the rest, the argument is concatenated with the option name
1078 22 ▶ if ( $option eq 'TI' or $option eq 'TO' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($option eq "TI" or $option eq "TO") 10 12 22
Condition100%3/3
$option eq "TI" or $option eq "TO"
l!l&&r!l&&!r
6412
MC/DC100%2/2
$option eq "TI" or $option eq "TO"
$option eq "TI" $option eq "TO"
Truth table100%3/3
A or B
A= $option eq "TI"B= $option eq "TO"
ABresult
1X1
011
000
1079 10 push @specs, [ $option, $Option{$option}, shift( @user_options ) ];
1080 10 next;
1081 }
1082  
1083 12 my $found;
1084  
1085 my $maybe = $Option{ substr( $option, 0, 4 ) } // $Option{ substr( $option, 0, 3 ) }
1086 12 ▶ // $Option{ substr( $option, 0, 2 ) } // $Option{ substr( $option, 0, 1 ) };
Condition33%3/9
(($Option{substr($option, 0, 4)} // $Option{substr($option, 0, 3)}) // $Option{substr($option, 0, 2)}) // $Option{substr($option, 0, 1)}
l!l&&r!l&&!r
1200
($Option{substr($option, 0, 4)} // $Option{substr($option, 0, 3)}) // $Option{substr($option, 0, 2)}
l!l&&r!l&&!r
1200
$Option{substr($option, 0, 4)} // $Option{substr($option, 0, 3)}
l!l&&r!l&&!r
1200
MC/DC0%0/4
(($Option{substr($option, 0, 4)} // $Option{substr($option, 0, 3)}) // $Option{substr($option, 0, 2)}) // $Option{substr($option, 0, 1)}
$Option{substr($option, 0, 4)} $Option{substr($option, 0, 3)} $Option{substr($option, 0, 2)} $Option{substr($option, 0, 1)}
Truth table20%1/5
A // B // C // D
A= $Option{substr($option, 0, 4)}B= $Option{substr($option, 0, 3)}C= $Option{substr($option, 0, 2)}D= $Option{substr($option, 0, 1)}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
1087  
1088  
1089 12 ▶ if ( is_hashref( $maybe ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (is_hashref($maybe)) { } 12 0 12
elsif (is_arrayref($maybe)) { } 0 0 0
1090 $found = $maybe
1091 12 ▶ if !exists $maybe->{regexp} || $option =~ $maybe->{regexp};
Branch: 1 branch
BranchTrueFalseTotal
if not exists $maybe->{"regexp"} or $option =~ /$maybe->{"regexp"}/u 12 0 12
Condition33%1/3
not exists $maybe->{"regexp"} or $option =~ /$maybe->{"regexp"}/u
l!l&&r!l&&!r
1200
MC/DC0%0/2
not exists $maybe->{"regexp"} or $option =~ /$maybe->{"regexp"}/u
not exists $maybe->{"regexp"} $option =~ /$maybe->{"regexp"}/u
Truth table33%1/3
not(A) or B
A= not exists $maybe->{"regexp"}B= $option =~ /$maybe->{"regexp"}/u
ABresult
1X1
011
000
1092 }
1093  
1094 elsif ( is_arrayref( $maybe ) ) {
1095 # these should be in order of highest to least precedence
1096 0 ▶ $found = first { $_->{regexp} && $option =~ $_->{regexp} || $option eq $_->{name} } $maybe->@*;
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
$_->{"regexp"} and $option =~ /$_->{"regexp"}/u or $option eq $_->{"name"} 0 0 0
Condition0%0/3
$_->{"regexp"} and $option =~ /$_->{"regexp"}/u
!ll&&!rl&&r
000
MC/DC0%0/2
$_->{"regexp"} and $option =~ /$_->{"regexp"}/u
$_->{"regexp"} $option =~ /$_->{"regexp"}/u
Truth table0%0/3
A and B
A= $_->{"regexp"}B= $option =~ /$_->{"regexp"}/u
ABresult
0X0
100
111
1097 }
1098  
1099 12 ▶ croak( "unknown qhull option: $option" ) if !$found;
Branch: 1 branch
BranchTrueFalseTotal
unless $found 0 12 12
1100  
1101 12 my $spec = [ $option, $found ];
1102 12 push @specs, $spec;
1103 }
1104  
1105 13 return \@specs;
1106 }
1107  
1108 7 1;
1109  
1110 #
1111 # This file is part of Qhull
1112 #
1113 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
1114 #
1115 # This is free software, licensed under:
1116 #
1117 # The GNU General Public License, Version 3, June 2007
1118 #
1119  
1120 __END__
« Qhull/PP.pm ↑ Summary Qhull/Util.pm »