import type { S1Angle } from '../s1/angle'; import type { S1ChordAngle } from '../s1/chordAngle'; import type { Point3D, S2CellId, Vertices } from '../'; /** * S2Cap represents a disc-shaped region defined by a center and radius. * Technically this shape is called a "spherical cap" (rather than disc) * because it is not planar; the cap represents a portion of the sphere that * has been cut off by a plane. The boundary of the cap is the circle defined * by the intersection of the sphere and the plane. For containment purposes, * the cap is a closed set, i.e. it contains its boundary. * * For the most part, you can use a spherical cap wherever you would use a * disc in planar geometry. The radius of the cap is measured along the * surface of the sphere (rather than the straight-line distance through the * interior). Thus a cap of radius Pi/2 is a hemisphere, and a cap of radius * Pi covers the entire sphere. * * A cap can also be defined by its center point and height. The height is * simply the distance from the center point to the cutoff plane. There is * also support for empty and full caps, which contain no points and all * points respectively. * * This class is intended to be copied by value as desired. It uses the * default copy constructor and assignment operator, however it is not a * "plain old datatype" (POD) because it has virtual functions. * * Here are some useful relationships between the cap height (h), the cap * radius (r), the maximum chord length from the cap's center (d), and the * radius of cap's base (a). * * h = 1 - cos(r) * = 2 * sin^2(r/2) * d^2 = 2 * h * = a^2 + h^2 */ export interface S2Cap { /** the center of the cap */ center: Point3D; /** the radius of the cap */ radius: S1ChordAngle; /** the data associated with the cap */ data: T; } /** * Return an empty cap, i.e. a cap that contains no points. * @param data - the data * @returns - the empty cap */ export declare function emptyCap(data: T): S2Cap; /** * Return a full cap, i.e. a cap that contains all points. * @param data - the data * @returns - the full cap */ export declare function fullCap(data: T): S2Cap; /** * Return the area of the cap. * @param cap - the cap * @returns - the area */ export declare function getArea(cap: S2Cap): number; /** * Return true if the cap is empty, i.e. it contains no points. * @param cap - the cap * @returns - true if the cap is empty */ export declare function isEmpty(cap: S2Cap): boolean; /** * Return true if the cap is full, i.e. it contains all points. * @param cap - the cap * @returns - true if the cap is full */ export declare function isFull(cap: S2Cap): boolean; /** * Returns the height of the cap, i.e. the distance from the center point to * the cutoff plane. * @param cap - the cap * @returns - the height */ export declare function height(cap: S2Cap): number; /** * Constructs a cap with the given center and radius. A negative radius * yields an empty cap; a radius of 180 degrees or more yields a full cap * (containing the entire sphere). "center" should be unit length. * @param center - the center point * @param radius - the radius * @param data - the data * @returns - the cap */ export declare function fromS1Angle(center: Point3D, radius: S1Angle, data: T): S2Cap; /** * Constructs a cap where the angle is expressed as an S1ChordAngle. This * constructor is more efficient than the one above. * @param center - the center * @param radius - the radius * @param data - the data * @returns - the cap */ export declare function fromS1ChordAngle(center: Point3D, radius: S1ChordAngle, data: T): S2Cap; /** * Convenience function that creates a cap containing a single point. This * method is more efficient that the S2Cap(center, radius) constructor. * @param center - the center * @param data - the data * @returns - an empty cap */ export declare function fromS2Point(center: Point3D, data: T): S2Cap; /** * Return the cap radius as an S1Angle. (Note that the cap angle is stored * internally as an S1ChordAngle, so this method requires a trigonometric * operation and may yield a slightly different result than the value passed * to the (S2Point, S1Angle) constructor.) * @param cap - the cap * @returns - the radius as an S1Angle in radians */ export declare function radius(cap: S2Cap): S1Angle; /** * Returns true if the cap contains the given point. * NOTE: The point "p" should be a unit-length vector. * @param cap - the cap * @param p - the point * @returns - true if the cap contains the point */ export declare function containsS2Point(cap: S2Cap, p: Point3D): boolean; /** * Return the complement of the interior of the cap. A cap and its * complement have the same boundary but do not share any interior points. * The complement operator is not a bijection because the complement of a * singleton cap (containing a single point) is the same as the complement * of an empty cap. * @param cap - the cap * @returns - the complement */ export declare function complement(cap: S2Cap): S2Cap; /** * Return true if the cap contains the given cell. * @param cap - the cap * @param cell - the cell * @returns - true if the cap contains the cell */ export declare function containsS2CellVertexCount(cap: S2Cap, cell: S2CellId): number; /** * Return true if the cap contains the given cell. * @param cap - the cap * @param cell - the cell * @returns - true if the cap contains the cell */ export declare function containsS2Cell(cap: S2Cap, cell: S2CellId): boolean; /** * Return true if the cap intersects "cell", given that the cap does intersect * any of the cell vertices or edges. * @param cap - the cap * @param cell - the cell * @returns - true if the cap intersects the cell */ export declare function intersectsS2CellFast(cap: S2Cap, cell: S2CellId): boolean; /** * Return true if the cap intersects "cell", given that the cap does contain * any of the cell vertices (supplied in "vertices", an array of length 4). * Return true if this cap intersects any point of 'cell' excluding its * vertices (which are assumed to already have been checked). * @param cap - the cap * @param cell - the cell * @param vertices - the vertices of the cell * @returns - true if the cap intersects the cell */ export declare function intersectsS2Cell(cap: S2Cap, cell: S2CellId, vertices: Vertices): boolean; /** * @param cap - the cap * @returns - the cells that intersect the cap */ export declare function getIntersectingCells(cap: S2Cap): S2CellId[]; //# sourceMappingURL=cap.d.ts.map