AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agxModel::Beam Class Reference

Beam is a segmented, lumped element structure of a given length and resolution. More...

#include <Beam.h>

+ Inheritance diagram for agxModel::Beam:

Public Member Functions

 Beam (BeamModel *model, agx::UInt resolution, agx::Real length)
 Construct a beam given model, resolution (number of elements) and total length.
 
agx::LockJointRef attach (BeamSegment *segment, agx::Bool atSegmentBegin, agx::RigidBody *otherRb=nullptr, agx::Bool adoptModelProperties=false) const
 Utility method to attach a given segment (of this beam) at begin or end (of the segment) to another rigid body and optionally adopt the material properties of the model of this beam.
 
agx::LockJointRef attach (BeamSegment *segment, agx::Vec3 localSegmentPosition, agx::RigidBody *otherRb=nullptr, agx::Bool adoptModelProperties=false) const
 Utility method to attach a given segment (of this beam) at a local segment position to another rigid body and optionally adopt the material properties of the model of this beam.
 
agx::LockJointRef attachBegin (agx::RigidBody *otherRb=nullptr, agx::Bool adoptModelProperties=false) const
 Utility method to attach the first segment of this beam at begin (of the segment) to another rigid body and optionally adopt the material properties of the model of this beam.
 
agx::LockJointRef attachEnd (agx::RigidBody *otherRb=nullptr, agx::Bool adoptModelProperties=false) const
 Utility method to attach the last segment of this beam at end (of the segment) to another rigid body and optionally adopt the material properties of the model of this beam.
 
BeamStiffnessDamping calculateSegmentStiffnessDamping () const
 Calculates per segment stiffness dependent on beam model moment of inertia, cross section area, beam segment length and number of segments in this beam.
 
BeamSegment * findSegment (const agx::Vec3 &worldPoint) const
 Find the segment closest to the given world point.
 
agx::Vec3 getBeginPosition () const
 Current begin position, in world coordinate frame, of this (initialized) beam.
 
BeamSegmentRange getConstrainedSegments () const
 
agx::Vec3 getEndPosition () const
 Current end position, in world coordinate frame, of this (initialized) beam.
 
BeamModel * getModel () const
 
agx::UInt getNumSegments () const
 
virtual agx::Real getRestLength () const override
 
BeamSegment * getSegment (agx::Real restLengthFromStart) const
 Finds the segment overlapping the given rest length from start.
 
BeamSegmentRange getSegments () const
 
agx::Bool initialize ()
 Initialize this beam, creating segments, constraints and assigning properties related to the model of this beam.
 
agx::Bool isInitialized () const
 
void updateProperties ()
 Propagate model specific properties, such as stiffness in the constraints.
 
- Public Member Functions inherited from agxSDK::LinkedStructure
virtual agx::Bool addComponent (agxSDK::LinkedStructureComponent *component)
 Add new component to this linked structure.
 
virtual void addGroup (agx::UInt32 id)
 Add group id to all segments in this linked structure.
 
virtual void addGroup (const agx::Name &name)
 Add group name to all segments in this linked structure.
 
virtual void addNotification (agxSDK::Simulation *)
 Called when this assembly is added to a simulation (given that it not already is in the simulation).
 
void addNotification (agxSDK::Simulation *simulation) final override
 Called when this linked structure is added to the simulation.
 
virtual void addNotification (Assembly *)
 Called when this assembly is added to another assembly.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxSDK::LinkedStructure)
 
virtual agx::Real findCurrentLength (agx::Real restLengthFromStart) const
 Calculates the current length of a given rest length.
 
virtual agxCollide::GroupIdCollection findGroupIdCollection () const
 
virtual agx::Vec3 findPoint (agx::Real restLengthFromStart) const
 Finds center point on this structure given rest length from the start.
 
virtual agx::Vec3 findPoint (const agx::Vec3 &worldPoint) const
 Given any world point, find a center point on this structure that is closest to the given worldPoint.
 
virtual agx::Real findRestLength (agx::Real currentLengthFromStart) const
 Calculates the rest length of a given current length from start.
 
virtual agx::Real findRestLengthTo (const agx::Vec3 &worldPoint) const
 Given any world point, find a center point on this structure that is closest to the given worldPoint and return the rest length from start.
 
virtual agx::Real findRestLengthTo (const agxSDK::LinkedSegment *segment) const
 Finds rest length to the start of the given segment.
 
virtual agx::Vec3 getAngularVelocityDamping () const
 
template<typename T >
T * getComponent () const
 
agxSDK::LinkedStructureComponent * getComponent (const agx::Name &name) const
 
