Class S2EdgeUtil.LongitudePruner

  • Enclosing class:
    S2EdgeUtil

    public static class S2EdgeUtil.LongitudePruner
    extends java.lang.Object
    The purpose of this class is to find edges that intersect a given longitude interval. It can be used as an efficient rejection test when attempting to find edges that intersect a given region. It accepts a vertex chain v0, v1, v2, ... and returns a boolean value indicating whether each edge intersects the specified longitude interval.

    This class is not currently used as the XYZPruner is preferred for S2Loop, but this should be usable in similar circumstances. Be wary of the cost of atan2() in conversions from S2Point to longitude!

    • Constructor Summary

      Constructors 
      Constructor Description
      LongitudePruner​(S1Interval interval, S2Point v0)
      'interval' is the longitude interval to be tested against, and 'v0' is the first vertex of edge chain.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean intersects​(S2Point v1)
      Returns true if the edge (v0, v1) intersects the given longitude interval, and then saves 'v1' to be used as the next 'v0'.
      • Methods inherited from class java.lang.Object

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

      • lng0

        private double lng0
    • Constructor Detail

      • LongitudePruner

        public LongitudePruner​(S1Interval interval,
                               S2Point v0)
        'interval' is the longitude interval to be tested against, and 'v0' is the first vertex of edge chain.
    • Method Detail

      • intersects

        public boolean intersects​(S2Point v1)
        Returns true if the edge (v0, v1) intersects the given longitude interval, and then saves 'v1' to be used as the next 'v0'.