GrowableXYZArray Class

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

Extends

Methods

Name Description
constructor(numPoints: number = 8, growthFactor?: number): GrowableXYZArray Construct a new GrowablePoint3d array.  
accumulateCrossProductIndexIndexIndex(originIndex: number, targetAIndex: number, targetBIndex: number, result: Vector3d): void * compute the cross product from indexed origin t indexed targets targetAIndex and targetB index.  
accumulateScaledXYZ(index: number, scale: number, sum: Point3d): void * compute the cross product from indexed origin t indexed targets targetAIndex and targetB index.  
addSteppedPoints(other: GrowableXYZArray, pointIndex0: number, step: number, numAdd: number): void add points at regular steps from other  
areaXY(): number Sum the signed areas of the projection to xy plane  
clear(): void Clear all xyz data, but leave capacity unchanged.  
clone(result?: GrowableXYZArray): GrowableXYZArray 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 xyz points from source array.  
crossProductIndexIndexIndex(originIndex: number, targetAIndex: number, targetBIndex: number, result?: Vector3d): undefined | Vector3d Compute the cross product of vectors from from indexed origin to indexed targets i and j  
crossProductXYAndZIndexIndex(origin: Readonly<WritableXYAndZ>, targetAIndex: number, targetBIndex: number, result?: Vector3d): undefined | Vector3d Compute the cross product of vectors from from origin to indexed targets i and j  
distanceIndexIndex(i: number, j: number): undefined | number Return distance between indicated points.  
distanceIndexToPoint(i: number, spacePoint: Readonly<WritableXYAndZ>): undefined | number Return the distance between an array point and the input point.  
distanceSquaredIndexIndex(i: number, j: number): undefined | number Return distance squared between indicated points.  
ensureCapacity(pointCapacity: number, applyGrowthFactor: boolean = true): void If necessary, increase the capacity to the new number of points.  
evaluateUncheckedIndexDotProductXYZ(pointIndex: number, x: number, y: number, z: number): number Compute the dot product of pointIndex with [x,y,z]  
evaluateUncheckedIndexPlaneAltitude(pointIndex: number, plane: PlaneAltitudeEvaluator): number Compute the dot product of pointIndex with [x,y,z]  
extendRange(rangeToExtend: Range3d, transform?: Transform): void Extend range to extend by all points.  
fillLocalXYTriangleFrame(originIndex: number, targetAIndex: number, targetBIndex: number, result?: Transform): undefined | Transform Compute frame for a triangle formed by three (unchecked!) points identified by index.  
float64Data(): Float64Array Return the raw packed data.  
forceClosure(tolerance: number = Geometry.smallMetricDistance): void * If not already closed, push a copy of the first point.  
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(): Point3d[] Copy all points into a simple array of Point3d  
getPoint3dAtCheckedPointIndex(pointIndex: number, result?: Point3d): undefined | Point3d copy xyz into strongly typed Point3d  
getPoint3dAtUncheckedPointIndex(pointIndex: number, result?: Point3d): Point3d Get a point by index, strongly typed as a Point3d.  
getRange(transform?: Transform): Range3d get range of points.  
getVector3dAtCheckedVectorIndex(vectorIndex: number, result?: Vector3d): undefined | Vector3d copy xyz into strongly typed Vector3d  
getVector3dAtUncheckedVectorIndex(vectorIndex: number, result?: Vector3d): Vector3d Get a vector by index, strongly typed as a Vector3d.  
getXAtUncheckedPointIndex(pointIndex: number): number access x of indexed point  
getYAtUncheckedPointIndex(pointIndex: number): number access y of indexed point  
getZAtUncheckedPointIndex(pointIndex: number): number access y of indexed point  
interpolate(i: number, fraction: number, j: number, result?: Point3d): undefined | Point3d Compute a point at fractional coordinate between points i and j  
isCloseToPlane(plane: Plane3dByOriginAndUnitNormal, tolerance: number = Geometry.smallMetricDistance): boolean test if all points are within tolerance of a plane.  
isIndexValid(index: number): boolean Test if index is valid for an xyz (point or vector) within this array  
mapComponent(componentIndex: | "1" | "2", func: (x: number, y: number, z: number) => number): void Pass the (x,y,z) of each point to a function which returns a replacement for one of the 3 components.  
moveIndexToIndex(fromIndex: number, toIndex: number): void move the coordinates at fromIndex to toIndex.  
multiplyAndRenormalizeMatrix3dInverseTransposeInPlace(matrix: Matrix3d): boolean multiply each xyz (as a vector) by matrix inverse transpose, renormalize the vector, replace values.  
multiplyMatrix3dInPlace(matrix: Matrix3d): void multiply each xyz (as a vector) by matrix, replace values.  
multiplyMatrix4dAndQuietRenormalizeMatrix4d(matrix: Matrix4d): void multiply each xyz (as a point) by a homogeneous matrix and update as the normalized point  
multiplyTransformInPlace(transform: Transform): void multiply each point by the transform, replace values.  
pop(): void Remove one point from the back.  
push(toPush: Readonly<WritableXYAndZ>): void push a point to the end of the array  
pushAll(points: Point3d[]): void push all points of an array  
pushFrom(p: any): void Push copies of points from variant sources.  
pushFromGrowableXYZArray(source: GrowableXYZArray, sourceIndex?: number): number push coordinates from the source array to the end of this array.  
pushFront(toPush: Readonly<WritableXYAndZ>): void prepend a new point at the front of the array.  
pushFrontXYZ(x: number, y: number, z: number): void prepend a new point with given x,y,z  
pushInterpolatedFromGrowableXYZArray(source: GrowableXYZArray, 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.  
pushXYZ(x: number, y: number, z: number): void append a new point with given x,y,z  
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,z by the scale factor.  
setAtCheckedPointIndex(pointIndex: number, value: Readonly<WritableXYAndZ>): boolean Set the coordinates of a single point.  
setRange(range: Range3d, transform?: Transform): void Initialize range with coordinates in this array.  
setXYZAtCheckedPointIndex(pointIndex: number, x: number, y: number, z: 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.  
transferFromGrowableXYZArray(destIndex: number, source: GrowableXYZArray, 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?: Vector3d): undefined | Vector3d Compute a vector from index origin i to indexed target j  
vectorXYAndZIndex(origin: Readonly<WritableXYAndZ>, j: number, result?: Vector3d): undefined | Vector3d Compute a vector from origin to indexed target j  
create(data: any, result?: GrowableXYZArray): GrowableXYZArray Static Create an array from various point data formats.  
createArrayOfGrowableXYZArray(data: MultiLineStringDataVariant): undefined | GrowableXYZArray[] Static Restructure MultiLineStringDataVariant as array of GrowableXYZArray  
distanceBetweenPointsIn2Arrays(arrayA: GrowableXYZArray, i: number, arrayB: GrowableXYZArray, j: number): undefined | number Static Return the distance between points in distinct arrays.  
distanceRangeBetweenCorrespondingPoints(arrayA: GrowableXYZArray, arrayB: GrowableXYZArray): Range1d Static find the min and max distance between corresponding indexed points.  
isAlmostEqual(dataA: undefined | GrowableXYZArray, dataB: undefined | GrowableXYZArray): boolean Static test for near equality between two GrowableXYZArray.  
multiplyTransformInPlace(transform: Transform, data: GrowableXYZArray | GrowableXYZArray[]): void Static multiply each point by the transform, replace values.  
removeClosure(points: IndexedReadWriteXYZCollection, tolerance: number = Geometry.smallMetricDistance): void Static remove trailing point(s) within tolerance of the start point.  

Inherited methods

Name Inherited from Description
almostEqualIndexIndex(index0: number, index1: number, tolerance: number = Geometry.smallMetricDistance): undefined | boolean IndexedReadWriteXYZCollection Test whether the indexed points are equal within tolerance.
back(result?: Point3d): undefined | Point3d IndexedReadWriteXYZCollection Return the last point, or undefined if the array is empty.
crossProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: Readonly<WritableXYAndZ>, result?: Vector3d): undefined | Vector3d IndexedReadWriteXYZCollection Return the cross product of the vectors from origin to the point at indexA and to targetB
cyclicIndex(i: number): number IndexedReadWriteXYZCollection Adjust index into range by modulo with the length.
distanceSquaredIndexXYAndZ(index0: number, target: Readonly<WritableXYAndZ>): undefined | number IndexedReadWriteXYZCollection Return distance squared between the point at index0 and target.
dotProductIndexIndexIndex(origin: number, indexA: number, indexB: number): undefined | number IndexedReadWriteXYZCollection Return the dot product of the vectors from the point at origin to the points at indexA and indexB.
dotProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: Readonly<WritableXYAndZ>): undefined | number IndexedReadWriteXYZCollection Return the dot product of the vectors from the point at origin to the point at indexA and to targetB.
findOrderedDuplicates(tolerance: number = Geometry.smallMetricDistance): number[] IndexedReadWriteXYZCollection For each run of points with indices i+1 to i+n within distance tolerance of points[i], return the indices i+1, ..., i+n.
front(result?: Point3d): undefined | Point3d IndexedReadWriteXYZCollection Return the first point, or undefined if the array is empty.
getArray(): Point3d[] IndexedReadWriteXYZCollection convert to Point3d[]
interpolateIndexIndex(index0: number, fraction: number, index1: number, result?: Point3d): undefined | Point3d IndexedReadWriteXYZCollection Interpolate the points at the given indices.
linearCombination(scales: number[], result?: Point3d | Vector3d): XYZ IndexedReadWriteXYZCollection Compute the linear combination s of the indexed p_i and given scales s_i.
vectorIndexXYAndZ(indexA: number, target: Readonly<WritableXYAndZ>, result?: Vector3d): undefined | Vector3d IndexedReadWriteXYZCollection Return a vector from the point at indexA to target

Properties

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

Inherited properties

Name Type Inherited from Description
points Accessor ReadOnly Iterable<Point3d> IndexedReadWriteXYZCollection Return iterator over the points in this collection. Usage:
ts<br> for (const point: Point3d of collection.points) { ... }<br>

Defined in

Last Updated: 19 April, 2024