47 lines
1.8 KiB
TypeScript
47 lines
1.8 KiB
TypeScript
import { Feature, Polygon } from "@turf/helpers";
|
|
/**
|
|
* Returns the direction of the point q relative to the vector p1 -> p2.
|
|
*
|
|
* Implementation of geos::algorithm::CGAlgorithm::orientationIndex()
|
|
* (same as geos::algorithm::CGAlgorithm::computeOrientation())
|
|
*
|
|
* @param {number[]} p1 - the origin point of the vector
|
|
* @param {number[]} p2 - the final point of the vector
|
|
* @param {number[]} q - the point to compute the direction to
|
|
*
|
|
* @returns {number} - 1 if q is ccw (left) from p1->p2,
|
|
* -1 if q is cw (right) from p1->p2,
|
|
* 0 if q is colinear with p1->p2
|
|
*/
|
|
export declare function orientationIndex(p1: number[], p2: number[], q: number[]): number;
|
|
/**
|
|
* Checks if two envelopes are equal.
|
|
*
|
|
* The function assumes that the arguments are envelopes, i.e.: Rectangular polygon
|
|
*
|
|
* @param {Feature<Polygon>} env1 - Envelope
|
|
* @param {Feature<Polygon>} env2 - Envelope
|
|
* @returns {boolean} - True if the envelopes are equal
|
|
*/
|
|
export declare function envelopeIsEqual(env1: Feature<Polygon>, env2: Feature<Polygon>): boolean;
|
|
/**
|
|
* Check if a envelope is contained in other one.
|
|
*
|
|
* The function assumes that the arguments are envelopes, i.e.: Convex polygon
|
|
* XXX: Envelopes are rectangular, checking if a point is inside a rectangule is something easy,
|
|
* this could be further improved.
|
|
*
|
|
* @param {Feature<Polygon>} self - Envelope
|
|
* @param {Feature<Polygon>} env - Envelope
|
|
* @returns {boolean} - True if env is contained in self
|
|
*/
|
|
export declare function envelopeContains(self: Feature<Polygon>, env: Feature<Polygon>): boolean;
|
|
/**
|
|
* Checks if two coordinates are equal.
|
|
*
|
|
* @param {number[]} coord1 - First coordinate
|
|
* @param {number[]} coord2 - Second coordinate
|
|
* @returns {boolean} - True if coordinates are equal
|
|
*/
|
|
export declare function coordinatesEqual(coord1: number[], coord2: number[]): boolean;
|