Simbody  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimTK::DecorativeGeometry Class Reference

This is the client-side interface to an implementation-independent representation of "Decorations" suitable for visualization, annotation, logging, or debugging but which cannot have any effect on the behavior of a System or the evolution of a Study. More...

#include <DecorativeGeometry.h>

+ Inheritance diagram for SimTK::DecorativeGeometry:

Public Types

enum  Representation {
  DrawPoints = 1,
  DrawWireframe = 2,
  DrawSurface = 3,
  DrawDefault = -1
}
 

Public Member Functions

 DecorativeGeometry ()
 
 ~DecorativeGeometry ()
 
 DecorativeGeometry (const DecorativeGeometry &)
 
DecorativeGeometryoperator= (const DecorativeGeometry &)
 
DecorativeGeometrysetBodyId (int)
 By default the geometry will be placed on ground. More...
 
DecorativeGeometrysetTransform (const Transform &X_BG)
 This transform shifts the generated polygons with respect to this object's local frame. More...
 
DecorativeGeometrysetResolution (Real)
 Each concrete DecorativeGeometry object is expected to have a default resolution that gets the point across but is cheap to draw and hence probably somewhat "chunky". More...
 
DecorativeGeometrysetScaleFactors (const Vec3 &scale)
 Each concrete DecorativeGeometry object is expected to have a default size around "1", whatever that means for a particular object, and most objects also allow a user-specified size on construction. More...
 
DecorativeGeometrysetScale (Real scale)
 Convenience method to set all three scale factors to the same value. More...
 
int getBodyId () const
 Return the body to which this geometry is attached. More...
 
Real getResolution () const
 Return the current setting of the "resolution" factor. More...
 
const TransformgetTransform () const
 Return the current value of the object's transform. More...
 
const Vec3getScaleFactors () const
 Return the current setting of the "scale" factors. More...
 
DecorativeGeometrysetColor (const Vec3 &rgb)
 Request a specific color for this DecorativeGeometry object. More...
 
DecorativeGeometrysetOpacity (Real)
 Request a level of transparency for this DecorativeGeometry. More...
 
DecorativeGeometrysetLineThickness (Real)
 Request an adjustment to the default rendering of lines and curves. More...
 
const Vec3getColor () const
 Return the color specified for this object, if any, otherwise Vec3(-1) indicating that the default color will be used. More...
 
Real getOpacity () const
 Return the opacity specified for this object. More...
 
Real getLineThickness () const
 Return the line thickness specified for this object, if any, otherwise return -1 to indicate that the default line thickness should be used. More...
 
DecorativeGeometrysetFaceCamera (int shouldFace)
 Set whether the geometry acts as a billboard, always rotating to face the camera. More...
 
int getFaceCamera () const
 Get whether the geometry acts as a billboard, always rotating to face the camera. More...
 
DecorativeGeometrysetRepresentation (const Representation &)
 Request a particular rendering representation of this DecorativeGeometry object. More...
 
Representation getRepresentation () const
 Returns drawing mode: -1 means "use default"; see above for others. More...
 
void implementGeometry (DecorativeGeometryImplementation &) const
 
bool isOwnerHandle () const
 
bool isEmptyHandle () const
 
 DecorativeGeometry (class DecorativeGeometryRep *r)
 
bool hasRep () const
 
const DecorativeGeometryRep & getRep () const
 
DecorativeGeometryRep & updRep ()
 

Protected Attributes

DecorativeGeometryRep * rep
 

Detailed Description

This is the client-side interface to an implementation-independent representation of "Decorations" suitable for visualization, annotation, logging, or debugging but which cannot have any effect on the behavior of a System or the evolution of a Study.

DO NOT confuse this with real geometry (like contact geometry) which can represent physically meaningful objects that may interact and change the behavior of a System. However, all geometry objects can generate DecorativgeGeometry for their visualization.

Why is there a DecorativeGeometry facility at the System level at all, so far away from any application program? That's because for crude visualization and debugging purposes, the Subsystems themselves are best able to produce some illustrative geometry. Otherwise, you need a special purpose visualization tool which understands what's going on inside each subsystem. If you don't mind taking what you get, just ask each subsystem to generate what it thinks would be helpful visualization. To do that, the subysystems need a way to talk about geometry without knowing anything about how that geometry will eventually get onto someone's screen. And that's why we're here!

Each DecorativeGeometry object has its own local coordinate system and is defined self-consistently but independent of anything else. Clients can associate these with a reference frame (e.g. a body), and place the local frame of the geometry objects on the reference frame, or at a fixed transform from the reference frame. That places the DecorativeGeometry objects in a scene. We support both 3D objects which are attached to actors in the scene, and 2D "screen" objects like titles which are attached to the display rather than the actors. The classes here deal only with the local-frame definitions of the geometric objects, not their placement in the scene.

This is an abstract handle class using the PIMPL design pattern to hide the private implementation. This is effectively an abstract class although the virtual function table is hidden in the private part.

Member Enumeration Documentation

Enumerator
DrawPoints 
DrawWireframe 
DrawSurface 
DrawDefault 

Constructor & Destructor Documentation

SimTK::DecorativeGeometry::DecorativeGeometry ( )
inline
SimTK::DecorativeGeometry::~DecorativeGeometry ( )
SimTK::DecorativeGeometry::DecorativeGeometry ( const DecorativeGeometry )
SimTK::DecorativeGeometry::DecorativeGeometry ( class DecorativeGeometryRep *  r)
inlineexplicit

Member Function Documentation

