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 *node, const ChFrame<> &frame)
 
int DrawAllContactPoints (const ChVisualSystemIrrlicht *vis, double len=1.0, ContactsDrawMode drawtype=ContactsDrawMode::CONTACT_NORMALS)
 Draw contact points used by a ChSystem in the current Irrlicht viewer. More...
 
int DrawAllContactLabels (const ChVisualSystemIrrlicht *vis, ContactsLabelMode labeltype=ContactsLabelMode::CONTACT_FORCES_N_VAL, ChColor col=ChColor(1.f, 1.f, 1.f))
 Draw contact information as labels at the contact point.
 
int DrawAllLinks (const ChVisualSystemIrrlicht *vis, double len=1.0, LinkDrawMode drawtype=LinkDrawMode::LINK_REACT_FORCE)
 Draw reaction forces in all contacts in current Irrlicht viewer.
 
int DrawAllLinkLabels (const ChVisualSystemIrrlicht *vis, LinkLabelMode labeltype=LinkLabelMode::LINK_REACT_FORCE_X, ChColor col=ChColor(1.f, 1.f, 1.f))
 Draw contact information as labels at the contact point.
 
int DrawAllBoundingBoxes (const ChVisualSystemIrrlicht *vis)
 Draw collision objects bounding boxes for rigid bodies (if they have a collision shape).
 
int DrawAllCOMs (const ChVisualSystemIrrlicht *vis, double scale=0.01)
 Draw coordinate systems of ChBody objects.
 
int DrawAllLinkframes (const ChVisualSystemIrrlicht *vis, double scale=0.01)
 Draw coordinate systems of link frames.
 
void DrawSolverViolation (const ChVisualSystemIrrlicht *vis, int pos_x=10, int pos_y=290, int width=300, int height=100)
 Draw the plot of solver violation history. More...
 
void DrawChFunction (const 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 (const ChVisualSystemIrrlicht *vis, const ChVector3d &start, const ChVector3d &end, const ChColor &col=ChColor(1.f, 1.f, 1.f), bool use_Zbuffer=false)
 Draw line segments in 3D space with given color.
 
void DrawPolyline (const ChVisualSystemIrrlicht *vis, const std::vector< ChVector3d > &points, const 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 (const ChVisualSystemIrrlicht *vis, double radius, const ChCoordsysd &coord=CSYSNORM, const 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 (const ChVisualSystemIrrlicht *vis, double radius, const ChVector3d &start, const ChVector3d &end, const 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 (const ChVisualSystemIrrlicht *vis, const ChCoordsysd &pos, double radius, double start_angle, double end_angle, const ChColor &col=ChColor(1.f, 1.f, 1.f), int resolution=65, bool use_Zbuffer=false)
 Draw a rotational spring in 3D space with given color. More...
 
void DrawGrid (const ChVisualSystemIrrlicht *vis, double ustep=0.1, double vstep=0.1, int nu=20, int nv=20, const ChCoordsysd &pos=CSYSNORM, const 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 (const ChVisualSystemIrrlicht *vis, const ChColormap &colormap, 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 (const ChVisualSystemIrrlicht *vis, ChMatrixConstRef X, ChMatrixConstRef Y, ChMatrixConstRef Z, const ChCoordsysd &coord, const 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 (const ChVisualSystemIrrlicht *vis)
 Render run-time profiler info.
 
void DrawCoordsys (const ChVisualSystemIrrlicht *vis, const ChCoordsysd &coord=CSYSNORM, double scale=1, bool use_Zbuffer=false)
 Draw RGB coordinate system.
 
void DrawArrow (const ChVisualSystemIrrlicht *vis, const ChVector3d &start, const ChVector3d &end, const ChVector3d &plane_normal=VECT_Y, bool sharp=true, 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 (const 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 *node, const ChFrame<> &frame)
 Align an Irrlicht object to a the specified frame.
 
ChApiIrr void DrawChFunction (const 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 ( const ChVisualSystemIrrlicht vis,
double  len = 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 ( const 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 ( const 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 ( const ChVisualSystemIrrlicht vis,
double  radius,
const ChCoordsysd coord = CSYSNORM,
const 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 ( const ChVisualSystemIrrlicht vis,
const ChColormap colormap,
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
colormapcurrent colormap
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

◆ DrawRotSpring()

ChApiIrr void chrono::irrlicht::tools::DrawRotSpring ( const ChVisualSystemIrrlicht vis,
const ChCoordsysd pos,
double  radius,
double  start_angle,
double  end_angle,
const ChColor col = ChColor(1.f, 1.f, 1.f),
int  resolution = 65,
bool  use_Zbuffer = false 
)

Draw a rotational spring in 3D space with given color.

Specify the radius, start and end angles, and the resolution (i.e. the number of segments approximating the curve).

◆ DrawSolverViolation()

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

Draw the plot of solver violation history.

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 represents 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 ( const ChVisualSystemIrrlicht vis,
double  radius,
const ChVector3d start,
const ChVector3d end,
const 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.