@@ -1584,11 +1584,11 @@ func (l *loopCrosser) hasCrossing(ai, bi *rangeIterator) bool {
1584
1584
l .bCells = nil
1585
1585
1586
1586
for {
1587
- if n := bi .it . IndexCell (). shapes [ 0 ] .numEdges (); n > 0 {
1587
+ if n := bi .clipped () .numEdges (); n > 0 {
1588
1588
totalEdges += n
1589
1589
if totalEdges >= edgeQueryMinEdges {
1590
1590
// There are too many edges to test them directly, so use CrossingEdgeQuery.
1591
- if l .cellCrossesAnySubcell (ai .it . IndexCell (). shapes [ 0 ] , ai .cellID ()) {
1591
+ if l .cellCrossesAnySubcell (ai .clipped () , ai .cellID ()) {
1592
1592
return true
1593
1593
}
1594
1594
bi .seekBeyond (ai )
@@ -1604,20 +1604,20 @@ func (l *loopCrosser) hasCrossing(ai, bi *rangeIterator) bool {
1604
1604
1605
1605
// Test all the edge crossings directly.
1606
1606
for _ , c := range l .bCells {
1607
- if l .cellCrossesCell (ai .it . IndexCell (). shapes [ 0 ] , c .shapes [0 ]) {
1607
+ if l .cellCrossesCell (ai .clipped () , c .shapes [0 ]) {
1608
1608
return true
1609
1609
}
1610
1610
}
1611
1611
1612
1612
return false
1613
1613
}
1614
1614
1615
- // containsCenterMatches reports if the clippedShapes containsCenter boolean corresponds
1616
- // to the crossing target type given. (This is to work around C++ allowing false == 0,
1617
- // true == 1 type implicit conversions and comparisons)
1618
- func containsCenterMatches (a * clippedShape , target crossingTarget ) bool {
1619
- return (! a . containsCenter && target == crossingTargetDontCross ) ||
1620
- (a . containsCenter && target == crossingTargetCross )
1615
+ // containsCenterMatches reports if the clippedShapes containsCenter boolean
1616
+ // corresponds to the crossing target type given. (This is to work around C++
1617
+ // allowing false == 0, true == 1 type implicit conversions and comparisons)
1618
+ func containsCenterMatches (containsCenter bool , target crossingTarget ) bool {
1619
+ return (! containsCenter && target == crossingTargetDontCross ) ||
1620
+ (containsCenter && target == crossingTargetCross )
1621
1621
}
1622
1622
1623
1623
// hasCrossingRelation reports whether given two iterators positioned such that
@@ -1626,7 +1626,8 @@ func containsCenterMatches(a *clippedShape, target crossingTarget) bool {
1626
1626
// is an edge crossing, a wedge crossing, or a point P that matches both relations
1627
1627
// crossing targets. This function advances both iterators past ai.cellID.
1628
1628
func (l * loopCrosser ) hasCrossingRelation (ai , bi * rangeIterator ) bool {
1629
- aClipped := ai .it .IndexCell ().shapes [0 ]
1629
+ // ABSL_DCHECK(ai->id().contains(bi->id()));
1630
+ aClipped := ai .clipped ()
1630
1631
if aClipped .numEdges () != 0 {
1631
1632
// The current cell of A has at least one edge, so check for crossings.
1632
1633
if l .hasCrossing (ai , bi ) {
@@ -1636,8 +1637,9 @@ func (l *loopCrosser) hasCrossingRelation(ai, bi *rangeIterator) bool {
1636
1637
return false
1637
1638
}
1638
1639
1639
- if containsCenterMatches (aClipped , l .aCrossingTarget ) {
1640
- // The crossing target for A is not satisfied, so we skip over these cells of B.
1640
+ if ! containsCenterMatches (ai .containsCenter (), l .aCrossingTarget ) {
1641
+ // The crossing target for A is not satisfied, so we skip over
1642
+ // these cells of B.
1641
1643
bi .seekBeyond (ai )
1642
1644
ai .next ()
1643
1645
return false
@@ -1647,8 +1649,7 @@ func (l *loopCrosser) hasCrossingRelation(ai, bi *rangeIterator) bool {
1647
1649
// worth iterating through the cells of B to see whether any cell
1648
1650
// centers also satisfy the crossing target for B.
1649
1651
for bi .cellID () <= ai .rangeMax {
1650
- bClipped := bi .it .IndexCell ().shapes [0 ]
1651
- if containsCenterMatches (bClipped , l .bCrossingTarget ) {
1652
+ if containsCenterMatches (bi .containsCenter (), l .bCrossingTarget ) {
1652
1653
return true
1653
1654
}
1654
1655
bi .next ()
@@ -1701,16 +1702,16 @@ func hasCrossingRelation(a, b *Loop, relation loopRelation) bool {
1701
1702
return true
1702
1703
}
1703
1704
} else {
1704
- // The A and B cells are the same. Since the two cells
1705
- // have the same center point P, check whether P satisfies
1706
- // the crossing targets.
1707
- aClipped := ai .it .IndexCell ().shapes [0 ]
1708
- bClipped := bi .it .IndexCell ().shapes [0 ]
1709
- if containsCenterMatches (aClipped , ab .aCrossingTarget ) &&
1710
- containsCenterMatches (bClipped , ab .bCrossingTarget ) {
1705
+ // The A and B cells are the same. Since the two
1706
+ // cells have the same center point P, check
1707
+ // whether P satisfies the crossing targets.
1708
+ if containsCenterMatches (ai .containsCenter (), ab .aCrossingTarget ) &&
1709
+ containsCenterMatches (bi .containsCenter (), ab .bCrossingTarget ) {
1711
1710
return true
1712
1711
}
1713
1712
// Otherwise test all the edge crossings directly.
1713
+ aClipped := ai .clipped ()
1714
+ bClipped := bi .clipped ()
1714
1715
if aClipped .numEdges () > 0 && bClipped .numEdges () > 0 && ab .cellCrossesCell (aClipped , bClipped ) {
1715
1716
return true
1716
1717
}
0 commit comments