Class S2ShapeIndex.Options

java.lang.Object
com.google.common.geometry.S2ShapeIndex.Options
All Implemented Interfaces:
Serializable
Enclosing class:
S2ShapeIndex

public static class S2ShapeIndex.Options extends Object implements Serializable
Options that affect construction of the S2ShapeIndex.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • maxEdgesPerCell

      private int maxEdgesPerCell
    • cellSizeToLongEdgeRatio

      private double cellSizeToLongEdgeRatio
  • Constructor Details

    • Options

      public Options()
  • Method Details

    • getMaxEdgesPerCell

      public int getMaxEdgesPerCell()
      Returns the maximum number of edges per cell (default 10.) If a cell has more than this many edges that are "long" relative to the cell size, and it is not a leaf cell, then it is subdivided. Whether an edge is considered "long" is controlled by the value returned by getCellSizeToLongEdgeRatio().
    • setMaxEdgesPerCell

      public void setMaxEdgesPerCell(int maxEdgesPerCell)
      Sets the new number of max edges per cell. Only has an effect during index construction, usually triggered by calling S2ShapeIndex.iterator().
    • getCellSizeToLongEdgeRatio

      public double getCellSizeToLongEdgeRatio()
      Returns the cell size relative to the length of an edge at which it is first considered to be "long" (default is 1.0). Long edges do not contribute toward the decision to subdivide a cell further. The size and speed of the index are typically not very sensitive to this parameter. Reasonable values range from 0.1 to 10, with smaller values causing more aggressive subdivision of long edges grouped closely together. For example, a value of 2.0 means that the cell must be at least twice the size of the edge in order for that edge to be counted. There are two reasons for not counting long edges:
      1. Such edges typically need to be propagated to several children, which increases time and memory costs without much benefit, and
      2. In pathological cases, many long edges close together could force subdivision to continue all the way to the leaf cell level.
    • setCellSizeToLongEdgeRatio

      public void setCellSizeToLongEdgeRatio(double cellSizeToLongEdgeRatio)
      Sets the new ratio of cell size to long edges. Only has an effect during index construction, usually triggered by calling S2ShapeIndex.iterator().