Class S2ContainsVertexQuery


  • @GwtCompatible
    public class S2ContainsVertexQuery
    extends java.lang.Object
    This class determines whether a polygon contains one of its vertices given the edges incident to that vertex. The result is +1 if the vertex is contained, -1 if it is not contained, and 0 if the incident edges consist of matched sibling pairs (in which case the result cannot be determined locally).

    The "semi-open" boundary model is used to define point containment. This means that if several polygons tile the region around a vertex, then exactly one of those polygons contains that vertex.

    This class is not thread-safe.

    • Constructor Summary

      Constructors 
      Constructor Description
      S2ContainsVertexQuery​(S2Point target)
      Creates a contains vertex query to determine containment of 'target'.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIncoming​(S2Point v)
      Adds an edge from 'v' incoming to 'target'.
      void addOutgoing​(S2Point v)
      Adds an edge outgoing from 'target' to 'v'.
      int containsSign()
      Returns +1 if the vertex is contained, -1 if it is not contained, and 0 if the incident edges consisted of matched sibling pairs.
      private static int count​(java.util.List<S2Point> vertices, int start)
      Returns the count of vertices equal to vertices[start].
      • Methods inherited from class java.lang.Object

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

      • target

        private final S2Point target
      • outgoing

        private final java.util.List<S2Point> outgoing
      • incoming

        private final java.util.List<S2Point> incoming
    • Constructor Detail

      • S2ContainsVertexQuery

        public S2ContainsVertexQuery​(S2Point target)
        Creates a contains vertex query to determine containment of 'target'.
    • Method Detail

      • addOutgoing

        public void addOutgoing​(S2Point v)
        Adds an edge outgoing from 'target' to 'v'.
      • addIncoming

        public void addIncoming​(S2Point v)
        Adds an edge from 'v' incoming to 'target'.
      • containsSign

        public int containsSign()
        Returns +1 if the vertex is contained, -1 if it is not contained, and 0 if the incident edges consisted of matched sibling pairs.
      • count

        private static int count​(java.util.List<S2Point> vertices,
                                 int start)
        Returns the count of vertices equal to vertices[start].