Size

Immutable Size class. Warning: the input array is NOT cloned, modifying it will modify the index values.

Constructor

new Size(values)

Parameters:
NameTypeDescription
valuesArray.<number>

The size values.

Classes

Size

Methods

canScroll(viewOrientation) → {boolean}

Check if the associated data is scrollable: either in 3D or in other directions.

Parameters:
NameTypeDescription
viewOrientationMatrix33

The orientation matrix.

Returns:

True if scrollable.

Type: 
boolean

canScroll3D(viewOrientationopt) → {boolean}

Check if the associated data is scrollable in 3D.

Parameters:
NameTypeAttributesDescription
viewOrientationMatrix33<optional>

The orientation matrix.

Returns:

True if scrollable.

Type: 
boolean

equals(rhs) → {boolean}

Check for equality.

Parameters:
NameTypeDescription
rhsSize

The object to compare to.

Returns:

True if both objects are equal.

Type: 
boolean

get(i) → {number}

Get the size value at the given array index.

Parameters:
NameTypeDescription
inumber

The index to get.

Returns:

The value.

Type: 
number

get2D() → {Scalar2D}

Get the 2D base of this size.

Returns:

The 2D base [0,1] as {x,y}.

Type: 
Scalar2D

getDimSize(dimension, startopt) → {number}

Get the size of a given dimension.

Parameters:
NameTypeAttributesDescription
dimensionnumber

The dimension.

startnumber<optional>

Optional start dimension to start counting from.

Returns:

The size.

Type: 
number

getTotalSize(startopt) → {number}

Get the total size.

Parameters:
NameTypeAttributesDescription
startnumber<optional>

Optional start dimension to base the offset on.

Returns:

The total size.

Type: 
number

getValues() → {Array.<number>}

Get the values of this index.

Returns:

The array of values.

Type: 
Array.<number>

indexToOffset(index, startopt) → {number}

Convert an index to an offset in memory.

Parameters:
NameTypeAttributesDescription
indexIndex

The index to convert.

startnumber<optional>

Optional start dimension to base the offset on.

Returns:

The offset.

Type: 
number

isInBounds(index, dirs) → {boolean}

Check that an index is within bounds.

Parameters:
NameTypeDescription
indexIndex

The index to check.

dirsArray.<number>

Optional list of directions to check.

Returns:

True if the given coordinates are within bounds.

Type: 
boolean

length() → {number}

Get the length of the index.

Returns:

The length.

Type: 
number

moreThanOne(dimension) → {boolean}

Check if a dimension exists and has more than one element.

Parameters:
NameTypeDescription
dimensionnumber

The dimension to check.

Returns:

True if the size is more than one.

Type: 
boolean

offsetToIndex(offset) → {Index}

Convert an offset in memory to an index.

Parameters:
NameTypeDescription
offsetnumber

The offset to convert.

Returns:

The index.

Type: 
Index

toString() → {string}

Get a string representation of the size.

Returns:

The Size as a string.

Type: 
string