Class S2EdgeUtil.XYZPruner

  • Enclosing class:
    S2EdgeUtil

    public static class S2EdgeUtil.XYZPruner
    extends java.lang.Object
    The purpose of this class is to find edges that intersect a given XYZ bounding box. 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 bounding box.

    We use XYZ intervals instead of something like longitude intervals because it is cheap to collect from S2Point lists and any slicing strategy should give essentially equivalent results. See S2Loop for an example of use.

    • Constructor Summary

      Constructors 
      Constructor Description
      XYZPruner()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEdgeToBounds​(S2Point from, S2Point to)
      Accumulate a bounding rectangle from provided edges.
      boolean intersects​(S2Point v1)
      Returns true if the edge going from the last point to this point passes through the pruner bounding box, otherwise returns false.
      void setFirstIntersectPoint​(S2Point v0)  
      • Methods inherited from class java.lang.Object

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

      • lastVertex

        private S2Point lastVertex
      • boundSet

        private boolean boundSet
      • xmin

        private double xmin
      • ymin

        private double ymin
      • zmin

        private double zmin
      • xmax

        private double xmax
      • ymax

        private double ymax
      • zmax

        private double zmax
      • maxDeformation

        private double maxDeformation
    • Constructor Detail

      • XYZPruner

        public XYZPruner()
    • Method Detail

      • addEdgeToBounds

        public void addEdgeToBounds​(S2Point from,
                                    S2Point to)
        Accumulate a bounding rectangle from provided edges.
        Parameters:
        from - start of edge
        to - end of edge.
      • setFirstIntersectPoint

        public void setFirstIntersectPoint​(S2Point v0)
      • intersects

        public boolean intersects​(S2Point v1)
        Returns true if the edge going from the last point to this point passes through the pruner bounding box, otherwise returns false. So the method returns false if we are certain there is no intersection, but it may return true when there turns out to be no intersection.