API Reference > geometry-core > ArraysAndInterfaces > GrowableXYArray GrowableXYArray Class GrowableXYArray manages a (possibly growing) Float64Array to pack xy coordinates. Extends IndexedXYCollection Methods Name Description constructor(numPoints: number = 8): 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 xyz 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. 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): 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 xyz 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 xyz 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 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 xyz (point or vector) within this array multiplyMatrix3dInPlace(matrix: Matrix3d): void multiply each xyz (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: GrowableXYZArray | Readonly<WritableXYAndZ>[]): void push all points of an array 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 xyz 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): void Resize the actual point count, preserving excess capacity. reverseInPlace(): void reverse the order of points. scaleInPlace(factor: number): void Multiply each x,y,z by the scale factor. setAtCheckedPointIndex(pointIndex: number, value: Readonly<WritableXAndY>): boolean Set the coordinates of a single point. setXYZAtCheckedPointIndex(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: GrowableXYZArray | Readonly<WritableXAndY>[]): GrowableXYArray Static Create an array populated from createArrayOfGrowableXYZArray(data: MultiLineStringDataVariant): undefined | GrowableXYZArray[] Static Restructure MultiLineStringDataVariant as array of GrowableXYZArray createFromGrowableXYZArray(source: GrowableXYZArray, transform?: Transform, dest?: GrowableXYArray): GrowableXYArray Static push coordinates from the source array to the end of this array. isAlmostEqual(dataA: undefined | GrowableXYArray, dataB: undefined | GrowableXYArray): boolean Static Test for nearly equal arrays. Properties Name Type Description float64Length Accessor ReadOnly number Return the number of float64 in use. length Accessor number The number of points in use. Defined in geometry3d/GrowableXYArray.ts Line 25 Last Updated: 11 June, 2024