Class S2Loop.CompareBoundaryRelation

java.lang.Object
com.google.common.geometry.S2Loop.CompareBoundaryRelation
All Implemented Interfaces:
S2Loop.LoopRelation
Enclosing class:
S2Loop

private static final class S2Loop.CompareBoundaryRelation extends Object implements S2Loop.LoopRelation
Loop relation for compareBoundary().
  • Field Details

    • bReversed

      private final boolean bReversed
      True if loop B should be reversed.
    • foundSharedVertex

      private boolean foundSharedVertex
      True if any wedge was processed.
    • containsEdge

      private boolean containsEdge
      True if any edge of B is contained by A.
    • excludesEdge

      private boolean excludesEdge
      True if any edge of B is excluded by A.
  • Constructor Details

    • CompareBoundaryRelation

      public CompareBoundaryRelation(boolean reverseB)
  • Method Details

    • foundSharedVertex

      public boolean foundSharedVertex()
    • containsEdge

      public boolean containsEdge()
    • aCrossingTarget

      public int aCrossingTarget()
      The CompareBoundaryRelation does not have a useful early-exit condition, so we return -1 for both crossing targets.

      Aside: A possible early exit condition could be based on the following:

      • If A contains a point of both B and ~B, then A intersects Boundary(B).
      • If ~A contains a point of both B and ~B, then ~A intersects Boundary(B).
      • So if the intersections of {A, ~A} with {B, ~B} are all non-empty, the return value is 0, i.e., Boundary(A) intersects Boundary(B).
      Unfortunately, it isn't worth detecting this situation because by the time we have seen a point in all four intersection regions, we are also guaranteed to have seen at least one pair of crossing edges.
      Specified by:
      aCrossingTarget in interface S2Loop.LoopRelation
    • bCrossingTarget

      public int bCrossingTarget()
      Specified by:
      bCrossingTarget in interface S2Loop.LoopRelation
    • wedgesCross

      public boolean wedgesCross(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2)
      Description copied from interface: S2Loop.LoopRelation
      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.
      Specified by:
      wedgesCross in interface S2Loop.LoopRelation