chrono::irrlicht::tools Namespace Reference

Description

Utilities for interfacing Chrono and Irrlicht.

Functions

video::SColorf ToIrrlichtSColorf (const ChColor &col)
 Convert a ChColor to an Irrlicht SColorf.
 
video::SColor ToIrrlichtSColor (const ChColor &col, float alpha=1.0)
 Convert an RGB set and an opacity value to an Irrlicht SColor.
 
video::SMaterial ToIrrlichtMaterial (std::shared_ptr< ChVisualMaterial > mat, video::IVideoDriver *driver)
 
void alignIrrlichtNode (scene::ISceneNode *mnode, const ChCoordsys<> &mcoords)
 
int drawAllContactPoints (ChVisualSystemIrrlicht *vis, double mlen=1.0, ContactsDrawMode drawtype=ContactsDrawMode::CONTACT_NORMALS)
 Draw contact points used by a ChSystem in the current Irrlicht viewer. More...
 
int drawAllContactLabels (ChVisualSystemIrrlicht *vis, ContactsLabelMode labeltype=ContactsLabelMode::CONTACT_FORCES_N_VAL, ChColor col=ChColor(1.f, 1.f, 1.f))
 Draw contact informations as labels at the contact point.
 
int drawAllLinks (ChVisualSystemIrrlicht *vis, double mlen=1.0, LinkDrawMode drawtype=LinkDrawMode::LINK_REACT_FORCE)
 Draw reaction forces in all contacts in current Irrlicht viewer.
 
int drawAllLinkLabels (ChVisualSystemIrrlicht *vis, LinkLabelMode labeltype=LinkLabelMode::LINK_REACT_FORCE_X, ChColor col=ChColor(1.f, 1.f, 1.f))
 Draw contact informations as labels at the contact point.
 
int drawAllBoundingBoxes (ChVisualSystemIrrlicht *vis)
 Draw collision objects bounding boxes for rigid bodies (if they have a collision shape).
 
int drawAllCOGs (ChVisualSystemIrrlicht *vis, double scale=0.01)
 Draw coordinate systems of ChBody objects.
 
int drawAllLinkframes (ChVisualSystemIrrlicht *vis, double scale=0.01)
 Draw coordinate systems of link frames.
 
void drawHUDviolation (ChVisualSystemIrrlicht *vis, int pos_x=10, int pos_y=290, int width=300, int height=100)
 Draw the plot of solver violations. More...
 
void drawChFunction (ChVisualSystemIrrlicht *vis, std::shared_ptr< chrono::ChFunction > fx, double xmin, double xmax, double ymin, double ymax, int pos_x, int pos_y, int width, int height, chrono::ChColor col, std::string title)
 
void drawSegment (ChVisualSystemIrrlicht *vis, ChVector3d start, ChVector3d end, ChColor col=ChColor(1.f, 1.f, 1.f), bool use_Zbuffer=false)
 Draw line segments in 3D space with given color.
 
void drawPolyline (ChVisualSystemIrrlicht *vis, std::vector< ChVector3d > &points, ChColor col=ChColor(1.f, 1.f, 1.f), bool use_Zbuffer=false)
 Draw a polyline in 3D space, given the array of points.
 
void drawCircle (ChVisualSystemIrrlicht *vis, double radius, ChCoordsys<> pos=CSYSNORM, ChColor col=ChColor(1.f, 1.f, 1.f), int resolution=36, bool use_Zbuffer=false)
 Draw a circle line in 3D space with given color. More...
 
void drawSpring (ChVisualSystemIrrlicht *vis, double radius, ChVector3d start, ChVector3d end, ChColor col=ChColor(1.f, 1.f, 1.f), int resolution=65, double turns=5, bool use_Zbuffer=false)
 Draw a spring in 3D space with given color. More...
 
void drawRotSpring (ChVisualSystemIrrlicht *vis, ChCoordsys<> pos, double radius, double start_angle, double end_angle, chrono::ChColor col, int resolution, bool use_Zbuffer)
 
void drawGrid (ChVisualSystemIrrlicht *vis, double ustep=0.1, double vstep=0.1, int nu=20, int nv=20, ChCoordsys<> pos=CSYSNORM, ChColor col=ChColor(0.7f, 0.7f, 0.7f), bool use_Zbuffer=false)
 Draw grids in 3D space with given orientation, color, and spacing.
 
void drawColorbar (ChVisualSystemIrrlicht *vis, double value_min, double value_max, const std::string &label, int pos_x=740, int pos_y=20, int width=30, int height=300)
 Draw color bar with a color map and 2D legend. More...
 
void drawPlot3D (ChVisualSystemIrrlicht *vis, ChMatrixConstRef X, ChMatrixConstRef Y, ChMatrixConstRef Z, ChCoordsys<> pos, chrono::ChColor col, bool use_Zbuffer)
 
void drawProfilerRecursive (utils::ChProfileIterator *profileIterator, irr::IrrlichtDevice *device, int mx, int my, int sx, int sy, int xspacing, int &ypos)
 
void drawProfiler (ChVisualSystemIrrlicht *vis)
 Render run-time profiler info.
 
void drawCoordsys (ChVisualSystemIrrlicht *vis, const ChCoordsys<> &coord=CSYSNORM, double scale=1, bool use_Zbuffer=false)
 Draw RGB coordinate system.
 
void drawArrow (ChVisualSystemIrrlicht *vis, const ChVector3d &start, const ChVector3d &end, const ChVector3d &plane_normal=VECT_Y, bool sharp=false, const ChColor &col=ChColor(1.f, 1.f, 1.f), bool use_Zbuffer=false)
 Draw a line arrow in 3D space with given color. More...
 
