import type { Element, Link } from './elements';
/**
 * Represents a floating-point 2D vector.
 *
 * @category Geometry
 */
export interface Vector {
    readonly x: number;
    readonly y: number;
}
/**
 * Utility functions to operate on 2D vectors.
 *
 * @category Geometry
 */
export declare namespace Vector {
    /**
     * Adds two vectors component-wise.
     */
    function add(a: Vector, b: Vector): Vector;
    /**
     * Subtracts two vectors component-wise.
     */
    function subtract(a: Vector, b: Vector): Vector;
    /**
     * Multiplies each vector component by a scalar number.
     */
    function scale(v: Vector, factor: number): Vector;
    /**
     * Returns `true` if two vectors are the same, otherwise `false`.
     */
    function equals(a: Vector, b: Vector): boolean;
    /**
     * Computes the length of a vector (L2 norm).
     */
    function length({ x, y }: Vector): number;
    /**
     * Normalizes the vector by dividing by its length to get a unit vector
     * with the same direction as the original one.
     */
    function normalize({ x, y }: Vector): Vector;
    /**
     * Computes dot-product of two vectors.
     */
    function dot({ x: x1, y: y1 }: Vector, { x: x2, y: y2 }: Vector): number;
    /**
     * Computes 2D cross-product of two vectors.
     */
    function cross2D({ x: x1, y: y1 }: Vector, { x: x2, y: y2 }: Vector): number;
}
/**
 * Represents a 2D rectangular size.
 *
 * @category Geometry
 */
export interface Size {
    readonly width: number;
    readonly height: number;
}
/**
 * Represents a 2D axis-aligned rectangle.
 *
 * @category Geometry
 */
export interface Rect {
    readonly x: number;
    readonly y: number;
    readonly width: number;
    readonly height: number;
}
/**
 * Utility functions to operate on 2D axis-aligned rectangles.
 *
 * @category Geometry
 */
export declare namespace Rect {
    /**
     * Returns `true` if two rectangles are the same, otherwise `false`.
     */
    function equals(a: Rect, b: Rect): boolean;
    /**
     * Computes the center point of a rectangle.
     */
    function center({ x, y, width, height }: Rect): Vector;
    /**
     * Returns `true` if two rectangles intersects each other, otherwise `false`.
     *
     * Rectangles sharing an edge are considered as intersecting as well.
     */
    function intersects(a: Rect, b: Rect): boolean;
}
/**
 * Provides sizes for the diagram content items.
 *
 * @category Geometry
 */
export interface SizeProvider {
    /**
     * Gets current size for the specified element.
     */
    getElementSize(element: Element): Size | undefined;
}
/**
 * Computes bounding rectangle from an element's position and size.
 *
 * @category Geometry
 */
export declare function boundsOf(element: Element, sizeProvider: SizeProvider): Rect;
/**
 * Returns `true` is two line geometries (vertex sequences) are the same,
 * otherwise `false`.
 *
 * @category Geometry
 */
export declare function isPolylineEqual(left: ReadonlyArray<Vector>, right: ReadonlyArray<Vector>): boolean;
/**
 * Computes line geometry between two rectangles clipped at each
 * rectangle border with intermediate points in-between.
 *
 * It is assumed that the line starts at source rectangle center,
 * ends at target rectangle center and goes through each vertex in the array.
 *
 * @category Geometry
 */
export declare function computePolyline(sourceRect: Rect, targetRect: Rect, vertices: ReadonlyArray<Vector>): Vector[];
/**
 * Computes length of linear line geometry.
 *
 * @category Geometry
 * @see {@link getPointAlongPolyline}
 */
export declare function computePolylineLength(polyline: ReadonlyArray<Vector>): number;
/**
 * Computes position at the specified `offset` along a linear line geometry
 * relative to the start of the line.
 *
 * If `offset` value is less than 0 or greater than line geometry length,
 * the the first or last point of the line will be returned correspondingly.
 *
 * @category Geometry
 * @see {@link computePolylineLength}
 */
export declare function getPointAlongPolyline(polyline: ReadonlyArray<Vector>, offset: number): Vector;
/**
 * Searches for a closest segment of a linear line geometry.
 *
 * @returns index of start point for the closes line segment, or 0 if line is empty.
 * @category Geometry
 * @see {@link getPointAlongPolyline}
 */
export declare function findNearestSegmentIndex(polyline: ReadonlyArray<Vector>, location: Vector): number;
/**
 * Converts linear line geometry into an SVG path.
 *
 * @category Geometry
 */
export declare function pathFromPolyline(polyline: ReadonlyArray<Vector>): string;
/**
 * Returns the first element from specified `elements` which bounding box
 * includes the specified `point`.
 *
 * If the specified `point` is at the edge of a bounding box, it is considered
 * to be part of it.
 *
 * @param elements an array of diagram elements to search
 * @param point point on a diagram in paper coordinates
 * @param sizeProvider element size provider to compute bounding boxes
 * @category Geometry
 */
export declare function findElementAtPoint(elements: ReadonlyArray<Element>, point: Vector, sizeProvider: SizeProvider): Element | undefined;
/**
 * Computes complete bounding box for the specified `elements` and `links`.
 *
 * @category Geometry
 */
export declare function getContentFittingBox(elements: Iterable<Element>, links: Iterable<Link>, sizeProvider: SizeProvider): Rect;
/**
 * Computes average center position of element bounding boxes.
 *
 * @category Geometry
 */
export declare function calculateAveragePosition(elements: ReadonlyArray<Element>, sizeProvider: SizeProvider): Vector;
//# sourceMappingURL=geometry.d.ts.map