API 4.4.1-2022-10-19-2c4045e59
For MATLAB, Python, Java, and C++ users
|
This class manages runtime visualization of a Model that is being manipulated through the OpenSim API. More...
Public Member Functions | |
~ModelVisualizer () | |
Drawing methods | |
Currently there is just a single method for generating a frame. | |
void | show (const SimTK::State &state) const |
Evaluate the geometry needed to visualize the given state and use it to generate a new image in the Visualizer window. More... | |
Access to SimTK::Visualizer features | |
These methods provide access to lower-level SimTK::Visualizer objects that are used in the implementation of this ModelVisualizer. | |
const SimTK::Visualizer::InputSilo & | getInputSilo () const |
If you want to poll for user input, you'll need access to the SimTK::Visualizer::InputSilo maintained here. More... | |
SimTK::Visualizer::InputSilo & | updInputSilo () |
Get writable access to the InputSilo so you can remove user input from the queues. More... | |
const SimTK::Visualizer & | getSimbodyVisualizer () const |
If you want access to the underlying Simbody SimTK::Visualizer, you can get a const reference here. More... | |
SimTK::Visualizer & | updSimbodyVisualizer () |
If you want writable access to the underlying Simbody SimTK::Visualizer, you can get a non-const reference here, provided that you have non-const access to the ModelVisualizer. More... | |
Miscellaneous utilities | |
SimTK::DefaultGeometry * | getGeometryDecorationGenerator () |
Return a pointer to the DefaultGeometry decoration generator used by this ModelVisualizer. More... | |
const Model & | getModel () const |
Return a const reference to the Model for which this ModelVisualizer was constructed. More... | |
Model & | updModel () |
Return a writable reference to the Model for which this ModelVisualizer was constructed. More... | |
static bool | findGeometryFile (const Model &model, const std::string &geoFile, bool &isAbsolute, SimTK::Array_< std::string > &attempts) |
Given the name of a geometry file, this method will attempt to find it in a series of locations using the same algorithm as is done internally by the ModelVisualizer. More... | |
static void | addDirToGeometrySearchPaths (const std::string &dir) |
Add a directory to the search path to be used by the function findGeometryFile. More... | |
This class manages runtime visualization of a Model that is being manipulated through the OpenSim API.
You should not allocate one of these yourself; instead, call the Model's setUseVisualizer() method and let the Model allocate one for itself. You may find the defaults to be adequate, but you can also get access to the ModelVisualizer if you need it by calling the Model's getVisualizer() method.
The ModelVisualizer consults the Model's ModelDisplayHints object for instructions on what to display.
The Simbody visualizer binary needs to be found at runtime to create a visualizer. The search proceeds in the following order: Directory of the currently running executable/binary. Directories referred to by the environment variable PATH. Possible locations for simbody installations: – SIMBODY_HOME/bin if the environment variable SIMBODY_HOME exists. – SimTK_INSTALL_DIR/bin if the environment variable SIMBODY_HOME exists. – Platform specific default locations of binaries. For Linux/MacOS, this may be /usr/bin, /usr/local/bin etc. For Windows, this set is empty.
|
inline |
|
static |
Add a directory to the search path to be used by the function findGeometryFile.
The added paths are searched in the reverse-chronological order – the latest path added is searched first.
|
static |
Given the name of a geometry file, this method will attempt to find it in a series of locations using the same algorithm as is done internally by the ModelVisualizer.
[in] | model | Used to obtain the name of the file from which the model was loaded. |
[in] | geoFile | Name of file to look for; can be absolute or relative path name or just a file name and the extension must be supplied. |
[out] | isAbsolute | This output parameter is set to true on return if the supplied geoFile was an absolute path name; in that case no searching was done. |
[out] | attempts | On return, this is a list of the absolute path names that were tried. If geoFile was found, attempts.back() (the last entry) is the absolute path name of geoFile. The last entry of this array will be the path that succeeded in finding the geometry file. |
true
if geoFile was located and is readable.The search rule is as follows:
No attempt is made to validate the contents of the file or whether it has a supported extension; we're just looking for a file of the given name that exists and is readable.
|
inline |
Return a pointer to the DefaultGeometry decoration generator used by this ModelVisualizer.
|
inline |
If you want to poll for user input, you'll need access to the SimTK::Visualizer::InputSilo maintained here.
Writable access is required to remove user input from the queues.
|
inline |
Return a const reference to the Model for which this ModelVisualizer was constructed.
|
inline |
If you want access to the underlying Simbody SimTK::Visualizer, you can get a const reference here.
void OpenSim::ModelVisualizer::show | ( | const SimTK::State & | state | ) | const |
Evaluate the geometry needed to visualize the given state and use it to generate a new image in the Visualizer window.
|
inline |
Get writable access to the InputSilo so you can remove user input from the queues.
|
inline |
Return a writable reference to the Model for which this ModelVisualizer was constructed.
|
inline |
If you want writable access to the underlying Simbody SimTK::Visualizer, you can get a non-const reference here, provided that you have non-const access to the ModelVisualizer.