1 #ifndef SimTK_SIMBODY_VISUALIZER_H_
2 #define SimTK_SIMBODY_VISUALIZER_H_
38 class MultibodySystem;
39 class DecorationGenerator;
582 const Array_<std::pair<String, int> >& items);
738 const Impl& getImpl()
const {assert(impl);
return *impl;}
739 Impl& updImpl() {assert(impl);
return *impl;}
796 const Vec3& stationPinB =
Vec3(0, 0, 0),
807 const Vec3& m_stationPinB;
808 const Vec3& m_offset;
Every Simbody header and source file should include this header before any other Simbody header.
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
The Array_<T> container class is a plug-compatible replacement for the C++ standard template library ...
Definition: Array.h:1520
A CoordinateDirection is a CoordinateAxis plus a direction indicating the positive or negative direct...
Definition: CoordinateAxis.h:244
A DecorationGenerator is used to define geometry that may change over the course of a simulation.
Definition: DecorationGenerator.h:45
This is the client-side interface to an implementation-independent representation of "Decorations" su...
Definition: DecorativeGeometry.h:86
A line between two points.
Definition: DecorativeGeometry.h:306
This is for arrays indexed by mobilized body number within a subsystem (typically the SimbodyMatterSu...
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:65
Causes the camera to point at and follow a point fixed on a body (a station).
Definition: Visualizer.h:775
void generateControls(const Visualizer &viz, const State &state, Array_< DecorativeGeometry > &geometry) override
The Visualizer is just about to generate and render a frame corresponding to the given State.
BodyFollower(const MobilizedBody &mobodB, const Vec3 &stationPinB=Vec3(0, 0, 0), const Vec3 &offset=Vec3(NaN), const UnitVec3 &upDirection=UnitVec3())
This abstract class represents an object that will be invoked by the Visualizer just prior to renderi...
Definition: Visualizer.h:748
virtual void generateControls(const Visualizer &viz, const State &state, Array_< DecorativeGeometry > &geometry)=0
The Visualizer is just about to generate and render a frame corresponding to the given State.
virtual ~FrameController()
Destructor is virtual; be sure to override it if you have something to clean up at the end.
Definition: Visualizer.h:767
This is an EventReporter that makes it easy to generate on-screen movies of any simulation.
Definition: Visualizer_Reporter.h:51
Provide simple visualization of and interaction with a Simbody simulation, with real time control of ...
Definition: Visualizer.h:147
int getActualBufferLengthInFrames() const
Get the actual length of the real time frame buffer in number of frames.
Visualizer & setShutdownWhenDestructed(bool shouldShutdown)
Set the flag that determines whether we will automatically send a Shutdown message to the visualizer ...
BackgroundType
These are the types of backgrounds the visualizer currently supports.
Definition: Visualizer.h:254
const FrameController & getFrameController(int i) const
Return a const reference to the i'th frame controller.
Visualizer & setDesiredBufferLengthInSec(Real bufferLengthInSec)
When running an interactive realtime simulation, you can smooth out changes in simulation run rate by...
FrameController & updFrameController(int i)
Return a writable reference to the i'th frame controller.
const DecorativeGeometry & getDecoration(int i) const
Return a const reference to the i'th decoration.
DecorativeGeometry & updDecoration(int i) const
Return a writable reference to the i'th decoration.
Visualizer & addSlider(const String &title, int id, Real min, Real max, Real value)
Add a new slider to the visualizer's display.
int addRubberBandLine(MobilizedBodyIndex b1, const Vec3 &station1, MobilizedBodyIndex b2, const Vec3 &station2, const DecorativeLine &line)
Add an always-present rubber band line, modeled after the DecorativeLine supplied here.
int getNumInputListeners() const
Return the count of input listeners added with addInputListener().
void clearStats()
Reset all statistics to zero.
const DecorationGenerator & getDecorationGenerator(int i) const
Return a const reference to the i'th decoration generator.
int getNumDecorations() const
Return the count of decorations added with addDecoration().
Visualizer(const MultibodySystem &system)
Construct a new Visualizer for the indicated System, and launch the visualizer display executable fro...
const Visualizer & setShowSimTime(bool showSimTime) const
Control whether simulation time is shown in the Visualizer. This is a const method so you can call it...
Visualizer & operator=(const Visualizer &src)
Copy assignment has reference counted, shallow copy semantics; that is, the Visualizer copy is just a...
Visualizer & addMenu(const String &title, int id, const Array_< std::pair< String, int > > &items)
Add a new pull-down menu to the visualizer's display.
void report(const State &state) const
Report that a new simulation frame is available for rendering.
void drawFrameNow(const State &state) const
This method draws a frame unconditionally without queuing or checking the frame rate.
const Visualizer & pointCameraAt(const Vec3 &point, const Vec3 &upDirection) const
Rotate the camera so that it looks at a specified point.
Mode getMode() const
Get the current mode being used by the Visualizer.
Visualizer & setMode(Mode mode)
Set the operating mode for the Visualizer.
DecorationGenerator & updDecorationGenerator(int i)
Return a writable reference to the i'th decoration generator.
Real getDesiredBufferLengthInSec() const
Get the current value of the desired buffer time length the Visualizer has been asked to use for smoo...
const Visualizer & setCameraFieldOfView(Real fov) const
Set the camera's vertical field of view, measured in radians.
const MultibodySystem & getSystem() const
DecorativeLine & updRubberBandLine(int i) const
Return a writable reference to the i'th rubber band line.
const Visualizer & setSliderValue(int slider, Real value) const
Change the value currently shown on one of the sliders.
int getNumRubberBandLines() const
Return the count of rubber band lines added with addRubberBandLine().
Real getGroundHeight() const
Get the value the Visualizer considers to be the height of the ground plane for this System....
int getNumDecorationGenerators() const
Return the count of decoration generators added with addDecorationGenerator().
const Visualizer & setBackgroundColor(const Vec3 &color) const
Set the background color. This will be used when the solid background mode is in effect but has no ef...
const Visualizer & setShowFrameRate(bool showFrameRate) const
Control whether frame rate is shown in the Visualizer. This is a const method so you can call it from...
const Visualizer & setShowFrameNumber(bool showFrameNumber) const
Control whether frame number is shown in the Visualizer. This is a const method so you can call it fr...
void flushFrames() const
In RealTime mode there will typically be frames still in the buffer at the end of a simulation....
const InputListener & getInputListener(int i) const
Return a const reference to the i'th input listener.
Real getDesiredFrameRate() const
Get the current value of the frame rate the Visualizer has been asked to attempt; this is not necessa...
int addInputListener(InputListener *listener)
Add a new input listener to this Visualizer, methods of which will be called when the GUI detects use...
int addDecorationGenerator(DecorationGenerator *generator)
Add a DecorationGenerator that will be invoked to add dynamically generated geometry to each frame of...
void shutdown()
Ask the visualizer to shut itself down immediately.
const Visualizer & setWindowTitle(const String &title) const
Change the title on the main visualizer window. The default title is Simbody version : exename,...
Visualizer & setRealTimeScale(Real simTimePerRealSecond)
In RealTime mode we normally assume that one unit of simulated time should map to one second of real ...
int addDecoration(MobilizedBodyIndex mobodIx, const Transform &X_BD, const DecorativeGeometry &geometry)
Add an always-present, body-fixed piece of geometry like the one passed in, but attached to the indic...
const Visualizer & zoomCameraToShowAllGeometry() const
Move the camera forward or backward so that all geometry in the scene is visible.
int getNumFrameControllers() const
Return the count of frame controllers added with addFrameController().
const DecorativeLine & getRubberBandLine(int i) const
Return a const reference to the i'th rubber band line.
Visualizer & setBackgroundType(BackgroundType background)
Change the background mode currently in effect in the GUI. By default we take the desired background ...
void dumpStats(std::ostream &o) const
Dump statistics to the given ostream (for example, std::cout).
Visualizer & setGroundHeight(Real height)
Set the height at which the ground plane should be displayed when the GroundAndSky background type is...
const Array_< InputListener * > & getInputListeners() const
const Visualizer & setSliderRange(int slider, Real newMin, Real newMax) const
Change the allowed range for one of the sliders.
InputListener & updInputListener(int i)
Return a writable reference to the i'th input listener.
const Visualizer & setShowShadows(bool showShadows) const
Control whether shadows are generated when the GroundAndSky background type is in effect....
int addFrameController(FrameController *controller)
Add a new frame controller to this Visualizer, methods of which will be called just prior to renderin...
Real getRealTimeScale() const
Return the current time scale, which will be 1 by default.
Visualizer(const MultibodySystem &system, const Array_< String > &searchPath)
Construct a new Visualizer for a given system, with a specified search path for locating the SimbodyV...
const Visualizer & setCameraTransform(const Transform &X_GC) const
Set the transform defining the position and orientation of the camera.
bool getShutdownWhenDestructed() const
Return the current setting of the "shutdown when destructed" flag.
~Visualizer()
InputListener, FrameController, and DecorationGenerator objects are destroyed here when the last refe...
Visualizer & setDesiredFrameRate(Real framesPerSec)
Set the frame rate in frames/sec (of real time) that you want the Visualizer to attempt to achieve.
CoordinateDirection getSystemUpDirection() const
Get the value the Visualizer is using as the System "up" direction ( not to be confused with the came...
Visualizer & setSystemUpDirection(const CoordinateDirection &upDirection)
Set the coordinate direction that should be considered the System's "up" direction....
PredefinedMenuIds
The visualizer may predefine some menus; if you need to refer to one of those use its menu Id as defi...
Definition: Visualizer.h:265
Real getActualBufferLengthInSec() const
Get the actual length of the real time frame buffer in seconds, which may differ from the requested t...
Visualizer(const Visualizer &src)
Copy constructor has reference counted, shallow copy semantics; that is, the Visualizer copy is just ...
const Array_< FrameController * > & getFrameControllers() const
const Visualizer & setCameraClippingPlanes(Real nearPlane, Real farPlane) const
Set the distance from the camera to the near and far clipping planes.
Mode
These are the operating modes for the Visualizer, with PassThrough the default mode.
Definition: Visualizer.h:239
Vec< 3 > Vec3
This is the most common 3D vector type: a column of 3 Real values stored consecutively in memory (pac...
Definition: SmallMatrix.h:129
const Real NaN
This is the IEEE "not a number" constant for this implementation of the default-precision Real type; ...
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
ELEM min(const VectorBase< ELEM > &v)
Definition: VectorMath.h:178
UnitVec< Real, 1 > UnitVec3
Definition: UnitVec.h:41
Visualizer VTKVisualizer
OBSOLETE: This provides limited backwards compatibility with the old VTK Visualizer that is no longer...
Definition: Visualizer.h:814
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:607