Class S2ContainsVertexQuery

java.lang.Object
com.google.common.geometry.S2ContainsVertexQuery

@GwtCompatible public class S2ContainsVertexQuery extends 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.

  • Field Details

  • Constructor Details

    • S2ContainsVertexQuery

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

    • 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(List<S2Point> vertices, int start)
      Returns the count of vertices equal to vertices[start].