ts-scikit
Version:
A scientific toolkit written in Typescript
105 lines (104 loc) • 4.47 kB
TypeScript
export declare class UnitSphereSampling {
private static readonly ALMOST_ONE;
private readonly _nbits;
private _npoint;
private _mindex;
private _nindex;
private _m;
private _n;
private _d;
private _od;
private _pu;
private _pl;
private _ip;
constructor(nbits?: number);
get countSamples(): number;
get maxIndex(): number;
private _init;
/**
* Gets an array { ia, ib, ic } of three sample indices for the spherical
* triangle that contains the specified point.
* <p>
* As viewed from outside the sphere, the sampled points corresponding to
* the returned indices are ordered counter-clockwise.
* @param array array { x, y, z } of point coordinates.
* @returns array of sample indices.
*/
getTriangle(array: number[]): number[];
/**
* Gets an array { ia, ib, ic } of three sample indices for the spherical
* triangle that contains the specified point.
* <p>
* As viewed from outside the sphere, the sampled points corresponding to
* the returned indices are ordered counter-clockwise.
* @param x x-coordinate of the point.
* @param y y-coordinate of the point.
* @param z z-coordinate of the point.
* @returns array of sample indices.
*/
getTriangle(x: number, y: number, z: number): number[];
/**
* Gets an array { wa, wb, wc } of three weights for a point in a spherical
* triangle specified by sample indices of three points.
* <p>
* The weights are proportional to volumes of tetrahedra, and are used for
* interpolation. Weights are non-negative and normalized so that their
* sum wa + wb + wc = 1.
* <p>
* For example, let p denote the specified point with coordinates { x, y, z },
* and let o denote the center of the sphere with coordinates { 0, 0, 0 }.
* Then the weight wa is proportional to the volume of the tetrahedron
* formed by points p, b, c, and o.
* @param array an array { x, y, z } containing point coordinates.
* @param iabc array { ia, ib, ic } of sample indices.
* @returns array { wa, wb, wc } of weights.
*/
getWeights(array: number[], iabc: number[]): number[];
/**
* Gets an array { wa, wb, wc } of three weights for a point in a spherical
* triangle specified by sample indices of three points.
* <p>
* The weights are proportional to volumes of tetrahedra, and are used for
* interpolation. Weights are non-negative and normalized so that their
* sum wa + wb + wc = 1.
* <p>
* For example, let p denote the specified point with coordinates { x, y, z },
* and let o denote the center of the sphere with coordinates { 0, 0, 0 }.
* Then the weight wa is proportional to the volume of the tetrahedron
* formed by points p, b, c, and o.
* @param x x-coordinate of the point.
* @param y y-coordinate of the point.
* @param z z-coordinate of the point.
* @param iabc array { ia, ib, ic } of sample indices.
* @returns array { wa, wb, wc } of weights.
*/
getWeights(x: number, y: number, z: number, iabc: number[]): number[];
/**
* Gets the index of the sampled point nearest to the specified point.
* <p>
* Here, the nearest sampled point is that nearest on the octahedron.
* Returns a positive index for points in the upper hemisphere (z >= 0),
* including points on the equator (z = 0). Returns a negative index for
* points in the lower hemisphere not on the equator (z < 0).
* @param array an array of coordinates.
* @returns the sample index.
*/
getIndex(array: number[]): number;
/**
* Gets the index of the sampled point nearest to the specified point.
* @param x x-coordinate of the point.
* @param y y-coordinate of the point.
* @param z z-coordinate of the point.
* @returns the sample index.
*/
getIndex(x: number, y: number, z: number): number;
/**
* Gets the sampled point for the specified index, which must be non-zero.
* <p>
* For efficiency, returns the array { x, y, z } of point coordinates
* by reference, not by copy. These coordinates must not be modified.
* @param index the index of the sampled point; must be non-zero.
* @returns array { x, y, z } of point coordinates; by reference, not by copy.
*/
getPoint(index: number): number[];
}