These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

## Abstract : Shape

This class is included as part of the file Shape.tz.
To use this class in a simulation, include the line "@use Shape."

### Class description:

> The Shape class is a work-in-progress which allows users to create shapes which will be associated with Mobile, Stationary or Link objects and added to the simulated world. An instance of the class Shape may be shared by several objects simultaneously.

> Each Shape has it's own local coordinate frame, with the origin at the middle of the shape.

### Class methods:

> Getting and Setting a Shape's Mass Properties

> - get-density
> - get-mass
> - set-density
> - set-inertia-matrix
> - set-mass

> Dynamically Changing the Size of a Shape

> - scale

> Initializing the Shape

> - init-with-cube
> - init-with-polygon-cone
> - init-with-polygon-disk
> - init-with-sphere

> Getting Information About a Shape's Geometry

> - get-point-on-shape

> Serializing the Shape

> - get-data-for-shape

`get-data-for-shape`

> Returns serialized data for the shape (if the shape object has been properly initialized). Used for archiving/dearchiving, should generally not be called manually, unless you really know what you're doing.

`get-density`

> If the shape is properly initialized, this method returns the shape's density.

`get-mass`

> If the shape is properly initialized, this method returns the shape's mass.

`get-point-on-shape on-vector theVector (vector)`

> This method is experimental.

> Starting from inside the shape at the center, this function goes in the direction of theVector until it hits the edge of the shape. The resulting point is returned.

> This allows you to compute link points for arbitrary shapes. For example, if you want to compute a link point for the "left-most" point on the shape, you can call this method with (-1, 0, 0).

> Returns (0, 0, 0) if the shape is not initialized or if an error occurs.

`init-with-cube size v (vector)`

> Sets this Shape object to a rectangular solid of size v.

`init-with-polygon-cone sides sideCount (int) height theHeight (float) radius theRadius = 1.0 (float)`

> Sets this Shape object to a cone-like shape with sideCount sides.

> The distance from the center of the n-gon faces to the vertices is theRadius. sides has a maximum value of 99. Higher values will cause the shape not to be initialized.

> The height, or depth of the extrusion, is theHeight.

> This method is experimental, but seems to work okay. Go figure.

`init-with-polygon-disk sides sideCount (int) height theHeight (float) radius theRadius = 1.0 (float)`

> Sets this Shape object to an extruded n-gon of sideCount sides, in other words, a disk with sideCount sides.

> The distance from the center of the n-gon faces to the vertices is theRadius. sides has a maximum value of 99. Higher values will cause the shape not to be initialized.

> The height, or depth of the extrusion, is theHeight.

> This method is experimental, but seems to work okay. Go figure.

`init-with-sphere radius theRadius = 1.0 (float)`

> Sets this Shape object to a sphere with radius theRadius.

`scale by scale (vector)`

> If the shape is not a sphere, scales the shape by the x, y and z elements of scale. If the shape is a sphere, scales the shape by only the x element such that the shape always remains spherical.

> After the size has been changed, the instances announces a "size-changed" notification.

`set-density to newDensity (float)`

> Sets the density for this Shape object. This implicitly changes the mass of the object.

`set-inertia-matrix to newInertia (matrix)`

> Sets the 3x3 matrix representing the shape's inertia. Appropriate intertia matrices are automatically computed for all shapes, so this method is for advanced customization only. Any calls that change the shape's density, mass or structure will recompute the inertia matrix, so this method should be called only after the final structure, mass and density of the shape have been set.

`set-mass to newMass (float)`

> Sets the mass for this Shape object. This implicitly changes the density of the object.

Documentation created Fri Aug 8 15:16:49 2008