Branch Coverage

blib/lib/Math/Geometry/Planar.pm
Criterion Covered Total %
branch 418 604 69.2


line true false branch
342 0 16 if (@points != 2)
379 27 0 if (@points == 4) { }
0 0 elsif (@points == 3) { }
405 0 128 if (@points != 3)
439 0 7 if (@points != 3)
456 0 12 if (@points != 3)
508 0 11 if (@points != 4)
520 0 11 if (abs $d < $delta)
523 1 3 unless ($n1 / $d < 1 and $n2 / $d < 1 and $n1 / $d > 0 and $n2 / $d > 0)
541 0 15 if (@points < 4)
552 1 14 if (abs $d < $delta)
587 0 2 if (@points != 4)
599 0 2 if (abs $d < $delta)
602 1 1 unless ($n1 / $d > 0 and $n2 / $d > 0)
618 0 2 if (@points != 4)
629 0 2 if (abs $d < $delta)
632 1 1 unless ($n1 / $d < 1 and $n1 / $d > 0)
648 0 2 if (@points != 4)
659 0 2 if (abs $d < $delta)
662 1 1 unless ($n1 / $d > 0)
678 0 2 if (@points != 4)
690 0 2 if (abs $d < $delta)
693 1 1 unless ($n1 / $d < 1 and $n1 / $d > 0 and $n2 / $d > 0)
712 0 2 if (@points != 4)
729 0 13 if (@points != 3)
762 0 3 if (@points < 3)
774 1 2 if ($d1 <= 0) { }
1 1 elsif ($d2 <= $d1) { }
799 0 1 if (@points < 3)
829 49 95 if (@_)
830 0 49 if ($self->get_polygons) { }
839 29 20 if (PolygonArea($pointsref) > 0) { }
854 13 9 if (@_)
855 0 13 if ($self->points) { }
876 19 13 unless $polygons
886 0 23 unless @_
888 0 23 if ($self->points)
893 19 4 unless ($self->num_polygons)
896 12 7 if (PolygonArea($outer) < 0) { }
906 3 7 if (PolygonArea($inner) > 0) { }
926 49 18 unless $polygons
928 6 12 if (@_) { }
931 7 0 if ($index >= 0 and $index < num_polygons($self)) { }
951 1 1 if ($pointsref) { }
954 1 4 if (Colinear([$points[$i - 2], $points[$i - 1], $points[$i]]))
968 1 4 if (Colinear([$points[$i - 2], $points[$i - 1], $points[$i]]))
995 1 2 unless ($pointsref)
997 0 1 unless $pointsref
1000 1 2 if @points < 5
1005 1 8 if ($prev < 0 and $tmp > 0 or $prev > 0 and $tmp < 0)
1033 0 5 if @points < 4
1038 3 8 if $i == 0 and $j == @points - 1
1039 2 6 if (SegmentIntersection([$points[$i - 1], $points[$i], $points[$j - 1], $points[$j]]))
1052 2 2 if ($pointsref) { }
1058 1 2 unless IsSimplePolygon($_)
1075 1 1 unless ($pointsref)
1077 0 1 unless $pointsref
1081 2 0 if ($pointsref)
1083 0 2 if (@points < 3)
1105 0 80 if (@points < 3)
1130 1 1 if ($pointsref) { }
1163 0 1 unless (@triangles)
1200 0 10 if (@points < 3)
1204 0 10 unless ($pointref)
1214 3 49 if ($cp == 0)
1215 0 0 if ($points[$i - 1][0] <= $point[0] && $point[0] <= $points[$i][0] || $points[$i - 1][0] >= $point[0] && $point[0] >= $points[$i][0] and $points[$i - 1][1] <= $$pointref[1] && $point[1] <= $points[$i][1] || $points[$i - 1][1] >= $point[1] && $point[1] >= $points[$i][1])
1229 29 23 if ($points[$i - 1][1] <= $point[1]) { }
1230 8 21 if ($points[$i][1] > $point[1])
1231 6 2 if ($cp > 0)
1237 8 15 if ($points[$i][1] <= $point[1])
1238 2 6 if ($cp < 0)
1255 2 6 if ($pointsref) { }
1259 2 4 unless IsInsidePolygon($polygonrefs[0], $pointref)
1262 1 1 if IsInsidePolygon($polygonrefs[$i], $pointref)
1283 1 0 if ($center)
1288 1 0 if ($pointsref)
1308 1 0 if ($pointsref) { }
1329 1 0 if ($pointsref)
1346 1 0 if ($pointsref) { }
1368 0 1 if (@points == 0)
1374 1 0 if ($center)
1392 1 0 if ($pointsref) { }
1414 0 1 if (@points == 0)
1420 1 0 if ($center)
1438 1 0 if ($pointsref) { }
1460 0 1 if (@axis != 2)
1468 0 1 if (@points == 0)
1488 1 0 if ($pointsref) { }
1511 0 1 if (@points == 0)
1517 1 0 if ($center)
1538 1 0 if ($pointsref) { }
1561 1 0 unless ($pointsref)
1563 0 1 unless $pointsref
1566 0 1 if (@points < 3)
1575 0 4 if $points[$i][0] < $min_x
1576 0 4 if $points[$i][1] < $min_y
1577 1 3 if $points[$i][0] > $max_x
1578 2 2 if $points[$i][1] > $max_y
1601 2 0 unless ($pointsref)
1603 0 2 unless $pointsref
1606 0 2 if (@points < 3)
1628 22 52 if $j == $i or $j == $i - 1
1633 25 27 if ($dist > $maxj)
1649 15 47 if ($dist < $mink)
1653 15 47 if ($dist > $maxl)
1662 3 9 if ($area < $min_area or not $min_area)
1691 1 1 if ($pointsref) { }
1695 1 0 if ($polygonrefs)
1720 0 1 unless ($pointsref)
1722 0 0 unless $pointsref
1725 0 1 if @points < 5
1733 0 1 if (CrossProduct([$points[0], $points[1], $points[2]]) > 0) { }
1744 1 3 if (CrossProduct([$result[$bot], $result[$bot + 1], $points[$i]]) > 0 and CrossProduct([$result[$top - 1], $result[$top], $points[$i]]) > 0)
1786 0 1 unless ($pointsref)
1788 0 0 unless $pointsref
1791 0 1 if @points < 5
1802 1 1 if ($points[$i][0] != $xmin)
1807 0 1 if ($minmax == @points - 1)
1809 0 0 if ($points[$minmax][1] != $points[$minmin][1])
1820 1 0 if ($points[$i][0] != $xmax)
1831 3 5 if (CrossProduct([$points[$minmin], $points[$maxmin], $points[$i]]) >= 0 and $i < $maxmin)
1836 4 2 if (CrossProduct([$hull[$top - 1], $hull[$top], $points[$i]]) > 0) { }
1846 0 1 if ($maxmax != $maxmin)
1853 4 4 if (CrossProduct([$points[$maxmax], $points[$minmax], $points[$i]]) >= 0 and $i > $minmax)
1858 2 2 if (CrossProduct([$hull[$top - 1], $hull[$top], $points[$i]]) > 0) { }
1867 0 1 if ($minmax == $minmin)
1882 0 0 if ($pointsref) { }
1897 19 3 if ($result) { }
1911 3 2 if ($pointsref) { }
1918 0 8 if (@points < 3)
1930 5 3 if ($i == 0) { }
1981 2 8 if ($hole) { }
1988 4 2 if (@outer == 1) { }
2004 2 1 if ($obj->isinside($polygon[0])) { }
2023 2 4 if ($op eq 'DIFFERENCE')
2027 1 3 if ($op eq 'INTERSECTION')
2031 1 2 if ($op eq 'XOR')
2035 2 0 if ($op eq 'UNION')
2074 1 2 if (@args == 4) { }
2 0 elsif (@args == 3) { }
2079 1 1 if (ref $args[2]) { }
2115 1 2 if (@args == 4) { }
2 0 elsif (@args == 5) { }
2123 0 0 if ($mid_angle < $start_angle and $start_angle < $end_angle or $start_angle < $end_angle and $end_angle < $mid_angle or $end_angle < $mid_angle and $mid_angle < $start_angle)
2140 2 1 if ($direction) { }
2141 1 1 if ($angle > 0)
2145 1 0 if ($angle < 0)
2179 2 0 if ($y1 != $y2) { }
2185 2 0 if ($y2 != $y3) { }
2192 0 2 if $b1 == $b2 or not $b1 || $b2
2193 2 0 unless $xi
2194 2 0 if $b1
2195 2 0 if $b1
2206 0 7 if $y1 == $y2 and $x1 == $x2
2207 0 7 if $y1 == $y2 and $x1 < $x2
2208 3 4 if $y1 == $y2 and $x1 > $x2
2209 3 1 if $x1 == $x2 and $y1 < $y2
2210 1 0 if $x1 == $x2 and $y1 > $y2
2348 3 13 if ($i == $last) { }
3 10 elsif ($i == $first) { }
2443 1 1 if ($v0{'y'} > $v1{'y'} + $C_EPS) { }
0 1 elsif (_fp_equal($v0{'y'}, $v1{'y'}, $Math::Geometry::Planar::precision)) { }
2446 0 0 if ($v0{'x'} > $v1{'x'} + $C_EPS) { }
2461 1 1 if ($v0{'y'} < $v1{'y'} - $C_EPS) { }
0 1 elsif (_fp_equal($v0{'y'}, $v1{'y'}, $Math::Geometry::Planar::precision)) { }
2464 0 0 if ($v0{'x'} < $v1{'x'}) { }
2478 61 93 if ($v0{'y'} > $v1{'y'} + $C_EPS) { }
54 39 elsif ($v0{'y'} < $v1{'y'} - $C_EPS) { }
2499 24 64 if ($v0{'y'} > $v1{'y'} + $C_EPS) { }
7 57 elsif ($v0{'y'} < $v1{'y'} - $C_EPS) { }
2512 5 27 if ($v0{'y'} < $v1{'y'} - $C_EPS) { }
10 17 elsif ($v0{'y'} > $v1{'y'} + $C_EPS) { }
2622 18 14 if $seg[$segnum]{'is_inserted'}
2675 7 7 if (_greater_than($s{'v1'}, $s{'v0'}))
2686 7 7 $is_swapped ? :
8 6 if ($is_swapped ? !_inserted($segnum, $LASTPT) : !_inserted($segnum, $FIRSTPT)) { }
2706 7 1 if (($tmp_d = $tr[$tl]{'d0'}) > 0 and $tr[$tmp_d]{'u0'} == $tu)
2709 0 8 if (($tmp_d = $tr[$tl]{'d0'}) > 0 and $tr[$tmp_d]{'u1'} == $tu)
2713 4 4 if (($tmp_d = $tr[$tl]{'d1'}) > 0 and $tr[$tmp_d]{'u0'} == $tu)
2716 0 8 if (($tmp_d = $tr[$tl]{'d1'}) > 0 and $tr[$tmp_d]{'u1'} == $tu)
2751 7 7 $is_swapped ? :
4 10 if ($is_swapped ? !_inserted($segnum, $FIRSTPT) : !_inserted($segnum, $LASTPT)) { }
2771 3 1 if (($tmp_d = $tr[$tl]{'d0'}) > 0 and $tr[$tmp_d]{'u0'} == $tu)
2774 0 4 if (($tmp_d = $tr[$tl]{'d0'}) > 0 and $tr[$tmp_d]{'u1'} == $tu)
2778 2 2 if (($tmp_d = $tr[$tl]{'d1'}) > 0 and $tr[$tmp_d]{'u0'} == $tu)
2781 0 4 if (($tmp_d = $tr[$tl]{'d1'}) > 0 and $tr[$tmp_d]{'u1'} == $tu)
2843 14 13 if ($t == $tfirst)
2846 14 13 if (_equal_to($tr[$t]{'lo'}, $tr[$tlast]{'lo'}))
2863 0 27 if ($tr[$t]{'d0'} <= 0 and $tr[$t]{'d1'} <= 0) { }
17 10 elsif ($tr[$t]{'d0'} > 0 and $tr[$t]{'d1'} <= 0) { }
0 10 elsif ($tr[$t]{'d0'} <= 0 and $tr[$t]{'d1'} > 0) { }
2871 8 9 if ($tr[$t]{'u0'} > 0 and $tr[$t]{'u1'} > 0) { }
2872 1 7 if ($tr[$t]{'usave'} > 0) { }
2873 1 0 if ($tr[$t]{'uside'} == $S_LEFT) { }
2901 3 6 if (($td0 = $tr[$tmp_u]{'d0'}) > 0 and ($td1 = $tr[$tmp_u]{'d1'}) > 0) { }
2903 1 2 if ($tr[$td0]{'rseg'} > 0 and not _is_left_of($tr[$td0]{'rseg'}, $s{'v1'})) { }
2917 3 14 if (_fp_equal($tr[$t]{'lo'}{'y'}, $tr[$tlast]{'lo'}{'y'}, $Math::Geometry::Planar::precision) and _fp_equal($tr[$t]{'lo'}{'x'}, $tr[$tlast]{'lo'}{'x'}, $Math::Geometry::Planar::precision) and $tribot) { }
2921 1 2 if ($is_swapped) { }
2927 3 0 if ($tmptriseg > 0 and _is_left_of($tmptriseg, $s{'v0'})) { }
2935 3 11 if ($tr[$tr[$t]{'d0'}]{'u0'} > 0 and $tr[$tr[$t]{'d0'}]{'u1'} > 0)
2936 1 2 if ($tr[$tr[$t]{'d0'}]{'u0'} == $t) { }
2951 0 0 if ($tr[$t]{'u0'} > 0 and $tr[$t]{'u1'} > 0) { }
2952 0 0 if ($tr[$t]{'usave'} > 0) { }
2953 0 0 if ($tr[$t]{'uside'} == $S_LEFT) { }
2982 0 0 if (($td0 = $tr[$tmp_u]{'d0'}) > 0 and ($td1 = $tr[$tmp_u]{'d1'}) > 0) { }
2984 0 0 if ($tr[$td0]{'rseg'} > 0 and not _is_left_of($tr[$td0]{'rseg'}, $s{'v1'})) { }
2998 0 0 if (_fp_equaL($tr[$t]{'lo'}{'y'}, $tr[$tlast]{'lo'}{'y'}, $Math::Geometry::Planar::precision) and _fp_equal($tr[$t]{'lo'}{'x'}, $tr[$tlast]{'lo'}{'x'}, $Math::Geometry::Planar::precision) and $tribot) { }
3003 0 0 if ($is_swapped) { }
3009 0 0 if ($tmpseg > 0 and _is_left_of($tmpseg, $s{'v0'})) { }
3019 0 0 if ($tr[$tr[$t]{'d1'}]{'u0'} > 0 and $tr[$tr[$t]{'d1'}]{'u1'} > 0)
3020 0 0 if ($tr[$tr[$t]{'d1'}]{'u0'} == $t) { }
3044 0 10 if (_fp_equal($tr[$t]{'lo'}{'y'}, $s{'v0'}{'y'}, $Math::Geometry::Planar::precision)) { }
3045 0 0 if ($tr[$t]{'lo'}{'x'} > $s{'v0'}{'x'}) { }
3055 2 8 if (_less_than(\%tmppt, $tr[$t]{'lo'})) { }
3065 8 2 if ($tr[$t]{'u0'} > 0 and $tr[$t]{'u1'} > 0) { }
3066 2 6 if ($tr[$t]{'usave'} > 0) { }
3067 0 2 if ($tr[$t]{'uside'} == $S_LEFT) { }
3096 0 2 if (($td0 = $tr[$tmp_u]{'d0'}) > 0 and ($td1 = $tr[$tmp_u]{'d1'}) > 0) { }
3098 0 0 if ($tr[$td0]{'rseg'} > 0 and not _is_left_of($tr[$td0]{'rseg'}, $s{'v1'})) { }
3112 7 3 if (_fp_equal($tr[$t]{'lo'}{'y'}, $tr[$tlast]{'lo'}{'y'}, $Math::Geometry::Planar::precision) and _fp_equal($tr[$t]{'lo'}{'x'}, $tr[$tlast]{'lo'}{'x'}, $Math::Geometry::Planar::precision) and $tribot) { }
2 1 elsif ($i_d0) { }
3179 14 14 if ($whichpt == $FIRSTPT) { }
3197 56 94 if ($rptr{'nodetype'} == $T_SINK)
3200 77 17 if ($rptr{'nodetype'} == $T_Y)
3201 29 48 if (_greater_than(\%v, $rptr{'yval'})) { }
16 32 elsif (_equal_to(\%v, $rptr{'yval'})) { }
3205 10 6 if (_greater_than(\%vo, $rptr{'yval'})) { }
3214 17 0 if ($rptr{'nodetype'} == $T_X)
3215 6 11 if (_equal_to(\%v, $seg[$rptr{'segnum'}]{'v0'}) or _equal_to(\%v, $seg[$rptr{'segnum'}]{'v1'})) { }
9 2 elsif (_is_left_of($rptr{'segnum'}, \%v)) { }
3217 0 6 if (_fp_equal($v{'y'}, $vo{'y'}, $Math::Geometry::Planar::precision)) { }
5 1 elsif (_is_left_of($rptr{'segnum'}, \%vo)) { }
3218 0 0 if ($vo{'x'} < $v{'x'}) { }
3255 0 54 unless _greater_than_equal_to($tr[$t]{'lo'}, $tr[$tlast]{'lo'})
3256 27 27 if ($side == $S_LEFT) { }
3263 26 28 if ($cond) { }
3264 13 13 if ($tr[$t]{'lseg'} == $tr[$tnext]{'lseg'} and $tr[$t]{'rseg'} == $tr[$tnext]{'rseg'}) { }
3269 9 4 if ($qs[$ptnext]{'left'} == $tr[$tnext]{'sink'}) { }
3275 13 0 if (($tr[$t]{'d0'} = $tr[$tnext]{'d0'}) > 0)
3276 13 0 if ($tr[$tr[$t]{'d0'}]{'u0'} == $tnext) { }
0 0 elsif ($tr[$tr[$t]{'d0'}]{'u1'} == $tnext) { }
3282 0 13 if (($tr[$t]{'d1'} = $tr[$tnext]{'d1'}) > 0)
3283 0 0 if ($tr[$tr[$t]{'d1'}]{'u0'} == $tnext) { }
0 0 elsif ($tr[$tr[$t]{'d1'}]{'u1'} == $tnext) { }
3312 13 10 if (_greater_than($s{'v1'}, $s{'v0'})) { }
3313 9 4 if (_fp_equal($s{'v1'}{'y'}, $v{'y'}, $Math::Geometry::Planar::precision)) { }
2 2 elsif (_fp_equal($s{'v0'}{'y'}, $v{'y'}, $Math::Geometry::Planar::precision)) { }
3314 9 0 if ($v{'x'} < $s{'v1'}{'x'}) { }
3320 2 0 if ($v{'x'} < $s{'v0'}{'x'}) { }
3329 2 8 if (_fp_equal($s{'v1'}{'y'}, $v{'y'}, $Math::Geometry::Planar::precision)) { }
4 4 elsif (_fp_equal($s{'v0'}{'y'}, $v{'y'}, $Math::Geometry::Planar::precision)) { }
3330 2 0 if ($v{'x'} < $s{'v1'}{'x'}) { }
3336 4 0 if ($v{'x'} < $s{'v0'}{'x'}) { }
3345 19 4 if ($area > 0) { }
3398 0 0 if ($t{'state'} == $ST_INVALID)
3402 0 0 if ($t{'lseg'} <= 0 or $t{'rseg'} <= 0)
3434 5 13 if ($t{'state'} == $ST_INVALID)
3437 9 4 if ($t{'lseg'} <= 0 or $t{'rseg'} <= 0)
3440 2 2 if ($t{'u0'} <= 0 and $t{'u1'} <= 0 or $t{'d0'} <= 0 and $t{'d1'} <= 0)
3468 15 3 if (_Cross_Sine($v0, $v1) >= 0) { }
3493 19 9 unless $vp0{'vnext'}[$i]
3494 0 9 if ($vp0{'vnext'}[$i] <= 0)
3497 9 0 if (($temp = _get_angle($vp0{'pt'}, $vert[$vp0{'vnext'}[$i]]{'pt'}, $vp1{'pt'})) > $angle)
3509 19 9 unless $vp1{'vnext'}[$i]
3510 0 9 if ($vp1{'vnext'}[$i] <= 0)
3513 9 0 if (($temp = _get_angle($vp1{'pt'}, $vert[$vp1{'vnext'}[$i]]{'pt'}, $vp0{'pt'})) > $angle)
3594 2 16 if (inside_polygon($tr[$i]))
3618 1 1 if ($tr[$tr_start]{'u0'} > 0) { }
1 0 elsif ($tr[$tr_start]{'d0'} > 0) { }
3632 5 57 unless ($trnum)
3641 42 15 if ($trnum <= 0 or $visited[$trnum])
3656 2 13 if ($t{'u0'} <= 0 and $t{'u1'} <= 0) { }
2 11 elsif ($t{'d0'} <= 0 and $t{'d1'} <= 0) { }
1 10 elsif ($t{'u0'} > 0 and $t{'u1'} > 0) { }
10 0 elsif ($t{'u0'} > 0 or $t{'u1'} > 0) { }
3657 0 2 if ($t{'d0'} > 0 and $t{'d1'} > 0) { }
3660 0 0 if ($from == $t{'d1'}) { }
3678 0 2 if ($t{'u0'} > 0 and $t{'u1'} > 0) { }
3681 0 0 if ($from == $t{'u1'}) { }
3699 0 1 if ($t{'d0'} > 0 and $t{'d1'} > 0) { }
3703 0 0 if ($dir == $TR_FROM_DN and $t{'d1'} == $from or $dir == $TR_FROM_UP and $t{'u1'} == $from) { }
3719 0 1 if (_equal_to($t{'lo'}, $seg[$t{'lseg'}]{'v1'})) { }
3724 0 0 if ($dir == $TR_FROM_UP and $t{'u0'} == $from) { }
3742 1 0 if ($dir == $TR_FROM_UP and $t{'u1'} == $from) { }
3759 1 9 if ($t{'d0'} > 0 and $t{'d1'} > 0) { }
3760 1 0 if (_equal_to($t{'hi'}, $seg[$t{'lseg'}]{'v0'})) { }
3764 1 0 if (not $dir == $TR_FROM_DN && $t{'d0'} == $from) { }
3783 0 0 if ($dir == $TR_FROM_DN and $t{'d1'} == $from) { }
3799 2 7 if (_equal_to($t{'hi'}, $seg[$t{'lseg'}]{'v0'}) and _equal_to($t{'lo'}, $seg[$t{'rseg'}]{'v0'})) { }
3 4 elsif (_equal_to($t{'hi'}, $seg[$t{'rseg'}]{'v1'}) and _equal_to($t{'lo'}, $seg[$t{'lseg'}]{'v1'})) { }
3804 0 2 if ($dir == $TR_FROM_UP) { }
3824 0 3 if ($dir == $TR_FROM_UP) { }
3874 1 22 if ($mchain[$p]{'marked'}) { }
3881 4 18 if (_greater_than($vert[$v]{'pt'}, $ymax))
3885 11 11 if (_less_than($vert[$v]{'pt'}, $ymin))
3893 1 8 if ($processed)
3897 6 2 if ($vcount == 3) { }
3904 1 1 if (_equal_to($vert[$v]{'pt'}, $ymin)) { }
3927 1 1 if ($side == $TRI_RHS) { }
3936 0 1 if (($endv = $mchain[$mchain[$posmax]{'prev'}]{'vnum'}) == 0)
3953 8 4 if ($ri > 0) { }
3954 6 2 if (_Cross($vert[$v]{'pt'}, $vert[$rc[$ri - 1]]{'pt'}, $vert[$rc[$ri]]{'pt'}) > 0) { }