import Position from './Position'; export type PointJson = { x: number; y: number; z?: number; }; export type PointArray = [number, number] | [number, number, number]; export type PointLike = Point | PointJson | PointArray; /** * 2D 点实现 * @english * Represents a 2d point.
* Can be created in serveral ways: * * @example * * ```ts * * var point = new Point(1000, 1000); * * var point = new Point([1000, 1000]); * * var point = new Point({ x:1000, y:1000 }); * ``` * * @category basic types */ declare class Point extends Position { arrowPrePoint?: Point; arrowNextPoint?: Point; distance?: number; /** * 使用差值与另一个点进行比较,判断是否临近 * * @english * * Compare with another point with a delta * @param p * @param delta */ closeTo(p: Point, delta?: number): boolean; /** * 计算对应的单位向量 * 这意味着计算点到[0, 0]坐标的距离将等于1,并且从计算点到[0, 0]坐标的角度与之前相同 * @english * * Calculate this point but as a unit vector from 0, 0, meaning * that the distance from the resulting point to the 0, 0 * coordinate will be equal to 1 and the angle from the resulting * point to the 0, 0 coordinate will be the same as before. * @returns unit vector point */ unit(): Point; _unit(): this; /** * 计算一个垂直点,其中新的y坐标是旧的x坐标,而新的x坐标是旧的y坐标乘以-1。 * * @english * * Compute a perpendicular point, where the new y coordinate * is the old x coordinate and the new x coordinate is the old y * coordinate multiplied by -1 * @returns perpendicular point */ perp(): Point; _perp(): this; /** * 获取这个点与另一个点之间的角度,单位为弧度 * * @english * * Get the angle between this point and another point, in radians * from mapbox/point-geometry * @param b - the other point * @returns angle */ angleWith(b: Point): number; /** * 找到两个向量之间的角度 * * @english * * Find the angle of the two vectors, solving the formula for * the cross product a x b = |a||b|sin(θ) for θ. * from mapbox/point-geometry * * @param x the x-coordinate * @param y the y-coordinate * @returns the angle in radians */ angleWithSep(x: number, y: number): number; _rotate(angle: number): this; /** * 围绕0,0原点旋转这个点,旋转角度a以弧度为单位 * * @english * * Rotate this point around the 0, 0 origin by an angle a, * given in radians * from mapbox/point-geometry * * @param a angle to rotate around, in radians * @returns output point */ rotate(a: number): Point; /** * 返回该点绝对值的 `Point` 对象(不会改变原始数据) * * @english * * Return abs value of the point * @returns abs point */ abs(): Point; /** * 类似于数学中的四舍五入,对点的 x 和 y 坐标进行舍入,返回一个新 Point * * @english * * Like math.round, rounding the point's xy. * @returns rounded point */ round(): Point; /** * 对点的 x 和 y 坐标向上取整,返回一个新 Point * * @english * * Like math.ceil, ceil the point's xy. * @returns ceiled point */ ceil(): Point; /** * 对点的 x 和 y 坐标向下取整,返回一个新 Point * * @english * * Like math.floor, floor the point's xy. * @returns floored point */ floor(): Point; /** * 返回当前点的 copy * * @english * * Returns a copy of the point * @returns copy */ copy(): Point; /** * 坐标数字保留指定位数的小数 * * @english * * Formats point number using fixed-point notation. * @param n - The number of digits to appear after the decimal point * @returns fixed point */ toFixed(n: number): Point; /** * 与传入坐标相加,返回一个新 Point * * @english * * Returns the result of addition of another coordinate. * @param x - point to add * @returns result */ add(x: PointLike): Point; /** * 与传入坐标相加,返回一个新 Point * * @english * * Returns the result of addition of another coordinate. * @param x - point to add * @param y - point to add * @returns result */ add(x: number, y: number): Point; /** * 与传入坐标相减,返回一个新 Point。 * * @english * * Returns the result of subtraction of another point. * @param x - point to add * @returns result */ sub(x: PointLike): Point; /** * 与传入坐标相减,返回一个新 Point。 * * @english * * Returns the result of subtraction of another point. * @param x - point to add * @param y - point to add * @returns result */ sub(x: number, y: number): Point; /** * Returns the result of multiplication of the current coordinate by the given number. * @param ratio - ratio to multi * @returns result */ multi(ratio: number): Point; /** * 与另外一个 point 进行比较,以查看它们是否相等 * * @english * * Compare with another point to see whether they are equal. * @param c - point to compare */ equals(c: Point): boolean; } export default Point; //# sourceMappingURL=Point.d.ts.map