Class SVTQuadtree<T>

java.lang.Object
gaiasky.util.svt.SVTQuadtree<T>

public class SVTQuadtree<T> extends Object
  • Field Details

    • MAX_LEVEL

      public final int MAX_LEVEL
      See Also:
    • name

      public final String name
      Name of the tree.
    • tileSize

      public final int tileSize
      Size in pixels of each tile. Tiles are square, so width and height are equal. The tile size is a power of two, capping at 1024. One of 8, 16, 32, 64, 128, 256, 512 or 1024.
    • numTiles

      public int numTiles
      The total number of tiles in the tree.
    • depth

      public int depth
      Depth of the tree, e.g., the deepest level, in [0,n].
    • root

      public SVTQuadtreeNode<T>[] root
      Root node(s) of the tree.
    • levels

      public com.badlogic.gdx.utils.LongMap<SVTQuadtreeNode<T>>[] levels
      Each tile is identified by its level and its UV. Here we can access tiles directly.
    • aux

      public Object aux
      Auxiliary object to store additional data.
  • Constructor Details

    • SVTQuadtree

      public SVTQuadtree(String name, int tileSize, int rootPositions)
  • Method Details

    • insert

      public void insert(int level, int col, int row, T object)
    • getTile

      public SVTQuadtreeNode<T> getTile(int level, int col, int row)
      Gets a tile in the tree given its level, column and row.
      Parameters:
      level - The level.
      col - The column.
      row - The row.
      Returns:
      The tile with the given level, column and row, if it exists.
    • getTileFromUV

      public SVTQuadtreeNode<T> getTileFromUV(int level, double u, double v)
      Gets a tile given a level and texture coordinates in UV.
      Parameters:
      level - The level.
      u - The U texture coordinate in [0,1].
      v - The V texture coordinate in [0,1].
      Returns:
      The tile at the given level and UV.
    • getUTileCount

      public long getUTileCount(int level)
    • getVTileCount

      public long getVTileCount(int level)
    • getColRow

      public int[] getColRow(int level, double u, double v)
    • getUV

      public double[] getUV(int level, int col, int row)
    • contains

      public boolean contains(int level, int col, int row)
    • getKey

      public long getKey(int level, int col, int row)
    • getKey

      public long getKey(SVTQuadtreeNode<T> tile)
    • getResolution

      public int[] getResolution()
      Get the resolution of this SVT at the most-detailed level.
      Returns:
      The resolution at the most detailed level.