Package gaiasky.util.svt
Class SVTQuadtree<T>
java.lang.Object
gaiasky.util.svt.SVTQuadtree<T>
-
Field Summary
Modifier and TypeFieldDescriptionAuxiliary object to store additional data.int
Depth of the tree, e.g., the deepest level, in [0,n].com.badlogic.gdx.utils.LongMap<SVTQuadtreeNode<T>>[]
Each tile is identified by its level and its UV.final int
final String
Name of the tree.int
The total number of tiles in the tree.SVTQuadtreeNode<T>[]
Root node(s) of the tree.final int
Size in pixels of each tile. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(int level, int col, int row) int[]
getColRow
(int level, double u, double v) Gets the column and row at the given level (with [0,0] being at the top-left) from the UV texture coordinates, with the origin at the bottom-left.int[]
getColRow
(int level, double u, double v, int[] colRow) long
getKey
(int level, int col, int row) long
getKey
(SVTQuadtreeNode<T> tile) int[]
Get the resolution of this SVT at the most-detailed level.getTile
(int level, int col, int row) Gets a tile in the tree given its level, column and row.getTileFromUV
(int level, double u, double v) Gets a tile given a level and texture coordinates in UV.long
getUTileCount
(int level) double[]
getUV
(int level, int col, int row) Gets the UV texture coordinates from the given column, row and level.double[]
getUV
(int level, int col, int row, double[] uv) long
getVTileCount
(int level) void
-
Field Details
-
MAX_LEVEL
public final int MAX_LEVEL- See Also:
-
name
Name of the tree. -
tileSize
public final int tileSizeSize 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 numTilesThe total number of tiles in the tree. -
depth
public int depthDepth of the tree, e.g., the deepest level, in [0,n]. -
root
Root node(s) of the tree. -
levels
Each tile is identified by its level and its UV. Here we can access tiles directly. -
aux
Auxiliary object to store additional data.
-
-
Constructor Details
-
SVTQuadtree
-
-
Method Details
-
insert
-
getTile
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
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) Gets the column and row at the given level (with [0,0] being at the top-left) from the UV texture coordinates, with the origin at the bottom-left.- Parameters:
level
- The level.u
- The U coordinate.v
- The V coordinate.- Returns:
- The column and row, with the origin at the top-left.
-
getColRow
public int[] getColRow(int level, double u, double v, int[] colRow) -
getUV
public double[] getUV(int level, int col, int row) Gets the UV texture coordinates from the given column, row and level. The UV coordinates start have the origin at the bottom-left, while the column and row have the origin at the top-left.- Parameters:
level
- The level.col
- The column.row
- The row.- Returns:
- The UV coordinates.
-
getUV
public double[] getUV(int level, int col, int row, double[] uv) -
contains
public boolean contains(int level, int col, int row) -
getKey
public long getKey(int level, int col, int row) -
getKey
-
getResolution
public int[] getResolution()Get the resolution of this SVT at the most-detailed level.- Returns:
- The resolution at the most detailed level.
-