s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
181 lines • 6.24 kB
TypeScript
import type { LonLat } from '../ll';
import type { BBox, Face, Point, Point3D } from '../';
export declare const K_LIMIT_IJ = 1073741824;
/**
* Convert a [0, 1] to a [-1, 1] in a linear fashion
* @param s - input S or T coordinate
* @returns output U or V coordinate
*/
export declare function linearSTtoUV(s: number): number;
/**
* Convert a [-1, 1] to a [0, 1] in a linear fashion
* @param u - input U or V coordinate
* @returns output S or T coordinate
*/
export declare function linearUVtoST(u: number): number;
/**
* Convert a [0, 1] to a [-1, 1] in a tangential fashion
* @param s - input S or T coordinate
* @returns output U or V coordinate
*/
export declare function tanSTtoUV(s: number): number;
/**
* Convert a [-1, 1] to a [0, 1] in a tangential fashion
* @param u - input U or V coordinate
* @returns output S or T coordinate
*/
export declare function tanUVtoST(u: number): number;
/**
* Convert a [0, 1] to a [-1, 1] in a quadratic fashion
* @param s - input S or T coordinate
* @returns output U or V coordinate
*/
export declare function quadraticSTtoUV(s: number): number;
/**
* Convert a [-1, 1] to a [0, 1] in a quadratic fashion
* @param u - input U or V coordinate
* @returns output S or T coordinate
*/
export declare function quadraticUVtoST(u: number): number;
/**
* Convert from st space to ij space (ij are whole numbers ranging an entire u30)
* @param s - input S or T
* @returns output I or J
*/
export declare function STtoIJ(s: number): number;
/**
* Convert from ij space to st space (ij are whole numbers ranging an entire u30)
* @param i - input I or J
* @returns output S or T
*/
export declare function IJtoST(i: number): number;
/**
* Convert SiTi to ST.
* @param si - input Si or Ti
* @returns output S or T
*/
export declare function SiTiToST(si: number): number;
/**
* Convert a face-u-v coords to left-hand-rule XYZ Point coords
* @param face - input face
* @param u - input u
* @param v - input v
* @returns output
*/
export declare function faceUVtoXYZ(face: Face, u: number, v: number): Point3D;
/**
* Convert a face-u-v coords to right-hand-rule XYZ Point coords
* @param face - input face
* @param u - input u
* @param v - input v
* @returns output
*/
export declare function faceUVtoXYZGL(face: Face, u: number, v: number): Point3D;
/**
* Convert from a face and left-hand-rule XYZ Point to u-v coords
* @param face - input face
* @param xyz - input
* @returns output
*/
export declare function faceXYZtoUV(face: Face, xyz: Point3D): [u: number, v: number];
/**
* Find the face the point is located at
* @param xyz - point3D input
* @returns - outputs the associated face
*/
export declare function XYZtoFace(xyz: Point3D): Face;
/**
* Convert from an left-hand-rule XYZ Point to a Face-U-V coordinate
* @param xyz - point3D input
* @returns output's a face, u, and v
*/
export declare function XYZtoFaceUV(xyz: Point3D): [face: Face, u: number, v: number];
/**
* Convert from a face and right-hand-rule XYZ Point to u-v coords
* @param face - input face
* @param xyz - input Point3D
* @returns output WebGL oriented UV coords
*/
export declare function faceXYZGLtoUV(face: number, xyz: Point3D): [u: number, v: number];
/**
* Convert from an left-hand-rule XYZ Point to a lon-lat coord
* @param xyz - point3D input
* @returns - lon-lat coordinates
*/
export declare function xyzToLonLat(xyz: Point3D): LonLat;
/**
* Convert from a lon-lat coord to an left-hand-rule XYZ Point
* @param lon - longitude
* @param lat - latitude
* @returns - Point3D
*/
export declare function lonLatToXYZ(lon: number, lat: number): Point3D;
/**
* Convert from a lon-lat coord to an right-hand-rule XYZ Point
* @param lon - longitude
* @param lat - latitude
* @returns - WebGL oriented Point3D
*/
export declare function lonLatToXYZGL(lon: number, lat: number): Point3D;
/**
* Convert an u-v-zoom coordinate to a tile coordinate
* @param u - u coordinate
* @param v - v coordinate
* @param zoom - zoom level
* @returns - tile X-Y coordinate
*/
export declare function tileXYFromUVZoom(u: number, v: number, zoom: number): Point;
/**
* Convert an x-y-zoom coordinate to a tile coordinate
* @param x - x coordinate
* @param y - y coordinate
* @param zoom - zoom level
* @returns - tile X-Y coordinate
*/
export declare function tileXYFromSTZoom(x: number, y: number, zoom: number): Point;
/**
* Given a quad-based tile schema of "zoom-x-y", get the local UV bounds of said tile.
* @param u - u coordinate
* @param v - v coordinate
* @param zoom - zoom level
* @returns - local UV bounds for the tile
*/
export declare function bboxUV(u: number, v: number, zoom: number): BBox;
/**
* Given a quad-based tile schema of "zoom-x-y", get the local ST bounds of said tile.
* @param s - s coordinate
* @param t - t coordinate
* @param zoom - zoom level
* @returns - local ST bounds for the tile
*/
export declare function bboxST(s: number, t: number, zoom: number): BBox;
/**
* Find the face-i-j coordinates of neighbors for a specific face-i-j coordinate.
* Define an adjusted level (zoom) for the i-j coordinates. The level is 30 by default.
* @param face - face of the cell
* @param i - i coordinate
* @param j - j coordinate
* @param level - zoom level
* @returns - Face-i-j coordinates
*/
export declare function neighborsIJ(face: Face, i: number, j: number, level?: number): [face: Face, i: number, j: number][];
/**
* Return the right-handed normal (not necessarily unit length) for an
* edge in the direction of the positive v-axis at the given u-value on
* the given face. (This vector is perpendicular to the plane through
* the sphere origin that contains the given edge.)
* @param face - face
* @param u - u
* @returns - the 3D vector normal relative to the u
*/
export declare function getUNorm(face: Face, u: number): Point3D;
/**
* Return the right-handed normal (not necessarily unit length) for an
* edge in the direction of the positive u-axis at the given v-value on
* the given face.
* @param face - face
* @param v - v
* @returns - the 3D vector normal relative to the v
*/
export declare function getVNorm(face: Face, v: number): Point3D;
//# sourceMappingURL=coords.d.ts.map