Class PileArrangement

Stack in a pyramid.

Hierarchy

Constructors

Properties

itemWidth?: number

When provided, replaces the size of each child object when arranging.

jitter: boolean
localBounds?: Bounds

When provided, used instead of the bounds of the parent object when arranging.

margin: Vector3
maxJitterOffset: Vector3
maxJitterRotation: Rotation
maxPyramidLayer?: number

When provided, sets the maximum width for a pyramid layer

minJitterOffset: Vector3
minJitterRotation: Rotation
minPyramidLayer?: number

When provided, sets the minimum width for a pyramid layer

minQuantityForPyramid?: number

When provided, sets the minium number of items required to build a pyramid

triangle?: boolean

When provided, toggles between triangular based and square based pyramids

DEFAULT_MAX_JITTER_OFFSET: Vector3 = ...
DEFAULT_MAX_JITTER_ROTATION: Rotation = ...
FALLBACK: LinearArrangement = ...

Arrangement used if the available space can't be determined.

Methods

  • Generates the transformations for a bunch of child objects, given the bounds of the containing object.

    Parameters

    • boundsArray: Bounds[]

      Axis aligned offsets and sizes of each child object.

    • Optional parentLocalBounds: Bounds

      Offset and size of the containing object.

    • Optional jitterSeed: string

      Seed used to deterministically apply jitter to the generated arrangement.

    Returns ITransform[]

    Array of generated transformations, one for each element in boundsArray.

  • When implemented in a deriving class, generates the base transformations for an array of objects. The returned array must contain exactly one element for each item in boundsArray. There's no need to handle margin or jitter here, those features are implemented in the base class.

    Parameters

    • boundsArray: Bounds[]

      Axis aligned offsets and sizes of each child object.

    • random: Random

      Random number generator available for adding variance to the generated transforms. Will produce the same sequence of samples between calls on the same instance.

    • Optional parentLocalBounds: Bounds

      Offset and size of the containing object.

    Returns ITransform[]

  • Get the total number of items which will me needed to fill a pyramid layer of a given width

    Parameters

    • layerSize: number
    • triangle: boolean

    Returns number

  • Get X,Y coordinates for all locations on a pyramid layer of a particular width (assuming item spacing of 1)

    Parameters

    • layerSize: number
    • triangle: boolean

    Returns [number, number][]

  • Space placement of layerSize number of items of width 1, centered around 0

    Parameters

    • layerSize: number

    Returns number[]

  • The maximum angle we can rotate a cube of size itemLength, in a box of size boundsLength

    Parameters

    • itemLength: number
    • boundsLength: number

    Returns number

  • Rotate a 2d vector by a given number of degrees

    Parameters

    • x: number
    • y: number
    • angle: number

    Returns number[]

Generated using TypeDoc