virtual agx::Real getCurrentLength () const
 Calculates and returns the total length of this linked structure, at current state.
 
virtual agx::UInt32 getDisabledCollisionGroupId () const
 
virtual agx::Bool getEnableCollisions (const agx::RigidBody *rb) const
 
virtual agx::Bool getEnableCollisions (const agxCollide::Geometry *geometry) const
 
virtual agx::Vec3 getLinearVelocityDamping () const
 
virtual agx::Real getMass () const
 Calculates and returns the total mass of this linked structure.
 
virtual agx::Material * getMaterial () const
 
virtual agx::Real getRestLength () const
 Calculates and returns the total length of this linked structure, at rest.
 
virtual agx::Real getRestVolume () const
 Calculates and returns the total volume of this linked structure, at rest.
 
template<>
LinkedSegment * getSegment (const agx::RigidBody *rb) const
 
agx::UInt getSegmentIndex (const agx::RigidBody *rb) const
 
const agxSDK::LinkedSegmentContainer & getSegmentsContainer () const
 
virtual agx::UInt32 getUniqueId () const
 
virtual agx::Bool hasGroup (agx::UInt32 id) const
 
virtual agx::Bool hasGroup (const agx::Name &name) const
 
virtual agx::Bool rebind ()
 Make the current relative positions of all nodes the rest state.
 
virtual agx::Bool removeComponent (agxSDK::LinkedStructureComponent *component)
 Remove an added component from this linked structure.
 
virtual void removeGroup (agx::UInt32 id)
 Remove group id from all segments in this linked structure.
 
virtual void removeGroup (const agx::Name &name)
 Remove group name from all segments in this linked structure.
 
virtual void removeNotification (agxSDK::Simulation *)
 Called when this assembly is removed from a simulation.
 
void removeNotification (agxSDK::Simulation *simulation) final override
 Called when this linked structure is added to the simulation.
 
virtual void removeNotification (Assembly *)
 Called when this assembly is removed from another assembly.
 
agxSDK::LinkedSegmentRange< agxSDK::LinkedSegment > segments ()
 
virtual void setAngularVelocityDamping (const agx::Vec3 &angularVelocityDamping)
 Assigns angular velocity damping to all segments in this linked structure.
 
virtual void setDisabledCollisionsId (const agx::Uuid &uuid)
 Set the collision id of this linked structure.
 
virtual void setEnableCollisions (agx::RigidBody *rb, agx::Bool enable)
 Enable/disable collisions between the rigid body and all segments of this linked structure.
 
virtual void setEnableCollisions (agxCollide::Geometry *geometry, agx::Bool enable)
 Enable/disable collisions between the geometry and all segments of this linked structure.
 
virtual void setLinearVelocityDamping (const agx::Vec3 &linearVelocityDamping)
 Assigns linear velocity damping to all segments in this linked structure.
 
virtual void setMaterial (agx::Material *material)
 Assign material to all segments in this linked structure.
 
virtual void setUniqueId (const agx::Uuid &uuid)
 Set the unique id of this linked structure.
 
- Public Member Functions inherited from agxSDK::Assembly
 Assembly ()
 Default constructor.
 
bool add (agx::Constraint *constraint)
 Add a constraint to the assembly.
 
bool add (agx::ContactMaterial *contactMaterial)
 Add a contact material to this assembly.
 
bool add (agx::Emitter *emitter)
 Add an emitter to this assembly.
 
bool add (agx::Interaction *interaction)
 Add an interaction to this assembly.
 
bool add (agx::MergedBody *mergedBody)
 Add a MergedBody to this assembly.
 
bool add (agx::ObserverFrame *observerFrame)
 Add an ObserverFrame to this assembly.
 
bool add (agx::RigidBody *body)
 Add a rigid body to the assembly.
 
bool add (agxCollide::Geometry *geometry)
 Add a geometry to the assembly.
 
bool add (agxSDK::EventListener *listener)
 Add a listener to the assembly.
 
bool add (agxSDK::TerrainInstance *terrainInstance)
 Add a TerrainInstance to this assembly.
 
bool add (agxSDK::TerrainToolInstance *toolInstance)
 Add a TerrainToolInstance to this assembly.
 
bool add (agxStream::Serializable *object)
 Add an object of type serialized.
 
bool add (Assembly *assembly)
 Add another assembly as child to this assembly.
 
virtual void addNotification (agxSDK::Simulation *)
 Called when this assembly is added to a simulation (given that it not already is in the simulation).
 
virtual void addNotification (Assembly *)
 Called when this assembly is added to another assembly.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxSDK::Assembly)
 
