Download source

Group objects enable you to treat a number of axes child objects as one group. For example, you can make the entire group visible or invisible, select all objects when only one is clicked, or apply a transform matrix to reposition the objects by setting only one property on the group object.

There are two group objects:

hggroup | – | Use when you want to create a group of objects and control the visibility or selectability of the group based on what happens to any individual object in the group. |

hgtransform | – | Use when you want to transform a group of objects. Transforms include rotation, translation, scaling, etc. |

The difference between the hggroup and hgtransform objects is the ability of the hgtransform object to apply a transform matrix (via its Matrix property) to all objects for which it is the parent.

Create hggroup object

Example: group1

An hggroup object can be the parent of any axes children except light objects, as well as other hggroup objects. You can use hggroup objects to form a group of objects that can be treated as a single object.

`makehgtransform`

creates 4-by-4 transform matrix
`M = makehgtform M = makehgtform('translate',[tx ty
tz])M = makehgtform('scale',s) M = makehgtform('scale',[sx,sy,sz]) M = makehgtform('xrotate',t) M = makehgtform('yrotate',t) M = makehgtform('zrotate',t) M = makehgtform('axisrotate',[ax,ay,az],t) `

Use `makehgtform` to create transform matrices
for translation, scaling, and rotation of graphics objects. Apply
the transform to graphics objects by assigning the transform to the `Matrix` property
of a parent hgtransform object. See Examples for more information.

`M = makehgtform ` returns
an identity transform.

`M = makehgtform('translate',[tx ty
tz])` or M = makehgtform('translate',tx,ty,tz) returns
a transform that translates along the *x*-axis
by `tx`, along the *y*-axis by `ty`,
and along the *z*-axis by `tz`.

`M = makehgtform('scale',s) `returns
a transform that scales uniformly along the *x*-, *y*-,
and *z*-axes.

`M = makehgtform('scale',[sx,sy,sz]) `returns
a transform that scales along the *x*-axis by `sx`,
along the *y*-axis by `sy`, and
along the *z*-axis by `sz`.

`M = makehgtform('xrotate',t) `returns
a transform that rotates around the *x*-axis by `t` radians.

`M = makehgtform('yrotate',t) `returns
a transform that rotates around the *y*-axis by `t` radians.

`M = makehgtform('zrotate',t) `returns
a transform that rotates around the *z*-axis by `t` radians.

`M = makehgtform('axisrotate',[ax,ay,az],t) `Rotate
around axis `[ax ay az]` by `t` radians.

Note that you can specify multiple operations in one call to `makehgtform` and
the MATLAB software returns a transform matrix that is the result
of concatenating all specified operations. For example,

m = makehgtform('xrotate',pi/2,'yrotate',pi/2);

is the same as

m = makehgtform('xrotate',pi/2)*makehgtform('yrotate',pi/2);

Tomas Moller and Eric Haines, *Real-Time Rendering*,
A K Peters, Ltd., 1999.

Maintained by John Loomis,
last updated *13 Jan 2010 *