Class S2Loop.CompareBoundaryRelation

  • All Implemented Interfaces:
    S2Loop.LoopRelation
    Enclosing class:
    S2Loop

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

      Fields 
      Modifier and Type Field Description
      private boolean bReversed
      True if loop B should be reversed.
      private boolean containsEdge
      True if any edge of B is contained by A.
      private boolean excludesEdge
      True if any edge of B is excluded by A.
      private boolean foundSharedVertex
      True if any wedge was processed.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int aCrossingTarget()
      The CompareBoundaryRelation does not have a useful early-exit condition, so we return -1 for both crossing targets.
      int bCrossingTarget()  
      boolean containsEdge()  
      boolean foundSharedVertex()  
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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 Detail

      • CompareBoundaryRelation

        public CompareBoundaryRelation​(boolean reverseB)
    • Method Detail

      • 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
      • 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