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

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.

Methods:

  • getDataForShape
  • getDensity
  • getLastScale
  • getMass
  • getPointOnShape
  • getPointer
  • initWithCube
  • initWithPolygonCone
  • initWithPolygonDisk
  • initWithSphere
  • scale
  • setDensity
  • setMass
    getDataForShape( self )

    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.


    getDensity( self )

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


    getLastScale( self )

    Used internally...


    getMass( self )

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


    getPointOnShape( self, theVector )

    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.


    getPointer( self )

    Returns the shapePointer associated with this Shape object. This method is used internally and should not typically be used in user simulations.


    initWithCube( self, v )

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


    initWithPolygonCone( self, sideCount, theHeight, theRadius )

    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.


    initWithPolygonDisk( self, sideCount, theHeight, theRadius )

    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.


    initWithSphere( self, theRadius )

    Sets this Shape object to a sphere with radius theRadius.


    scale( self, scale )

    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.


    setDensity( self, newDensity )

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


    setMass( self, newMass )

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