Menu - Top - Home - Donate to Me

ShapeGroup

Back to documentation index.

new ShapeGroup()

Represents a grouping of shapes. This object can hold both Shape objects and other ShapeGroup objects.

Methods

ShapeGroup#addShape(shape)

Adds a 3D shape to this shape group, at the end of the list of shapes. Its reference, not a copy, will be stored in the list of shapes.

Parameters

Return Value

This object. (Type: ShapeGroup)

ShapeGroup#copy()

Makes a copy of this shape group and the objects contained in it. The copied object will will have its own version of the transform and visibility flag, and any objects contained in this one will be copied using their copy() method. The copied shape group won't have a parent.

Return Value

A copy of this shape group. (Type: ShapeGroup)

ShapeGroup#getBounds()

Finds a bounding box that holds all vertices in this shape group. The bounding box is not guaranteed to be the tightest, and the box will be in world space coordinates.

Return Value

An array of six numbers describing an axis-aligned bounding box that fits all vertices in the shape group. The first three numbers are the smallest-valued X, Y, and Z coordinates, and the last three are the largest-valued X, Y, and Z coordinates. If the shape group has no vertices, returns the array [Inf, Inf, Inf, -Inf, -Inf, -Inf]. (Type: Array.<number>)

ShapeGroup#getMatrix()

Gets a copy of the transformation needed to transform this shape group's coordinates to world coordinates.

Return Value

A 4x4 matrix. (Type: Transform)

ShapeGroup#getShape(index)

Gets the shape or shape group located in this shape group at the given index.

Parameters

Return Value

The shape or shape group located in this shape group at the given index, or null if none is found there. (Type: Shape | ShapeGroup)

ShapeGroup#getTransform()

Gets a reference to the transform used by this shape group object.

Return Value

Return value. (Type: Transform)

ShapeGroup#getVisible()

Gets whether this shape group will be drawn on rendering.

Return Value

value True if this shape group will be visible; otherwise, false. (Type: boolean)

ShapeGroup#primitiveCount()

Gets the number of primitives (triangles, lines, and points) composed by all shapes in this shape group.

Return Value

Return value. (Type: number)

ShapeGroup#removeShape(shape)

Removes all instances of a 3D shape from this shape group

Parameters

Return Value

This object. (Type: ShapeGroup)

ShapeGroup#setPosition(x, y, z)

Sets the relative position of the shapes in this group from their original position. See Transform#setPosition This method will modify this shape group's transform rather than the transform for each shape in the group.

Parameters

Return Value

This object. (Type: ShapeGroup)

ShapeGroup#setQuaternion(quat)

Sets this shape group's rotation in the form of a quaternion. See Transform#setQuaternion. This method will modify this shape group's transform rather than the transform for each shape in the group.

Parameters

Return Value

This object. (Type: ShapeGroup)

ShapeGroup#setScale(x, y, z)

Sets the scale of this shape group relative to its original size. See Transform#setScale. This method will modify this shape group's transform rather than the transform for each shape in the group.

Parameters

Return Value

This object. (Type: ShapeGroup)

ShapeGroup#setShape(index, shape)

Sets a shape or shape group at the given index in this shape group.

Parameters

Return Value

This object. (Type: ShapeGroup)

ShapeGroup#setTransform(transform)

Sets the transform used by this shape group to a copy of the given transform. Child shapes can set their own transforms, in which case the rendering process will multiply this shape group's transform with the child shape's transform as it renders the child shape.

Parameters

Return Value

Return value. (Type: Object)

ShapeGroup#setVisible(value)

Sets whether this shape group will be drawn on rendering.

Parameters

Return Value

This object. (Type: ShapeGroup)

ShapeGroup#shapeCount()

Returns the number of shapes and/or shape groups that are direct children of this shape group.

Return Value

Return value. (Type: number)

ShapeGroup#vertexCount()

Gets the number of vertices composed by all shapes in this shape group.

Return Value

Return value. (Type: number)

Back to documentation index.