GrowableXYArray Class

GrowableXYArray manages a (possibly growing) Float64Array to pack xy coordinates.

Extends

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): Point2d | undefined 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): number | undefined Compute the cross product of vectors from from indexed origin to indexed targets i and j  
crossProductXAndYIndexIndex(origin: XAndY, targetAIndex: number, targetBIndex: number): number | undefined Compute the cross product of vectors from from origin to indexed targets i and j  
distance(i: number, j: number): number | undefined Return the distance between two points in the array.  
distanceIndexToPoint(i: number, spacePoint: Point2d): number | undefined 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): Point2d | undefined Return the first point, or undefined if the array is empty.  
getPoint2dArray(): Point2d[] Gather all points as a Point2d[]  
getPoint2dAtCheckedPointIndex(pointIndex: number, result?: Point2d): Point2d | undefined 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): Vector2d | undefined 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): Point2d | undefined 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: XAndY): void push a point to the end of the array  
pushAll(points: XAndY[]): void push all points of an array  
pushAllXYAndZ(points: XYAndZ[] | GrowableXYZArray): 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.  
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.  
scaleInPlace(factor: number): void Multiply each x,y,z by the scale factor.  
setAtCheckedPointIndex(pointIndex: number, value: XAndY): 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): Vector2d | undefined Compute a vector from index origin i to indexed target j  
vectorXAndYIndex(origin: XAndY, j: number, result?: Vector2d): Vector2d | undefined Compute a vector from origin to indexed target j  
create(data: XAndY[] | GrowableXYZArray): GrowableXYArray Static Create an array populated from
An array of Point2d
An array of Point3d (hidden as XAndY)
An array of objects with keyed values, et {x:1, y:1}
A GrowableXYZArray
 
createArrayOfGrowableXYZArray(data: MultiLineStringDataVariant): GrowableXYZArray[] | undefined 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: GrowableXYArray | undefined, dataB: GrowableXYArray | undefined): boolean Static Test for nearly equal arrays.  

Properties

Name Type Description
float64Length Accessor ReadOnly number Return the number of float64 in use.  
length Accessor ReadOnly number Return the number of points in use.  

Defined in

Last Updated: 20 September, 2019