void drawLabel3D (ChVisualSystemIrrlicht *vis, const std::string &text, const ChVector3d &position, const ChColor &color=ChColor(0.f, 0.f, 0.f), bool use_Zbuffer=false)
 Draw a label in 3D scene at given position.
 
ChApiIrr irr::video::SMaterial ToIrrlichtMaterial (std::shared_ptr< ChVisualMaterial > mat, irr::video::IVideoDriver *driver)
 Convert a ChVisualMaterial to an Irrlicht material.
 
ChApiIrr void alignIrrlichtNode (irr::scene::ISceneNode *mnode, const ChCoordsys<> &mcoords)
 Align an Irrlicht object to a the specified coordinate system.
 
ChApiIrr void drawChFunction (ChVisualSystemIrrlicht *vis, std::shared_ptr< ChFunction > fx, double xmin=0, double xmax=1, double ymin=-1, double ymax=1, int pos_x=10, int pos_y=290, int width=300, int height=100, ChColor col=ChColor(1.f, 0.f, 0.f), std::string title="")
 Draw function value. More...
 

Function Documentation

◆ drawAllContactPoints()

ChApiIrr int chrono::irrlicht::tools::drawAllContactPoints ( ChVisualSystemIrrlicht vis,
double  mlen = 1.0,
ContactsDrawMode  drawtype = ContactsDrawMode::CONTACT_NORMALS 
)

Draw contact points used by a ChSystem in the current Irrlicht viewer.

The contact points are visually represented with short lines, of length mlen, aligned to contact normals.

◆ drawArrow()

ChApiIrr void chrono::irrlicht::tools::drawArrow ( ChVisualSystemIrrlicht vis,
const ChVector3d start,
const ChVector3d end,
const ChVector3d plane_normal,
bool  sharp,
const ChColor col,
bool  use_Zbuffer 
)

Draw a line arrow in 3D space with given color.

Parameters
visvisual system
startarrow start point
endarrow end point
plane_normalnormal to plane containing arrow segments
sharpset arrow shape as 'sharp' or 'wide'
colcolor
use_Zbufferuse Z buffer

◆ drawChFunction()

ChApiIrr void chrono::irrlicht::tools::drawChFunction ( ChVisualSystemIrrlicht vis,
std::shared_ptr< ChFunction fx,
double  xmin = 0,
double  xmax = 1,
double  ymin = -1,
double  ymax = 1,
int  pos_x = 10,
int  pos_y = 290,
int  width = 300,
int  height = 100,
ChColor  col = ChColor(1.f, 0.f, 0.f),
std::string  title = "" 
)

Draw function value.

Plot widget coordinates are considered from top-left corner of the Irrlicht window.

Parameters
visvisual system
fxfunction to draw
xminminimum X of the plot
xmaxmaximum X of the plot
yminminimum Y of the plot
ymaxmaximum Y of the plot
pos_xtop-left corner X position of the plot window
pos_ytop-left corner Y position of the plot window
widthwidth of the plot window
heightheight of the plot window
colcolor of the plot line
titletitle of the plot

◆ drawCircle()

ChApiIrr void chrono::irrlicht::tools::drawCircle ( ChVisualSystemIrrlicht vis,
double  radius,
ChCoordsys<>  pos = CSYSNORM,
ChColor  col = ChColor(1.f, 1.f, 1.f),
int  resolution = 36,
bool  use_Zbuffer = false 
)

Draw a circle line in 3D space with given color.

The circle is centered in the X-Y plane of the provided coordinate system.

◆ drawColorbar()

ChApiIrr void chrono::irrlicht::tools::drawColorbar ( ChVisualSystemIrrlicht vis,
double  value_min,
double  value_max,
const std::string &  label,
int  pos_x = 740,
int  pos_y = 20,
int  width = 30,
int  height = 300 
)

Draw color bar with a color map and 2D legend.

Plot widget coordinates are considered from top-left corner of the Irrlicht window.

Parameters
visvisual system
value_minminimum value of the color map
value_maxmaximum value of the color map
labellabel of the color bar
pos_xtop-left corner X position of the color bar
pos_ytop-left corner Y position of the color bar
widthwidth of the color bar
heightheight of the color bar

◆ drawHUDviolation()

ChApiIrr void chrono::irrlicht::tools::drawHUDviolation ( ChVisualSystemIrrlicht vis,
int  pos_x = 10,
int  pos_y = 290,
int  width = 300,
int  height = 100 
)

Draw the plot of solver violations.

Each vertical red bar of the plot represents the residual during the solver iterations. The rightmost red bar represents the residual after the latest iteration. The red horizontal line respresents the tolerance requested to the solver. If the last red bar does not fall below the red line, the solver did not converge. The Y axis is logarithmic for the error (residual) and ranges from log10(tol)-1 to log10(tol)+2. If the tolerance is set to 0 the graphics will consider a default tolerance of 1e-6. It is then recommended to increase the number of iterations, reduce the timestep or consider relaxing the tolerance. Yellow bars refer to the variation of Lagrange multipliers during the iterations (VI solvers only). For them, the Y axis ranges from zero to the maximum variation observed among all the iterations of the last step (linear scale).

◆ drawSpring()

ChApiIrr void chrono::irrlicht::tools::drawSpring ( ChVisualSystemIrrlicht vis,
double  radius,
ChVector3d  start,
ChVector3d  end,
ChColor  col = ChColor(1.f, 1.f, 1.f),
int  resolution = 65,
double  turns = 5,
bool  use_Zbuffer = false 
)

Draw a spring in 3D space with given color.

Specify the radius, the end points in absolute space, the resolution (i.e. the number of segments approximating the helix) and the number of turns.