20 #ifndef STELTOASTGRID_HPP 21 #define STELTOASTGRID_HPP 24 #include "VecMath.hpp" 27 inline int pow2(
int x) {
return 1 << x;}
44 QVector<Vec3d>
getVertexArray(
int level,
int x,
int y,
int resolution)
const;
51 QVector<Vec2f>
getTextureArray(
int level,
int x,
int y,
int resolution)
const;
57 QVector<unsigned short>
getTrianglesIndex(
int level,
int x,
int y,
int resolution)
const;
62 QVector<Vec3d>
getPolygon(
int level,
int x,
int y)
const;
68 const Vec3d& at(
int x,
int y)
const {
return grid[y * size + x];}
70 Vec3d& at(
int x,
int y) {
return grid[y * size + x];}
72 const Vec3d& at(
int level,
int x,
int y)
const 73 {
int scale = pow2(maxLevel - level);
return at(scale * x, scale * y);}
75 Vec3d& at(
int level,
int x,
int y)
76 {
int scale = pow2(maxLevel - level);
return at(scale * x, scale * y);}
80 void init_grid(
int level,
int x,
int y,
bool side);
90 #endif // STELTOASTGRID_HPP QVector< unsigned short > getTrianglesIndex(int level, int x, int y, int resolution) const
Get the index of the vertex from getVertexArray sorted as a list of triangles.
QVector< Vec3d > getPolygon(int level, int x, int y) const
Returns the polygon contouring a given tile.
int getMaxLevel() const
Return the max TOAST level of this grid.
Convenience class that can be used to compute the TOAST grid points.
QVector< Vec2f > getTextureArray(int level, int x, int y, int resolution) const
Get the texture array for a given tile.
QVector< Vec3d > getVertexArray(int level, int x, int y, int resolution) const
Get the vertex array for a given tile.