Skip to main content

Class: PointsManager<T>

PointsManager handles Point type data contained in a TypedArray representation where all the point data is consecutive from start to end. That is, the organization is x0,y0,z0,x1,y1,z1,...,xn,yn,zn. This optimizes the storage costs for large arrays of data, while still providing access to the point data as though it were a simple array of objects.

This representation is efficient for storing large numbers of points and for transferring them amongst systems and is planned to have more methods added for generic manipulation of data.

Type Parameters​

• T

Constructors​

new PointsManager()​

new PointsManager<T>(configuration): PointsManager<T>

Parameters​

• configuration: PolyDataPointConfiguration = {}

Returns​

PointsManager<T>

Defined in​

packages/core/src/utilities/PointsManager.ts:37

Properties​

_byteSize​

_byteSize: number = 4

Defined in​

packages/core/src/utilities/PointsManager.ts:33


_dimensions​

_dimensions: number = 3

Defined in​

packages/core/src/utilities/PointsManager.ts:31


_length​

_length: number = 0

Defined in​

packages/core/src/utilities/PointsManager.ts:32


array​

array: ArrayBuffer

Defined in​

packages/core/src/utilities/PointsManager.ts:35


data​

data: Float32Array

Defined in​

packages/core/src/utilities/PointsManager.ts:30


growSize​

growSize: number = 128

Defined in​

packages/core/src/utilities/PointsManager.ts:34


kIndex​

kIndex: number

Allow storage for an index value to indicate where this array is contained in terms of the index location.

Defined in​

packages/core/src/utilities/PointsManager.ts:22


sources​

sources: IPointsManager<T>[]

Sources data for this array. Just used for external access, not updated here.

Defined in​

packages/core/src/utilities/PointsManager.ts:28

Accessors​

dimensionLength​

get dimensionLength(): number

Returns​

number

Defined in​

packages/core/src/utilities/PointsManager.ts:65


dimensions​

get dimensions(): number

Returns​

number

Defined in​

packages/core/src/utilities/PointsManager.ts:61


length​

get length(): number

Returns​

number

Defined in​

packages/core/src/utilities/PointsManager.ts:57


points​

get points(): T[]

A points object containing Float32Array instances referring to the underlying data, contained in a FloatArray32[] instance. Note - changes to the data store will directly affect the points value returned here, even if stored separately.

Returns​

T[]

Defined in​

packages/core/src/utilities/PointsManager.ts:187

Methods​

forEach()​

forEach(func): void

Parameters​

• func

Returns​

void

Defined in​

packages/core/src/utilities/PointsManager.ts:51


getPoint()​

getPoint(index): T

Returns a Float32Array view of the given point. Changes to the data in this point will affect the underlying data.

Parameters​

• index: number

positive index from start, or negative from end

Returns​

T

Float32Array view onto the point at the given index

Defined in​

packages/core/src/utilities/PointsManager.ts:76


getPointArray()​

getPointArray(index): T

Returns a number[] version of the given point. Changes to the array will NOT affect the underlying data.

Parameters​

• index: number

positive index from start, or negative from end

Returns​

T

A new number[] instance of the given point.

Defined in​

packages/core/src/utilities/PointsManager.ts:97


getTypedArray()​

getTypedArray(): Float32Array

Gets the raw underlying data - note this can change. Use for fast calculations on a fully filled array.

Returns​

Float32Array

Defined in​

packages/core/src/utilities/PointsManager.ts:154


grow()​

protected grow(additionalSize, growSize): void

Updates the array size as needed to allow for at least the given additional number of elements.

Parameters​

• additionalSize: number = 1

• growSize: number = ...

Returns​

void

Defined in​

packages/core/src/utilities/PointsManager.ts:116


map()​

map<R>(f): R[]

Maps the array onto another type.

Type Parameters​

• R

Parameters​

• f

Returns​

R[]

Defined in​

packages/core/src/utilities/PointsManager.ts:173


push()​

push(point): void

Push a new point onto this arrays object

Parameters​

• point: T

Returns​

void

Defined in​

packages/core/src/utilities/PointsManager.ts:161


reverse()​

reverse(): void

Reverse the points in place.

Returns​

void

Defined in​

packages/core/src/utilities/PointsManager.ts:136


subselect()​

subselect(count, offset): IPointsManager<T>

Select the given number of points from the array, evenly spaced at the given offset (which must be between (-count,count))

Parameters​

• count: number = 10

• offset: number = 0

Returns​

IPointsManager<T>

Defined in​

packages/core/src/utilities/PointsManager.ts:236


toXYZ()​

toXYZ(): PointsXYZ

The XYZ representation of a points array is an object with three separate arrays, one for each of x,y and z, containing the point data, eg x: {x0, x1, x2, ...., xn } Will create just x,y for Point2 arrays.

Returns​

PointsXYZ

An XYZ array

Defined in​

packages/core/src/utilities/PointsManager.ts:199


create2()​

static create2(initialSize): PointsManager<Point2>

Create a PointsManager<Point2> instance with available capacity of initialSize

Parameters​

• initialSize: number = 128

Returns​

PointsManager<Point2>

Defined in​

packages/core/src/utilities/PointsManager.ts:269


create3()​

static create3(initialSize, points?): PointsManager<Point3>

Create a PointsManager<Point3> instance with available capacity of initialSize

Parameters​

• initialSize: number = 128

the starting size of the underlying array, however, it will still be empty of actual data initially.

• points?: Point3[]

a set of points to add to the points array. Makes it easy to copy a set of points into a PointsManager.

Returns​

PointsManager<Point3>

Defined in​

packages/core/src/utilities/PointsManager.ts:257


fromXYZ()​

static fromXYZ(__namedParameters): IPointsManager<Point3>

Create an PointsArray3 from the x,y,z individual arrays (see toXYZ) Will create a Point3 array even if z is missing, with 0 as the value.

Parameters​

• __namedParameters: PointsXYZ

Returns​

IPointsManager<Point3>

Defined in​

packages/core/src/utilities/PointsManager.ts:220