GrowableXYArray Class
GrowableXYArray manages a (possibly growing) Float64Array to pack xy coordinates.
Extends
Methods
| Name | Description | |
|---|---|---|
| constructor(numPoints: number = 8, growthFactor?: number): GrowableXYArray | Construct a new GrowablePoint2d array. | |
| areaXY(): number | Sum the signed areas of the projection to xy plane | |
| back(result?: Point2d): undefined | Point2d | Return the last point, or undefined if the array is empty. | |
| clear(): void | Clear all xy data, but leave capacity unchanged. | |
| clone(): GrowableXYArray | Make a copy of the (active) points in this array. | |
| compareLexicalBlock(ia: number, ib: number): number | compare two blocks in simple lexical order. | |
| component(pointIndex: number, componentIndex: number): number | Access a single double at offset within a block. | |
| copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): { count: number, offset: number } Protected | Copy xy points from source array. | |
| crossProductIndexIndexIndex(originIndex: number, targetAIndex: number, targetBIndex: number): undefined | number | Compute the cross product of vectors from from indexed origin to indexed targets i and j | |
| crossProductXAndYIndexIndex(origin: Readonly<WritableXAndY>, targetAIndex: number, targetBIndex: number): undefined | number | Compute the cross product of vectors from from origin to indexed targets i and j | |
| distance(i: number, j: number): undefined | number | Return the distance between two points in the array. | |
| distanceIndexToPoint(i: number, spacePoint: Point2d): undefined | number | Return the distance between an array point and the input point. | |
| ensureCapacity(pointCapacity: number, applyGrowthFactor: boolean = true): void | If necessary, increase the capacity to a new pointCount. | |
| extendRange(rangeToExtend: Range2d, transform?: Transform): void | Extend a Range2d, optionally transforming the points. |
|
| float64Data(): Float64Array | Return the raw packed data. | |
| front(result?: Point2d): undefined | Point2d | Return the first point, or undefined if the array is empty. | |
| getPoint2dArray(): Point2d[] | Gather all points as a Point2d[] | |
| getPoint2dAtCheckedPointIndex(pointIndex: number, result?: Point2d): undefined | Point2d | copy xy into strongly typed Point2d | |
| getPoint2dAtUncheckedPointIndex(pointIndex: number, result?: Point2d): Point2d | Get a point by index, strongly typed as a Point2d. | |
| getPoint3dArray(z: number = 0): Point3d[] | Copy all points into a simple array of Point3d with given z. | |
| getVector2dAtCheckedVectorIndex(vectorIndex: number, result?: Vector2d): undefined | Vector2d | copy xy into strongly typed Vector2d | |
| getXAtUncheckedPointIndex(pointIndex: number): number | Get x coordinate by point index, with no index checking | |
| getYAtUncheckedPointIndex(pointIndex: number): number | Get y coordinate by point index, with no index checking | |
| interpolate(i: number, fraction: number, j: number, result?: Point2d): undefined | Point2d | Compute a point at fractional coordinate between points i and j | |
| isAlmostEqual(other: GrowableXYArray, tolerance: number = Geometry.smallMetricDistance): boolean | Toleranced equality test | |
| isIndexValid(index: number): boolean | Test if index is valid for an xy (point or vector) within this array | |
| multiplyMatrix3dInPlace(matrix: Matrix3d): void | multiply each xy (as a vector) by matrix, replace values. | |
| multiplyTransformInPlace(transform: Transform): void | multiply each point by the transform, replace values. | |
| pop(): void | Remove one point from the back. | |
| push(toPush: Readonly<WritableXAndY>): void | push a point to the end of the array | |
| pushAll(points: Readonly<WritableXAndY>[]): void | push all points of an array | |
| pushAllXYAndZ(points: Readonly<WritableXYAndZ>[] | GrowableXYZArray): void | push all points of an array | |
| pushFrom(p: any): void | Push copies of points from variant sources. | |
| pushFromGrowableXYArray(source: GrowableXYArray, sourceIndex?: number): number | push coordinates from the source array to the end of this array. | |
| pushInterpolatedFromGrowableXYArray(source: GrowableXYArray, i: number, fraction: number, j: number): void | * Compute a point at fractional coordinate between points i and j of source | |
| pushWrap(numWrap: number): void | Replicate numWrap xy values from the front of the array as new values at the end. | |
| pushXY(x: number, y: number): void | push a point given by x,y coordinates | |
| resize(pointCount: number, padWithZero?: boolean): void | * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active points but preserving original capacity. | |
| reverseInPlace(): void | reverse the order of points. | |
| scaleInPlace(factor: number): void | Multiply each x,y by the scale factor. | |
| setAtCheckedPointIndex(pointIndex: number, value: Readonly<WritableXAndY>): boolean | Set the coordinates of a single point. | |
| setXYAtCheckedPointIndex(pointIndex: number, x: number, y: number): boolean | Set the coordinates of a single point given as coordinates. | |
| sortIndicesLexical(): Uint32Array | Return an array of block indices sorted per compareLexicalBlock function | |
| sumLengths(): number | sum the lengths of segments between points. | |
| transferFromGrowableXYArray(destIndex: number, source: GrowableXYArray, sourceIndex: number): boolean | Read coordinates from source array, place them at index within this array. | |
| tryTransformInverseInPlace(transform: Transform): boolean | multiply each point by the transform, replace values. | |
| vectorIndexIndex(i: number, j: number, result?: Vector2d): undefined | Vector2d | Compute a vector from index origin i to indexed target j | |
| vectorXAndYIndex(origin: Readonly<WritableXAndY>, j: number, result?: Vector2d): undefined | Vector2d | Compute a vector from origin to indexed target j | |
| create(data: any, result?: GrowableXYArray): GrowableXYArray Static | Create an array by copying data from various point formats. | |
| createArrayOfGrowableXYZArray(data: MultiLineStringDataVariant): undefined | GrowableXYZArray[] Static | Restructure MultiLineStringDataVariant as array of GrowableXYZArray | Deprecated |
| createFromGrowableXYZArray(source: GrowableXYZArray, transform?: Transform, dest?: GrowableXYArray): GrowableXYArray Static | Create an array of xy points from source xyz points. | |
| isAlmostEqual(dataA: GrowableXYArray, dataB: GrowableXYArray): boolean Static | Test for nearly equal arrays. |
Inherited methods
| Name | Inherited from | Description |
|---|---|---|
| linearCombination(scales: number[], result?: Vector2d | Point2d): XY Inherited | IndexedXYCollection | Compute the linear combination s of the indexed p_i and given scales s_i. |
Properties
| Name | Type | Description | |
|---|---|---|---|
| float64Length Accessor ReadOnly | number | Return the number of float64 in use. | |
| length Accessor | number | The number of points in use. | |
| length Setter | length(newLength: number): void | read-only property for number of XY in the collection. |
Defined in
- geometry3d/GrowableXYArray.ts Line 24
Last Updated: 24 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.