Interface S2Loop.LoopRelation

All Known Implementing Classes:
S2Loop.CompareBoundaryRelation, S2Loop.ContainsRelation, S2Loop.IntersectsRelation
Enclosing class:
S2Loop

private static interface S2Loop.LoopRelation
A relation between two loops (e.g. Contains, Intersects, or CompareBoundary.)
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Optionally, aCrossingTarget and bCrossingTarget can specify an early-exit condition for the loop relation.
    int
     
    boolean
    wedgesCross(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2)
    Given a vertex ab1 that is shared between the two loops, returns true if the two associated wedges (a0, ab1, b2) and (b0, ab1, b2) are equivalent to an edge crossing.
  • Method Details

    • aCrossingTarget

      int aCrossingTarget()
      Optionally, aCrossingTarget and bCrossingTarget can specify an early-exit condition for the loop relation. If any point P is found such that

      aCrossingTarget == (a.contains(P) ? 1 : 0) && bCrossingTarget == (b.contains(P) ? 1 : 0)

      then the loop relation is assumed to be the same as if a pair of crossing edges were found. For example, the contains() relation has

      aCrossingTarget() == 0 bCrossingTarget() == 1

      because if !a.contains(P) and b.contains(P) for any point P, then it is equivalent to finding an edge crossing (i.e., since contains() returns false in both cases).

      Loop relations that do not have an early-exit condition of this form should return -1 for both crossing targets.

    • bCrossingTarget

      int bCrossingTarget()
    • wedgesCross

      boolean wedgesCross(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2)
      Given a vertex ab1 that is shared between the two loops, returns true if the two associated wedges (a0, ab1, b2) and (b0, ab1, b2) are equivalent to an edge crossing. The loop relation is also allowed to maintain its own internal state, and can return true if it observes any sequence of wedges that are equivalent to an edge crossing.