/** @packageDocumentation * @module ArraysAndInterfaces */ import { Point2d, Vector2d, XY } from "./Point2dVector2d"; import { XAndY } from "./XYZProps"; /** * Abstract base class for access to XY data with indexed reference. * * This allows algorithms to work with Point2d[] or GrowableXY. * * GrowableXYArray implements these for its data. * * Point2dArrayCarrier carries a (reference to) a Point2d[] and implements the methods with calls on that array reference. * * In addition to "point by point" accessors, other abstract members compute commonly useful vector data "between points". * * Methods that create vectors among multiple indices allow callers to avoid creating temporaries. * @public */ export declare abstract class IndexedXYCollection { /** * Get from `index` as a `Point2d`. * @param index index of point within the array. * @param result optional caller-allocated destination. * @returns undefined if the index is out of bounds. */ abstract getPoint2dAtCheckedPointIndex(index: number, result?: Point2d): Point2d | undefined; /** * Get from `index` as a `Vector2d`. * @param index index of point within the array. * @param result optional caller-allocated destination. * @returns undefined if the index is out of bounds. */ abstract getVector2dAtCheckedVectorIndex(index: number, result?: Vector2d): Vector2d | undefined; /** * Return a vector from the point at `indexA` to the point at `indexB`. * @param indexA index of point within the array. * @param indexB index of point within the array. * @param result optional caller-allocated vector. * @returns undefined if either index is out of bounds. */ abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector2d): Vector2d | undefined; /** * Return a vector from given origin to the point at `indexB`. * @param origin origin for vector. * @param indexB index of point within the array. * @param result optional caller-allocated vector. * @returns undefined if index is out of bounds. */ abstract vectorXAndYIndex(origin: XAndY, indexB: number, result?: Vector2d): Vector2d | undefined; /** * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`. * @param origin origin for vector. * @param indexA index of first target within the array. * @param indexB index of second target within the array. * @param result optional caller-allocated vector. * @returns undefined if either index is out of bounds. */ abstract crossProductXAndYIndexIndex(origin: XAndY, indexA: number, indexB: number): number | undefined; /** * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`. * @param origin index of origin. * @param indexA index of first target within the array. * @param indexB index of second target within the array. * @param result optional caller - allocated vector. * @returns return true if indexA, indexB both valid. */ abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined; /** Read-only property for number of XY in the collection. */ abstract get length(): number; private static _workPoint?; /** * Access x of indexed point. * * Subclasses may wish to override with a more efficient implementation. */ getXAtUncheckedPointIndex(pointIndex: number): number; /** * Access y of indexed point. * * Subclasses may wish to override with a more efficient implementation. */ getYAtUncheckedPointIndex(pointIndex: number): number; /** * Compute the linear combination s of the indexed p_i and given scales s_i. * @param scales array of scales. For best results, scales should have same length as the instance. * @param result optional pre-allocated object to fill and return. * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length). */ linearCombination(scales: number[], result?: Point2d | Vector2d): XY; } /** * Abstract base class extends [[IndexedXYCollection]] with methods that modify the collection. * @public */ export declare abstract class IndexedReadWriteXYCollection extends IndexedXYCollection { /** Push a (clone of) point onto the collection. */ abstract push(point: XAndY): void; /** Push a new point (given by xy coordinates) onto the collection. */ abstract pushXY(x?: number, y?: number): void; /** Remove the final point. */ abstract pop(): void; /** Remove all entries. */ abstract clear(): void; /** Reverse the points in place. */ abstract reverseInPlace(): void; } //# sourceMappingURL=IndexedXYCollection.d.ts.map