size_t collect (agx::ConstraintRefVector &result, bool recursive=true)
 
size_t collect (agx::EmitterRefVector &result, bool recursive=true)
 
size_t collect (agx::InteractionRefVector &result, bool recursive=true)
 
size_t collect (agx::MergedBodyRefVector &result, bool recursive=true)
 
size_t collect (agx::ObserverFrameRefVector &result, bool recursive=true)
 
size_t collect (agx::ParticleSystemRefVector &result, bool recursive=true)
 
size_t collect (agx::RigidBodyRefVector &result, bool recursive=true)
 
size_t collect (agxCollide::GeometryRefVector &result, bool recursive=true)
 
size_t collect (agxSDK::AssemblyRefVector &result, bool recursive=true)
 
size_t collect (agxSDK::EventListenerRefVector &result, bool recursive=true)
 
size_t collect (agxSDK::TerrainInstanceRefVector &result, bool recursive=true)
 
size_t collect (agxSDK::TerrainToolInstanceRefVector &result, bool recursive=true)
 
bool empty () const
 
const AssemblyRefSetVector & getAssemblies () const
 
agxSDK::Assembly * getAssembly (const agx::Name &name, bool recursive=true)
 Find (linear search) and return named Assembly.
 
const agxSDK::Assembly * getAssembly (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return named Assembly.
 
agxSDK::Assembly * getAssembly (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return an Assembly matching the given uuid.
 
const agxSDK::Assembly * getAssembly (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return an Assembly matching the given uuid.
 
agx::Constraint * getConstraint (const agx::Name &name, bool recursive=true)
 Find (linear search) and return named Constraint.
 
template<typename T >
T * getConstraint (const agx::Name &name, bool recursive=true)
 Find and return named Constraint of a template type, for example Hinge:
 
const agx::Constraint * getConstraint (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return named Constraint.
 
template<typename T >
const T * getConstraint (const agx::Name &name, bool recursive=true) const
 Find and return named Constraint of a template type, for example Hinge:
 
agx::Constraint * getConstraint (const agx::Uuid &uuid, bool recursive=true)
 Find and return a pointer to a Constraint with the given uuid.
 
const agx::Constraint * getConstraint (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return a pointer to a Constraint with the given uuid.
 
agx::Constraint1DOF * getConstraint1DOF (const agx::Name &name, bool recursive=true)
 
agx::Constraint2DOF * getConstraint2DOF (const agx::Name &name, bool recursive=true)
 
const agx::ConstraintRefSetVector & getConstraints () const
 
const agx::EmitterRefSetVector & getEmitters () const
 
const EventListenerRefSetVector & getEventListeners () const
 
virtual agx::Frame * getFrame ()
 Return a reference to the frame containing transformation and velocity information for this assembly.
 
virtual const agx::Frame * getFrame () const
 
const agxCollide::GeometryRefSetVector & getGeometries () const
 
agxCollide::Geometry * getGeometry (const agx::Name &name, bool recursive=true)
 Find (linear search) and return named collision Geometry.
 
const agxCollide::Geometry * getGeometry (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return named collision Geometry.
 
agxCollide::Geometry * getGeometry (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return a Geometry matching the given uuid.
 
const agxCollide::Geometry * getGeometry (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return a Geometry matching the given uuid.
 
const agx::InteractionRefSetVector & getInteractions () const
 
agx::Vec3 getLocalPosition () const
 
agx::Quat getLocalRotation () const
 
const agx::AffineMatrix4x4 & getLocalTransform () const
 
const agx::MergedBodyRefSetVector & getMergedBodies () const
 
agx::MergedBody * getMergedBody (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return an MergedBody matching the given uuid.
 
const agx::MergedBody * getMergedBody (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return an MergedBody matching the given uuid.
 
agx::Name getName () const
 
agx::ObserverFrame * getObserverFrame (const agx::Name &name, bool recursive=true)
 Find (linear search) and return an ObserverFrame matching the given uuid.
 
const agx::ObserverFrame * getObserverFrame (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return an ObserverFrame matching the given uuid.
 
agx::ObserverFrame * getObserverFrame (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return an ObserverFrame matching the given uuid.
 
const agx::ObserverFrame * getObserverFrame (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return an ObserverFrame matching the given uuid.
 
const agx::ObserverFrameRefSetVector & getObserverFrames () const
 
Assembly * getParent ()
 
const Assembly * getParent () const
 
agx::Frame * getParentFrame ()
 
const agx::Frame * getParentFrame () const
 
const agx::ParticleSystemRefSetVector & getParticleSystems () const
 
const agx::RigidBodyRefSetVector & getRigidBodies () const
 
agx::RigidBody * getRigidBody (const agx::Name &name, bool recursive=true)
 Find (linear search) and return named RigidBody.
 
const agx::RigidBody * getRigidBody (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return named RigidBody.
 
agx::RigidBody * getRigidBody (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return a pointer to a RigidBody with the given uuid.
 
const agx::RigidBody * getRigidBody (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return a pointer to a RigidBody with the given uuid.
 
agxSDK::Simulation * getSimulation ()
 
const agxSDK::Simulation * getSimulation () const
 
agxSDK::TerrainInstance * getTerrainInstance (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return an TerrainInstance matching the given uuid.
 
const agxSDK::TerrainInstance * getTerrainInstance (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return an TerrainInstance matching the given uuid.
 
const agxSDK::TerrainInstanceRefSetVector & getTerrainInstances () const
 
agxSDK::TerrainToolInstance * getTerrainToolInstance (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return an TerrainToolInstance matching the given uuid.
 
const agxSDK::TerrainToolInstance * getTerrainToolInstance (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return an TerrainToolInstance matching the given uuid.
 
const agxSDK::TerrainToolInstanceRefSetVector & getTerrainToolInstances () const
 
Type getType () const
 
bool remove (agx::Constraint *constraint)
 Remove a constraint from this assembly (does not recurse down in tree).
 
bool remove (agx::ContactMaterial *contactMaterial)
 Remove a contact material from this assembly.
 
bool remove (agx::Emitter *emitter)
 Remove an emitter from this assembly.
 
bool remove (agx::Interaction *interaction)
 Remove an interaction from this assembly.
 
bool remove (agx::MergedBody *mergedBody)
 Remove a MergedBody from this assembly.
 
bool remove (agx::ObserverFrame *observerFrame, bool resetParentFrame=true)
 Remove an ObserverFrame from this assembly.
 
bool remove (agx::RigidBody *body, bool removeAssociatedGeometries=false, bool resetParentFrame=true)
 Remove a rigid body from this assembly (does not recurse down in tree).
 
bool remove (agxCollide::Geometry *geometry, bool resetParentFrame=true)
 Remove a geometry from this assembly (does not recurse down in tree).
 
bool remove (agxSDK::TerrainInstance *terrainInstance)
 Remove a TerrainInstance from this assembly.
 
bool remove (agxSDK::TerrainToolInstance *toolInstance)
 Remove a TerrainToolInstance from this assembly.
 
bool remove (Assembly *assembly, bool resetParentFrame=true)
 Remove a child assembly from a parent.
 
bool remove (EventListener *listener)
 Remove an EventListener from the assembly.
 
virtual void removeNotification (agxSDK::Simulation *)
 Called when this assembly is removed from a simulation.
 
virtual void removeNotification (Assembly *)
 Called when this assembly is removed from another assembly.
 
bool reset (bool resetParentFrame=true)
 If this assembly is not added to a simulation it will clear all added bodies etc.
 
virtual void setAngularVelocity (const agx::Vec3 &velocity)
 Set the angular velocity (in world frame) recursively for all rigid bodies stored in assembly.
 
void setLocalPosition (agx::Real x, agx::Real y, agx::Real z)
 Set the position of the assembly relative to its frame's parent frame.
 
void setLocalPosition (const agx::Vec3 &p)
 Set the position of the assembly relative to its frame's parent frame.
 
void setLocalRotation (const agx::EulerAngles &e)
 Set the rotation of the assembly relative to its frame's parent frame.
 
void setLocalRotation (const agx::Quat &q)
 Set the rotation of the assembly relative to its frame's parent frame.
 
void setLocalTransform (const agx::AffineMatrix4x4 &matrix)
 Assign the local transformation matrix for this assembly, ignoring any eventual parent transformation.
 
void setName (const agx::Name &name)
 Set the name of this Assembly.
 
bool setParentFrame (agx::Frame *frame)
 Set the parent frame of this assembly's frame.
 
void setPosition (agx::Real x, agx::Real y, agx::Real z)
 Set the position of the frame in world coordinates.
 
void setPosition (const agx::Vec3 &p)
 Set the position of the frame in world coordinates.
 
void setRotation (const agx::EulerAngles &e)
 Set the rotation of the assembly relative to world frame.
 
void setRotation (const agx::OrthoMatrix3x3 &m)
 Set the rotation of the assembly relative to world frame.
 
void setRotation (const agx::Quat &q)
 Set the rotation of the assembly relative to world frame.
 
void setTransform (const agx::AffineMatrix4x4 &matrix)
 Set the transform of the assembly.
 
virtual void setVelocity (const agx::Vec3 &velocity)
 Set the linear velocity (in world frame) recursively for all rigid bodies stored in assembly.
 
bool transfer (agxSDK::Assembly *target)
 Transfer all the content from this assembly to the target, including name and transformation.
 
virtual void traverse (AssemblyVisitor *visitor)
 Traverse the assembly tree recursively using a visitor.
 
virtual void traverse (const AssemblyVisitor *visitor) const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

static agx::Quat calculateRotation (agx::Vec3 forward, agx::Vec3 worldUpAxis=agx::Vec3::Z_AXIS())
 Calculates the rotation of a beam frame given forward direction and world up axis the beam frame up axis should align with.
 
static agx::AffineMatrix4x4 calculateTransform (agx::Vec3 startPosition, agx::Vec3 forward, agx::Vec3 worldUpAxis=agx::Vec3::Z_AXIS())
 Calculates the transform of a beam given start position, forward direction and world up axis the beam up axis should align with.
 
static BeamRef create (agx::Vec3 startPosition, agx::Vec3 endPosition, BeamModel *model, agx::UInt resolution, agx::Vec3 worldUpAxis=agx::Vec3::Z_AXIS())
 Creates an initialized beam between the given start and end positions, beam model, beam resolution and world up axis (default z).
 
static Beam * find (agxSDK::Simulation *simulation, const agx::Name &name)
 Find beam instance given simulation and name.
 
static Beam * find (agxSDK::Simulation *simulation, const agx::Uuid &uuid)
 Find beam instance given simulation and unique id.
 
static agxModel::BeamPtrVector findAll (const agxSDK::Simulation *simulation)
 Finds all agxModel::Beam instances in the given simulation.
 
static agxModel::BeamPtrVector findAll (const agxSDK::Simulation *simulation, const agx::Name &name)
 Finds all beam instances given simulation and name.
 
static Beam * get (agx::RigidBody *rb)
 
static const Beam * get (const agx::RigidBody *rb)
 
static BeamRef restore (agxModel::BeamModel *model, agxStream::StorageStream &str)
 Creates a new beam given model and restores all data from the given storage stream.
 
- Static Public Member Functions inherited from agxSDK::LinkedStructure
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static LinkedStructure * get (agx::RigidBody *body)
 
static LinkedStructure * get (agxCollide::Geometry *geometry)
 
static const LinkedStructure * get (const agx::RigidBody *body)
 
static const LinkedStructure * get (const agxCollide::Geometry *geometry)
 
- Static Public Member Functions inherited from agxSDK::Assembly
static Assembly * asAssembly (agxStream::Serializable *obj)
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Additional Inherited Members

- Public Types inherited from agxSDK::Assembly
enum  Type { ASSEMBLY , COLLECTION }
 Specifies the type an assembly is. More...
 
- Protected Member Functions inherited from agxSDK::LinkedStructure
 LinkedStructure ()
 Hidden default constructor.
 
virtual ~LinkedStructure ()
 Reference counted object - protected destructor.
 
void add (LinkedSegment *segment)
 Add segment to this linked structure.
 
std::tuple< agx::Vec3, LinkedSegment * > findPointAndSegment (const agx::Vec3 &worldPoint) const
 
template<typename T >
T * findSegment (const agx::Vec3 &worldPoint) const
 
LinkedStructureObjectData * getData (const agx::RigidBody *rb) const
 
agx::UInt getNumSegments () const
 
template<typename T >
T * getSegment (agx::Real restLengthFromStart) const
 
LinkedSegment * getSegment (agx::UInt index) const
 
template<typename ObjT >
LinkedSegment * getSegment (const ObjT *rb) const
 
template<typename T >
LinkedSegmentIterator< T > getSegmentIterator (agx::UInt index, agx::Bool boundaryless=false) const
 
template<typename T , typename ObjT >
LinkedSegmentIterator< T > getSegmentIterator (const ObjT *rb, agx::Bool boundaryless=false) const
 
template<typename T >
LinkedSegmentRange< T > getSegments () const
 Constructs a segment range over all segments.
 
template<typename T >
LinkedSegmentRange< T > getSegments (agx::UInt beginIndex, agx::UInt endIndex) const
 Range given begin and end segment index.
 
virtual void onAddNotification (agxSDK::Simulation *simulation)
 Called when addNotification is executed when this linked structure is added to the simulation.
 
virtual void onGroupAdd (const IdData &group)
 Called when a new group has been added.
 
virtual void onGroupRemove (const IdData &group)
 Called when an existing group has been removed.
 
virtual void onLastStep ()
 Called on simulation last step event - after user lastStep.
 
virtual void onMaterialNew ()
 Called when a new material has been assigned.
 
virtual void onPostIntegrate ()
 Called on simulation post integrate event - when transforms has been updated given current velocities.
 
virtual void onPostStep ()
 Called on simulation post step event - after user postStep.
 
virtual void onPreCollideStep ()
 Called on simulation pre-collide step event - after user preCollide.
 
virtual void onPreStep ()
 Called on simulation pre step event - after user preStep.
 
virtual void onRemoveNotification (agxSDK::Simulation *simulation)
 Called when removeNotification is executed when this linked structure is removed from the simulation.
 
virtual void onSetEnableCollisions (agxCollide::Geometry *geometry, agx::Bool enable)
 Called when collision state changed for given geometry.
 
- Protected Member Functions inherited from agxSDK::Assembly
 Assembly (Type type)
 
virtual ~Assembly ()
 Destructor.
 
bool addParticleSystem (agx::ParticleSystem *particleSystem)
 Add a particle system to this assembly.
 
void addToSimulation (Simulation *simulation)
 
void removeFromSimulation (Simulation *simulation)
 
bool removeParticleSystem (agx::ParticleSystem *particleSystem)
 Remove a particle system from this assembly.
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 
- Static Protected Member Functions inherited from agxSDK::LinkedStructure
template<typename T >
static T * getT (agx::RigidBody *rb)
 
template<typename T >
static const T * getT (const agx::RigidBody *rb)
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Beam is a segmented, lumped element structure of a given length and resolution.

The properties of a beam, e.g., geometry, parameters, moment of inertia (area and polar) are defined in the model of the beam (agxModel::BeamModel). The beam models may be shared between several beam instances.

An initialized beam with default transform will be created along the z axis with start at the origin. This means that the end of the last beam segment is at (0, 0, length). The segments of the beam is defined to have x up, y right and z forward (long the beam).

Definition at line 41 of file Beam.h.

Constructor & Destructor Documentation

◆ Beam()

agxModel::Beam::Beam ( BeamModel *  model,
agx::UInt  resolution,
agx::Real  length 
)

Construct a beam given model, resolution (number of elements) and total length.

Parameters
model- beam model of this beam (invalid if nullptr)
resolution- the total number of beam segments in this beam when initialized, i.e., the number of rigid bodies and resolution - 1 constraints (invalid if 0)
length- the total length of this beam (invalid if 0.0)

Member Function Documentation

◆ attach() [1/2]

agx::LockJointRef agxModel::Beam::attach ( BeamSegment *  segment,
agx::Bool  atSegmentBegin,
agx::RigidBody *  otherRb = nullptr,
agx::Bool  adoptModelProperties = false 
) const

Utility method to attach a given segment (of this beam) at begin or end (of the segment) to another rigid body and optionally adopt the material properties of the model of this beam.

Note
The returned lock joint won't be added to the simulation or to this beam and this beam has to be initialized.
Parameters
segment- segment of this beam to attach
atSegmentBegin- attached at local (0, 0, 0) if true, otherwise (0, 0, length) if false
otherRb- other rigid body to attach segment to - nullptr is world
adoptModelProperties- calculate compliance and damping of the attachment given the beam model of this beam
Returns
lock joint if valid, otherwise nullptr (e.g., segment is null or not part of this beam)

◆ attach() [2/2]

agx::LockJointRef agxModel::Beam::attach ( BeamSegment *  segment,
agx::Vec3  localSegmentPosition,
agx::RigidBody *  otherRb = nullptr,
agx::Bool  adoptModelProperties = false 
) const

Utility method to attach a given segment (of this beam) at a local segment position to another rigid body and optionally adopt the material properties of the model of this beam.

Note
The returned lock joint won't be added to the simulation or to this beam and this beam has to be initialized.
Parameters
segment- segment of this beam to attach
localSegmentPosition- beam segment attachment position given in local segment frame
otherRb- other rigid body to attach segment to - nullptr is world
adoptModelProperties- calculate compliance and damping of the attachment given the beam model of this beam
Returns
lock joint if valid, otherwise nullptr (e.g., segment is null or not part of this beam)

◆ attachBegin()

agx::LockJointRef agxModel::Beam::attachBegin ( agx::RigidBody *  otherRb = nullptr,
agx::Bool  adoptModelProperties = false 
) const

Utility method to attach the first segment of this beam at begin (of the segment) to another rigid body and optionally adopt the material properties of the model of this beam.

Note
The returned lock joint won't be added to the simulation or to this beam and this beam has to be initialized.
Parameters
otherRb- other rigid body to attach first segment to - nullptr is world
adoptModelProperties- calculate compliance and damping of the attachment given the beam model of this beam
Returns
lock joint if valid, otherwise nullptr (e.g., segment is null or not part of this beam)

◆ attachEnd()

agx::LockJointRef agxModel::Beam::attachEnd ( agx::RigidBody *  otherRb = nullptr,
agx::Bool  adoptModelProperties = false 
) const

Utility method to attach the last segment of this beam at end (of the segment) to another rigid body and optionally adopt the material properties of the model of this beam.

Note
The returned lock joint won't be added to the simulation or to this beam and this beam has to be initialized.
Parameters
otherRb- other rigid body to attach first segment to - nullptr is world
adoptModelProperties- calculate compliance and damping of the attachment given the beam model of this beam
Returns
lock joint if valid, otherwise nullptr (e.g., segment is null or not part of this beam)

◆ calculateRotation()

static agx::Quat agxModel::Beam::calculateRotation ( agx::Vec3  forward,
agx::Vec3  worldUpAxis = agx::Vec3::Z_AXIS() 
)
static

Calculates the rotation of a beam frame given forward direction and world up axis the beam frame up axis should align with.

Parameters
forward- forward direction of the beam in world coordinate frame, e.g., |end position - start position|
worldUpAxis- world up axis the beam should align with
Returns
rotation of the beam if all inputs are valid, otherwise and identity quaternion (with logged warnings)

◆ calculateSegmentStiffnessDamping()

BeamStiffnessDamping agxModel::Beam::calculateSegmentStiffnessDamping ( ) const

Calculates per segment stiffness dependent on beam model moment of inertia, cross section area, beam segment length and number of segments in this beam.

Returns
the calculated translational and rotational stiffness and damping times

◆ calculateTransform()

static agx::AffineMatrix4x4 agxModel::Beam::calculateTransform ( agx::Vec3  startPosition,
agx::Vec3  forward,
agx::Vec3  worldUpAxis = agx::Vec3::Z_AXIS() 
)
static

Calculates the transform of a beam given start position, forward direction and world up axis the beam up axis should align with.

Parameters
startPosition- start position of the beam in world coordinate frame
forward- forward direction of the beam in world coordinate frame, e.g., |end position - start position|
worldUpAxis- world up axis the beam should align with
Returns
transform of the beam if all inputs are valid, otherwise an identity matrix (with logged warnings)

◆ create()

static BeamRef agxModel::Beam::create ( agx::Vec3  startPosition,
agx::Vec3  endPosition,
BeamModel *  model,
agx::UInt  resolution,
agx::Vec3  worldUpAxis = agx::Vec3::Z_AXIS() 
)
static

Creates an initialized beam between the given start and end positions, beam model, beam resolution and world up axis (default z).

The created beam up axis (x) will align with the given worldUpAxis. E.g., given two points and an agxModel::IBeam model with world up = (0, 0, 1) would result in I, but world up = (0, 1, 0) would result in |-|.

Beam frame: x | z | / |/____ y

The beam segments will be initialized along the z-axis in the beam frame.

Parameters
startPosition- start position of the beam, given in world coordinate frame
endPosition- end position of the beam, given in world coordinate frame
model- beam model of the beam
resolution- resolution, number of segments, of the beam
worldUpAxis- world up axis the beam up axis should align with
Returns
beam instance if all inputs are valid, otherwise nullptr (with logged warnings)

◆ find() [1/2]

static Beam * agxModel::Beam::find ( agxSDK::Simulation *  simulation,
const agx::Name &  name 
)
static

Find beam instance given simulation and name.

Parameters
simulation- simulation
name- name of the beam instance to find
Returns
beam instance with given name if found - otherwise nullptr

◆ find() [2/2]

static Beam * agxModel::Beam::find ( agxSDK::Simulation *  simulation,
const agx::Uuid &  uuid 
)
static

Find beam instance given simulation and unique id.

Parameters
simulation- simulation
uuid- UUID of the beam instance to find
Returns
beam instance with given UUID if found - otherwise nullptr

◆ findAll() [1/2]

static agxModel::BeamPtrVector agxModel::Beam::findAll ( const agxSDK::Simulation *  simulation)
static

Finds all agxModel::Beam instances in the given simulation.

Parameters
simulation- simulation
Returns
beam instances found in the given simulation

◆ findAll() [2/2]

static agxModel::BeamPtrVector agxModel::Beam::findAll ( const agxSDK::Simulation *  simulation,
const agx::Name &  name 
)
static

Finds all beam instances given simulation and name.

Parameters
simulation- simulation
name- name of beam instances to find
Returns
beam instances with given name

◆ findSegment()

BeamSegment * agxModel::Beam::findSegment ( const agx::Vec3 &  worldPoint) const

Find the segment closest to the given world point.

If this beam hasn't been initialized, nullptr is returned.

Parameters
worldPoint- any point in world
Returns
the segment that is closest to the given worldPoint, nullptr if there are no segments in the beam.

◆ get() [1/2]

Beam * agxModel::Beam::get ( agx::RigidBody *  rb)
inlinestatic
Parameters
rb- rigid body
Returns
beam instance rb belongs to, given rb is a BeamSegment body

Definition at line 344 of file Beam.h.

◆ get() [2/2]

const Beam * agxModel::Beam::get ( const agx::RigidBody *  rb)
inlinestatic
Parameters
rb- rigid body
Returns
beam instance rb belongs to, given rb is a BeamSegment body

Definition at line 349 of file Beam.h.

◆ getBeginPosition()

agx::Vec3 agxModel::Beam::getBeginPosition ( ) const

Current begin position, in world coordinate frame, of this (initialized) beam.

Shortcut for: beam->getSegments().front()->getBeginPosition()

Returns
the begin position of this initialized beam, in world coordinate frame. If this beam hasn't been initialized, a warning is issued and (0, 0, 0) returned.

◆ getConstrainedSegments()

BeamSegmentRange agxModel::Beam::getConstrainedSegments ( ) const
Returns
segment range where each segment is constrained with the previous segment, (segment->getConstraint() != nullptr), i.e., this range contains all segments of the beam except the first one

◆ getEndPosition()

agx::Vec3 agxModel::Beam::getEndPosition ( ) const

Current end position, in world coordinate frame, of this (initialized) beam.

Shortcut for: beam->getSegments().back()->getEndPosition()

Returns
the end position of this initialized beam, in world coordinate frame. If this beam hasn't been initialized, a warning is issued and (0, 0, 0) returned.

◆ getModel()

BeamModel * agxModel::Beam::getModel ( ) const
Returns
the model of this beam

◆ getNumSegments()

agx::UInt agxModel::Beam::getNumSegments ( ) const
Returns
the number of segments in this beam, zero if not initialized

◆ getRestLength()

virtual agx::Real agxModel::Beam::getRestLength ( ) const
overridevirtual
Returns
the rest length of this beam

Reimplemented from agxSDK::LinkedStructure.

◆ getSegment()

BeamSegment * agxModel::Beam::getSegment ( agx::Real  restLengthFromStart) const

Finds the segment overlapping the given rest length from start.

If restLengthFromStart is negative, the first segment is returned and if restLengthFromStarts is larger than the total rest length of this beam, the last segment is returned. If this beam hasn't been initialized, nullptr is returned.

Parameters
restLengthFromStart- rest length along this beam, from start, to find the segment
Returns
segment at the given rest length from start, nullptr if this beam hasn't been initialized

◆ getSegments()

BeamSegmentRange agxModel::Beam::getSegments ( ) const
Returns
the segments of this beam when initialized, otherwise an empty range is returned

◆ initialize()

agx::Bool agxModel::Beam::initialize ( )

Initialize this beam, creating segments, constraints and assigning properties related to the model of this beam.

This method will be called when this beam is added to a simulation, if not explicitly called before. This method returns true when this beam wasn't previously initialized and is now successfully initialized. If this beam already is initialized or is il-configured, false is returned.

Returns
true if successfully initialized, otherwise false

◆ isInitialized()

agx::Bool agxModel::Beam::isInitialized ( ) const
Returns
true if this beam is initialized, otherwise false

◆ restore()

static BeamRef agxModel::Beam::restore ( agxModel::BeamModel *  model,
agxStream::StorageStream &  str 
)
static

Creates a new beam given model and restores all data from the given storage stream.

When resolution and length are stored in the stream, only the beam model is needed. The parameters (Young's modulus, Poisson's ratio, etc.) will be written to the model properties. This method calls restoreLightData on the created beam.

Parameters
model- beam model of the stored beam (invalid if nullptr and undefined if the beam model type differs from when the data was stored).
str- storage stream with mode RESTORE
Returns
restored beam instance if everything is valid, otherwise nullptr

◆ updateProperties()

void agxModel::Beam::updateProperties ( )

Propagate model specific properties, such as stiffness in the constraints.

This method is always called before the system is solved and when this beam has been successfully initialized.


The documentation for this class was generated from the following file: