Description

Collaboration diagram for Utility classes:

Classes

class  chrono::utils::ChBenchmarkTest
 Base class for a Chrono benchmark test. More...
 
class  chrono::utils::ChBenchmarkFixture< TEST, SKIP >
 Generic benchmark fixture for Chrono tests. More...
 
class  chrono::utils::ChBodyGeometry
 Utility class defining geometry (visualization and collision) and contact materials for a rigid body. More...
 
class  chrono::utils::ChTSDAGeometry
 Utility class defining visualization geometry for a TSDA. More...
 
class  chrono::utils::CompositeInertia
 Utility class for calculating inertia properties of a composite body. More...
 
class  chrono::utils::ChControllerPID
 Simple PID controller. More...
 
class  chrono::utils::ChConvexHull2D
 Simple 2D convex hull class. More...
 
class  chrono::utils::ChRunningAverage
 Moving average filter for smoothing running data. More...
 
class  chrono::utils::ChMovingAverage
 Moving average filter for smoothing a data array. More...
 
class  chrono::utils::ChAnalogueFilter
 Base class for simulated analogue filters in the time domain. More...
 
class  chrono::utils::ChFilterI
 Calculate the integral of an input signal in the time domain: H(s) = 1 / ( Ti * s) More...
 
class  chrono::utils::ChFilterD
 Caclulate the time derivation of an input signal: H(s) = Td * s. More...
 
class  chrono::utils::ChFilterPT1
 Delay an input signal: H(s) = Kpt1 / ( T1 * s + 1 ) More...
 
class  chrono::utils::ChFilterPD1
 PD1 controller: H(s) = Kdt1 * ( Td1 * s + 1 ) More...
 
class  chrono::utils::ChFilterPDT1
 PDT1 controller: H(s) = Kp * ( Td1 * s + 1 ) / ( T1 * s + 1) More...
 
class  chrono::utils::ChButterworthLowpass
 Butterworth low-pass filter. More...
 
class  chrono::utils::ChButterworthHighpass
 Butterworth high-pass filter. More...
 
class  chrono::utils::ChAbsorbedPowerVertical
 Filter for vertical absorbed power. More...
 
class  chrono::utils::ChISO2631_1_Wk
 Combined filter Wk. More...
 
class  chrono::utils::ChISO2631_1_Wd
 Combined filter Wd. More...
 
class  chrono::utils::ChISO2631_1_Wf
 Combined filter Wf. More...
 
class  chrono::utils::ChISO2631_5_Wxy
 ISO2631-5 weighting filter for shock like signal in horizontal direction. More...
 
class  chrono::utils::ChISO2631_5_Wz
 ISO2631-5 weighting filter for shock like signal in vertical direction. More...
 
class  chrono::utils::ChISO2631_Vibration_SeatCushionLogger
 Easy to use class for evaluation of ISO 2361-1 vibration load on sitting vehicle occupants Input: 3 seat accelerations x,y,z in [m/s^2]. More...
 
class  chrono::utils::ChISO2631_Shock_SeatCushionLogger
 Easy to use class for evaluation of ISO 2361-5 shock load on sitting vehicle occupants. More...
 
class  chrono::utils::ChMotionFilter
 Base class for smoothing basic motion laws with discrete time-domain nonlinear filters. More...
 
class  chrono::utils::ChMotionFilterSecondOrder
 Second-order nonlinear filter for smoothing basic motion laws (e.g. More...
 
class  chrono::utils::ChMotionFilterThirdOrder
 Third-order nonlinear filter for smoothing basic motion laws (e.g. More...
 
class  chrono::utils::ChSocketCommunication
 Class for socket communication interface. More...
 
class  chrono::utils::ChMixtureIngredient
 Encapsulation of an ingredient of one of the supported types in a mixture. More...
 
class  chrono::utils::ChGenerator
 Provides functionality for generating sets of bodies with positions drawn from a specified sampler and various mixture properties. More...
 
class  chrono::utils::ChSampler< T >
 Base class for different types of point samplers. More...
 
class  chrono::utils::ChPDGrid< Point >
 Simple 3D grid utility class for use by the Poisson Disk sampler. More...
 
class  chrono::utils::ChPDSampler< T >
 Sampler for 3D domains (box, sphere, or cylinder) using Poisson Disk Sampling. More...
 
class  chrono::utils::ChGridSampler< T >
 Sampler for 3D volumes using a regular (equidistant) grid. More...
 
class  chrono::utils::ChHCPSampler< T >
 Sampler for 3D volumes using a Hexagonally Close Packed structure. More...
 

Macros

#define CH_BM_SIMULATION_LOOP(TEST_NAME, TEST, SKIP_STEPS, SIM_STEPS, REPETITIONS)
 Define and register a test named TEST_NAME using the specified ChBenchmark TEST. More...
 
#define CH_BM_SIMULATION_ONCE(TEST_NAME, TEST, SKIP_STEPS, SIM_STEPS, REPETITIONS)
 Define and register a test named TEST_NAME using the specified ChBenchmark TEST. More...
 

Enumerations

enum  chrono::utils::MixtureType {
  SPHERE, ELLIPSOID, BOX, CYLINDER,
  CONE, CAPSULE
}
 Enumeration of various geometric shapes available for mixtures.
 
enum  chrono::utils::SamplingType { chrono::utils::SamplingType::REGULAR_GRID, chrono::utils::SamplingType::POISSON_DISK, chrono::utils::SamplingType::HCP_PACK }
 Volumetric sampling method. More...
 

Functions

void chrono::utils::AddSphereGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a sphere collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddEllipsoidGeometry (ChBody *body, ChContactMaterialSharedPtr material, const ChVector3d &axes, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add an ellipsoid collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddBoxGeometry (ChBody *body, ChContactMaterialSharedPtr material, const ChVector3d &size, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a box collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddBiSphereGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double cDist, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a bisphere collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddCapsuleGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double height, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a capsule shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddCylinderGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double height, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a cylinder shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddCylinderGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, const ChVector3d &p1, const ChVector3d &p2, bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a cylinder shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddConeGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double height, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a cone shape and optionally a corresponding visualization asset to the specified body. More...
 
bool chrono::utils::AddTriangleMeshGeometry (ChBody *body, ChContactMaterialSharedPtr material, const std::string &obj_filename, const std::string &name, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a triangular mesh collision shape and optionally a corresponding visualization asset to the specified body. More...
 
bool chrono::utils::AddTriangleMeshConvexDecomposition (ChBody *body, ChContactMaterialSharedPtr material, const std::string &obj_filename, const std::string &name, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), float skin_thickness=0.0f, bool use_original_asset=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
bool chrono::utils::AddTriangleMeshConvexDecompositionV2 (ChBody *body, ChContactMaterialSharedPtr material, const std::string &obj_filename, const std::string &name, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool use_original_asset=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
bool chrono::utils::AddTriangleMeshConvexDecompositionSplit (ChSystem *system, ChContactMaterialSharedPtr material, const std::string &obj_filename, const std::string &name, const ChVector3d &pos, const ChQuaterniond &rot, double total_mass)
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddTriangleGeometry (ChBody *body, ChContactMaterialSharedPtr material, const ChVector3d &vertA, const ChVector3d &vertB, const ChVector3d &vertC, const std::string &name, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a triangle collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddRoundedBoxGeometry (ChBody *body, ChContactMaterialSharedPtr material, const ChVector3d &size, double srad, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a rounded box (sphere-swept box) collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddRoundedCylinderGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double height, double srad, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a rounded cylinder (sphere-swept cylinder) collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void chrono::utils::AddTorusGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double thickness, int segments=20, int angle=360, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a torus collision shape (compound object created with capsules) and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddBoxContainer (std::shared_ptr< ChBody > body, ChContactMaterialSharedPtr material, const ChFrame<> &frame, const ChVector3d &size, double thickness, const ChVector3i faces, bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add collision shapes representing a box container of specified dimensions to the given body. More...
 
std::shared_ptr< ChBodychrono::utils::CreateBoxContainer (ChSystem *system, ChContactMaterialSharedPtr mat, const ChVector3d &size, double thickness, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool collide=true, bool overlap=true, bool closed=false)
 Create a fixed body with collision and visualization geometry representing a box volume. More...
 
std::shared_ptr< ChBodychrono::utils::CreateCylindricalContainerFromBoxes (ChSystem *system, ChContactMaterialSharedPtr mat, double radius, double height, double thickness, int numBoxes, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool collide=true, bool overlap=true, bool closed=false, bool isBoxBase=true, bool partialVisualization=true)
 Create a fixed body with collision and visualization representing a cylindrical volume. More...
 
bool chrono::utils::LoadConvexMesh (const std::string &file_name, ChTriangleMeshConnected &convex_mesh, ChConvexDecompositionHACDv2 &convex_shape, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), int hacd_maxhullcount=1024, int hacd_maxhullmerge=256, int hacd_maxhullvertexes=64, float hacd_concavity=0.01f, float hacd_smallclusterthreshold=0.0f, float hacd_fusetolerance=1e-6f)
 Load an object from a Wavefront OBJ file and generate its convex decomposition.
 
bool chrono::utils::LoadConvexHulls (const std::string &file_name, ChTriangleMeshConnected &convex_mesh, std::vector< std::vector< ChVector3d >> &convex_hulls)
 Given a path to an obj file, loads the obj assuming that the individual objects in the obj are convex hulls, useful when loading a precomputed set of convex hulls. More...
 
void chrono::utils::AddConvexCollisionModel (std::shared_ptr< ChBody > body, ChContactMaterialSharedPtr material, std::shared_ptr< ChTriangleMeshConnected > convex_mesh, ChConvexDecompositionHACDv2 &convex_shape, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool use_original_asset=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Given a convex mesh and its decomposition add it to a ChBody use_original_asset can be used to specify if the mesh or the convex decomp should be used for visualization.
 
void chrono::utils::AddConvexCollisionModel (std::shared_ptr< ChBody > body, ChContactMaterialSharedPtr material, std::shared_ptr< ChTriangleMeshConnected > convex_mesh, std::vector< std::vector< ChVector3d >> &convex_hulls, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a convex mesh to an object based on a set of points. More...
 
bool chrono::utils::LineLineIntersect (const ChVector3d &p1, const ChVector3d &p2, const ChVector3d &p3, const ChVector3d &p4, ChVector3d *pa, ChVector3d *pb, double *mua, double *mub)
 Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4. More...
 
double chrono::utils::PointLineDistance (const ChVector3d &B, const ChVector3d &A1, const ChVector3d &A2, double &u, bool &in_segment)
 Calculate distance between a point B and the segment (A1,A2). More...
 
double chrono::utils::PointTriangleDistance (const ChVector3d &B, const ChVector3d &A1, const ChVector3d &A2, const ChVector3d &A3, double &u, double &v, bool &in_triangle, ChVector3d &Bprojected)
 Calculate distance of a point from a triangle surface. More...
 
bool chrono::utils::DegenerateTriangle (const ChVector3d &Dx, const ChVector3d &Dy)
 Check if the triangle defined by the two given vectors is degenerate.
 
bool chrono::utils::DegenerateTriangle (const ChVector3d &v1, const ChVector3d &v2, const ChVector3d &v3)
 Check if the triangle defined by the three given vertices is degenerate.
 
template<typename T >
std::vector< ChVector3< T > > chrono::utils::ChPDLayerSamplerBox (ChVector3< T > center, ChVector3< T > hdims, T diam, T padding_factor=1.02, bool verbose=false)
 Poisson Disk sampler for sampling a 3D box in layers. More...
 
void chrono::utils::ChBenchmarkTest::Simulate (int num_steps)
 
void chrono::utils::ChBenchmarkTest::ResetTimers ()
 

Variables

template<class T >
constexpr T chrono::utils::Pi = T(3.1415926535897932385L)
 

Macro Definition Documentation

◆ CH_BM_SIMULATION_LOOP

#define CH_BM_SIMULATION_LOOP (   TEST_NAME,
  TEST,
  SKIP_STEPS,
  SIM_STEPS,
  REPETITIONS 
)
Value:
BENCHMARK_DEFINE_F(TEST_NAME, SimulateLoop)(benchmark::State & st) { \
while (st.KeepRunning()) { \
m_test->Simulate(SIM_STEPS); \
} \
Report(st); \
} \
BENCHMARK_REGISTER_F(TEST_NAME, SimulateLoop)->Unit(benchmark::kMillisecond)->Repetitions(REPETITIONS);

Define and register a test named TEST_NAME using the specified ChBenchmark TEST.

This method benchmarks consecutive (in time) simulation batches and is therefore appropriate for cases where the cost per step is expected to be relatively uniform. An initial SKIP_STEPS integration steps are performed for hot start, after which measurements are conducted for batches of SIM_STEPS integration steps. The test is repeated REPETITIONS number of times, to collect statistics. Note that each reported benchmark result may require simulations of several batches (controlled by the benchmark library in order to stabilize timing results).

◆ CH_BM_SIMULATION_ONCE

#define CH_BM_SIMULATION_ONCE (   TEST_NAME,
  TEST,
  SKIP_STEPS,
  SIM_STEPS,
  REPETITIONS 
)
Value:
BENCHMARK_DEFINE_F(TEST_NAME, SimulateOnce)(benchmark::State & st) { \
Reset(SKIP_STEPS); \
while (st.KeepRunning()) { \
m_test->Simulate(SIM_STEPS); \
} \
Report(st); \
} \
BENCHMARK_REGISTER_F(TEST_NAME, SimulateOnce) \
->Unit(benchmark::kMillisecond) \
->Iterations(1) \
->Repetitions(REPETITIONS);

Define and register a test named TEST_NAME using the specified ChBenchmark TEST.

This method benchmarks a single simulation interval and is appropriate for cases where the cost of simulating a given length time interval can vary significantly from interval to interval. For each measurement, the underlying model is recreated from scratch. An initial SKIP_STEPS integration steps are performed for hot start, after which a single batch of SIM_STEPS is timed and recorded. The test is repeated REPETITIONS number of times, to collect statistics.

Enumeration Type Documentation

◆ SamplingType

Volumetric sampling method.

Enumerator
REGULAR_GRID 

Regular (equidistant) grid.

POISSON_DISK 

Poisson Disk sampling.

HCP_PACK 

Hexagonally Close Packing.

Function Documentation

◆ AddBiSphereGeometry()

ChApi void chrono::utils::AddBiSphereGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
double  radius,
double  cDist,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a bisphere collision shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
radiussphere radius
cDistdistance between centers
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddBoxContainer()

ChApi void chrono::utils::AddBoxContainer ( std::shared_ptr< ChBody body,
ChContactMaterialSharedPtr  material,
const ChFrame<> &  frame,
const ChVector3d size,
double  thickness,
const ChVector3i  faces,
bool  visualization = true,
ChVisualMaterialSharedPtr  vis_material = ChVisualMaterial::Default() 
)

Add collision shapes representing a box container of specified dimensions to the given body.

The center of the box volume is at the origin of the given frame and the the container is aligned with the frame axes. The container walls are constructed with the specified thickness. The 'faces' input vector specifies which faces of the container are to be created: for each direction, a value of -1 indicates the face in the negative direction, a value of +1 indicates the face in the positive direction, and a value of 2 indicates both faces. Setting a value of 0 does not create container faces in that direction.

Parameters
bodyassociated body
materialcontact material
frameposition and orientation wrt body frame
sizeinterior container dimensions
thicknesswall thickness
facesindices of container faces to be created
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddBoxGeometry()

ChApi void chrono::utils::AddBoxGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
const ChVector3d size,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a box collision shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
sizebox side lengths
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddCapsuleGeometry()

ChApi void chrono::utils::AddCapsuleGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
double  radius,
double  height,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a capsule shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
radiuscapsule radius
heightcapsule height (cylindrical portion)
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddConeGeometry()

ChApi void chrono::utils::AddConeGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
double  radius,
double  height,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a cone shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
radiuscone radius
heightcone height
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddConvexCollisionModel()

ChApi void chrono::utils::AddConvexCollisionModel ( std::shared_ptr< ChBody body,
ChContactMaterialSharedPtr  material,
std::shared_ptr< ChTriangleMeshConnected convex_mesh,
std::vector< std::vector< ChVector3d >> &  convex_hulls,
const ChVector3d pos = ChVector3d(0, 0, 0),
const ChQuaterniond rot = ChQuaterniond(1, 0, 0, 0),
ChVisualMaterialSharedPtr  vis_material = ChVisualMaterial::Default() 
)

Add a convex mesh to an object based on a set of points.

This version will use the triangle mesh to set the visualization geometry.

◆ AddCylinderGeometry() [1/2]

ChApi void chrono::utils::AddCylinderGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
double  radius,
const ChVector3d p1,
const ChVector3d p2,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a cylinder shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
radiuscylinder radius
p1first end point
p2second end point
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddCylinderGeometry() [2/2]

ChApi void chrono::utils::AddCylinderGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
double  radius,
double  height,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a cylinder shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
radiuscylinder radius
heightcylinder height
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddEllipsoidGeometry()

ChApi void chrono::utils::AddEllipsoidGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
const ChVector3d axes,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add an ellipsoid collision shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
axeselipsoid axes
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddRoundedBoxGeometry()

ChApi void chrono::utils::AddRoundedBoxGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
const ChVector3d size,
double  srad,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a rounded box (sphere-swept box) collision shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
sizebox side lengths
sradradius of sweeping sphere
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddRoundedCylinderGeometry()

ChApi void chrono::utils::AddRoundedCylinderGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
double  radius,
double  height,
double  srad,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a rounded cylinder (sphere-swept cylinder) collision shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
radiuscylinder radius
heightcylinder radius
sradradius of sweeping sphere
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddSphereGeometry()

ChApi void chrono::utils::AddSphereGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
double  radius,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a sphere collision shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
radiussphere radius
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddTriangleGeometry()

ChApi void chrono::utils::AddTriangleGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
const ChVector3d vertA,
const ChVector3d vertB,
const ChVector3d vertC,
const std::string &  name,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a triangle collision shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
vertAfirst triangle vertex
vertBsecond triangle vertex
vertCthird triangle vertex
namename of generated mesh
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ AddTriangleMeshGeometry()

ChApi bool chrono::utils::AddTriangleMeshGeometry ( ChBody body,
ChContactMaterialSharedPtr  material,
const std::string &  obj_filename,
const std::string &  name,
const ChVector3d pos,
const ChQuaterniond rot,
bool  visualization,
ChVisualMaterialSharedPtr  vis_material 
)

Add a triangular mesh collision shape and optionally a corresponding visualization asset to the specified body.

Parameters
bodyassociated body
materialcontact material
obj_filenamename of Wavefront OBJ file
namemesh name
posposition on body
rotorientation wrt body frame
visualizationcreate visualization shape
vis_materialvisualization material

◆ ChPDLayerSamplerBox()

template<typename T >
std::vector<ChVector3<T> > chrono::utils::ChPDLayerSamplerBox ( ChVector3< T >  center,
ChVector3< T >  hdims,
diam,
padding_factor = 1.02,
bool  verbose = false 
)

Poisson Disk sampler for sampling a 3D box in layers.

The computational efficiency of PD sampling degrades as points are added, especially for large volumes. This class provides an alternative sampling method where PD sampling is done in 2D layers, separated by a specified distance (padding_factor * diam). This significantly improves computational efficiency of the sampling but at the cost of discarding the PD uniform distribution properties in the direction orthogonal to the layers.

Parameters
centerCenter of axis-aligned box to fill
hdimsHalf-dimensions along the x, y, and z axes
diamParticle diameter
padding_factorMultiplier on particle diameter for spacing
verboseOutput progress during generation

◆ CreateBoxContainer()

ChApi std::shared_ptr< ChBody > chrono::utils::CreateBoxContainer ( ChSystem system,
ChContactMaterialSharedPtr  mat,
const ChVector3d size,
double  thickness,
const ChVector3d pos = ChVector3d(0, 0, 0),
const ChQuaterniond rot = ChQuaterniond(1, 0, 0, 0),
bool  collide = true,
bool  overlap = true,
bool  closed = false 
)

Create a fixed body with collision and visualization geometry representing a box volume.

The center of the bottom box wall is at the body origin.

Parameters
systemcontaining system
matcontact material
sizeinterior container dimensions
thicknesswall thickness
posbody position
rotbody orientation
collideenable collision
overlapinclude overlap at container edges
closedcreate top wall

◆ CreateCylindricalContainerFromBoxes()

ChApi std::shared_ptr< ChBody > chrono::utils::CreateCylindricalContainerFromBoxes ( ChSystem system,
ChContactMaterialSharedPtr  mat,
double  radius,
double  height,
double  thickness,
int  numBoxes,
const ChVector3d pos = ChVector3d(0, 0, 0),
const ChQuaterniond rot = ChQuaterniond(1, 0, 0, 0),
bool  collide = true,
bool  overlap = true,
bool  closed = false,
bool  isBoxBase = true,
bool  partialVisualization = true 
)

Create a fixed body with collision and visualization representing a cylindrical volume.

The volume geometry is modeled using boxes. The container is aligned with the z direction with the center of the bottom at the body origin. Optionally, the side boxes in the first quadrant are not visualized.

Parameters
systemcontaining system
matcontact material
radiuscontainer inner radius
heightcontainer inner height
thicknesswall thickness
numBoxesnumber of circumference boxes
posbody position
rotbody orientation
collideenable collision
overlapinclude overlap at box edges
closedcreate top
isBoxBaseuse a box or a cylinder for bases
partialVisualizationvisualize only half of the boxes

◆ LineLineIntersect()

ChApi bool chrono::utils::LineLineIntersect ( const ChVector3d p1,
const ChVector3d p2,
const ChVector3d p3,
const ChVector3d p4,
ChVector3d pa,
ChVector3d pb,
double *  mua,
double *  mub 
)

Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4.

Calculate also the values of mua and mub where Pa = P1 + mua (P2 - P1) Pb = P3 + mub (P4 - P3) Return false if no solution exists.

◆ LoadConvexHulls()

ChApi bool chrono::utils::LoadConvexHulls ( const std::string &  file_name,
ChTriangleMeshConnected convex_mesh,
std::vector< std::vector< ChVector3d >> &  convex_hulls 
)

Given a path to an obj file, loads the obj assuming that the individual objects in the obj are convex hulls, useful when loading a precomputed set of convex hulls.

The output of this function is used with AddConvexCollisionModel

◆ PointLineDistance()

ChApi double chrono::utils::PointLineDistance ( const ChVector3d B,
const ChVector3d A1,
const ChVector3d A2,
double &  u,
bool &  in_segment 
)

Calculate distance between a point B and the segment (A1,A2).

Returns the distance from B to the line and sets the line parameter 'u' such that u=0 indicates that B projects into A1 and u=1 indicates that B projects into A2. If 0 <= u <= 1, in_segment is set to 'true'.

◆ PointTriangleDistance()

ChApi double chrono::utils::PointTriangleDistance ( const ChVector3d B,
const ChVector3d A1,
const ChVector3d A2,
const ChVector3d A3,
double &  u,
double &  v,
bool &  in_triangle,
ChVector3d Bprojected 
)

Calculate distance of a point from a triangle surface.

Also computes if projection is inside the triangle. If is_into = true, Bprojected is also computed. Returns distance (positive if 'out' side, out is where points A1 A2 A3 can be read in clockwise fashion).

Generic benchmark fixture for Chrono tests.
Definition: ChBenchmark.h:151