DecorativeGeometry& SimTK::DecorativeGeometry::operator= ( const DecorativeGeometry )
DecorativeGeometry& SimTK::DecorativeGeometry::setBodyId ( int  )

By default the geometry will be placed on ground.

If you want it attached to another reference frame (body), say so here. The geometry should be rendered with respect to the indicated body frame; however, the interpretation of this integer Id is left to the implementation.

DecorativeGeometry& SimTK::DecorativeGeometry::setTransform ( const Transform X_BG)

This transform shifts the generated polygons with respect to this object's local frame.

Subsequent calls with other transforms simply replace the earlier one; they do not accumulate. The default transform is identity and you can call setTransform(Transform()) to put the transform back into its original state. This value affects the generated polygonal data.

DecorativeGeometry& SimTK::DecorativeGeometry::setResolution ( Real  )

Each concrete DecorativeGeometry object is expected to have a default resolution that gets the point across but is cheap to draw and hence probably somewhat "chunky".

The resolution parameter here scales that default up or down. The face density in the displayed representation is roughly proportional to this value. 1.0 means to use the default resolution. Values less than 1.0 are lower resolution, and values greater than 1.0 are higher resolution. A value less than or equal to zero here is interpreted as an instruction to "use the default".

DecorativeGeometry& SimTK::DecorativeGeometry::setScaleFactors ( const Vec3 scale)

Each concrete DecorativeGeometry object is expected to have a default size around "1", whatever that means for a particular object, and most objects also allow a user-specified size on construction.

The x,y,z scale factors here are given in the object's coordinate frame, and apply to the object as the user built it, or to the default if the user didn't specify a size. The default scaling is 1,1,1 and any value less than or equal to zero here is interpreted as a request to "use the default" in that direction.

DecorativeGeometry& SimTK::DecorativeGeometry::setScale ( Real  scale)
inline

Convenience method to set all three scale factors to the same value.

int SimTK::DecorativeGeometry::getBodyId ( ) const

Return the body to which this geometry is attached.

The geometry's placement is interpreted relative to the body's frame.

Real SimTK::DecorativeGeometry::getResolution ( ) const

Return the current setting of the "resolution" factor.

A return value of -1 means "use the default".

const Transform& SimTK::DecorativeGeometry::getTransform ( ) const

Return the current value of the object's transform.

If none has been set this will be the identity transform. Note that this transform specifies how the polygons are placed with respect to the object's local frame.

const Vec3& SimTK::DecorativeGeometry::getScaleFactors ( ) const

Return the current setting of the "scale" factors.

A return value of -1 in one of the factors means to "use the default" (which is typically 1) in that direction.

DecorativeGeometry& SimTK::DecorativeGeometry::setColor ( const Vec3 rgb)

Request a specific color for this DecorativeGeometry object.

The default is that the color is determined elsewhere. To explicitly request the default, set the color to Vec3(-1). The implementation will check the 0'th element (that is, the "R" element) and if it is less than zero will ignore the other two elements and use the default for all three.

DecorativeGeometry& SimTK::DecorativeGeometry::setOpacity ( Real  )

Request a level of transparency for this DecorativeGeometry.

This does NOT affect the generated geometry here. The default is that opacity is determined elsewhere.

DecorativeGeometry& SimTK::DecorativeGeometry::setLineThickness ( Real  )

Request an adjustment to the default rendering of lines and curves.

This does NOT affect geometry generated here; it is a request passed on to the renderer which will probably pass it on to the hardware. A value less than or equal to zero here is interpreted as "use the default".

const Vec3& SimTK::DecorativeGeometry::getColor ( ) const

Return the color specified for this object, if any, otherwise Vec3(-1) indicating that the default color will be used.

Real SimTK::DecorativeGeometry::getOpacity ( ) const

Return the opacity specified for this object.

Real SimTK::DecorativeGeometry::getLineThickness ( ) const

Return the line thickness specified for this object, if any, otherwise return -1 to indicate that the default line thickness should be used.

DecorativeGeometry& SimTK::DecorativeGeometry::setFaceCamera ( int  shouldFace)

Set whether the geometry acts as a billboard, always rotating to face the camera.

The default is typically no except for text. If you want 3D text that moves with your model, set this to true. Here 0 means false, 1 means true, and -1 means "use default".

int SimTK::DecorativeGeometry::getFaceCamera ( ) const

Get whether the geometry acts as a billboard, always rotating to face the camera.

Returns 0 for no, 1 for yes, -1 for "is using default".

DecorativeGeometry& SimTK::DecorativeGeometry::setRepresentation ( const Representation )

Request a particular rendering representation of this DecorativeGeometry object.

The default is that the rendering representation choice is made elsewhere.

Representation SimTK::DecorativeGeometry::getRepresentation ( ) const

Returns drawing mode: -1 means "use default"; see above for others.

void SimTK::DecorativeGeometry::implementGeometry ( DecorativeGeometryImplementation ) const
bool SimTK::DecorativeGeometry::isOwnerHandle ( ) const
bool SimTK::DecorativeGeometry::isEmptyHandle ( ) const
bool SimTK::DecorativeGeometry::hasRep ( ) const
inline
const DecorativeGeometryRep& SimTK::DecorativeGeometry::getRep ( ) const
inline
DecorativeGeometryRep& SimTK::DecorativeGeometry::updRep ( )
inline

Member Data Documentation

DecorativeGeometryRep* SimTK::DecorativeGeometry::rep
protected

The documentation for this class was generated from the following file: