Class S2ShapeIndex.FaceEdge

java.lang.Object
com.google.common.geometry.S2ShapeIndex.FaceEdge
Enclosing class:
S2ShapeIndex

private static final class S2ShapeIndex.FaceEdge extends Object
FaceEdge stores temporary edge data while the index is being updated. FaceEdge represents an edge in the UV coordinates of a specific face, without any clipping. ClippedEdge, by comparison, contains the UV bound of the portion of the edge that intersects each cell.

While it would be possible to combine all the edge information into ClippedEdge, there will be many clipped edges for each original face edge, and only the UV bound is different. Keeping the shared fields on this separate class provides two advantages:

  • Memory usage. Separating the two classes means that we only need to store one copy of the per-face data no matter how many times an edge is subdivided, and it also lets us delay computing bounding boxes until they are needed for processing each face (when the dataset spans multiple faces).
  • Performance. UpdateEdges is significantly faster on large polygons when the data is separated, because it often only needs to access the data in ClippedEdge and this data is cached more successfully.
  • Field Details

    • shapeId

      private final int shapeId
      The shape that this edge belongs to.
    • edgeId

      private final int edgeId
      Edge id within that shape.
    • maxLevel

      private final int maxLevel
      Not desirable to subdivide this edge beyond this level.
    • ax

      private final double ax
      The edge endpoints, clipped to a given face. .
    • ay

      private final double ay
    • bx

      private final double bx
    • by

      private final double by
    • va

      private final S2Point va
      The corresponding S2Points, cached here to avoid repeated calls to S2Shape.getEdge(int, com.google.common.geometry.S2Shape.MutableEdge).
    • vb

      private final S2Point vb
  • Constructor Details

  • Method Details