AGX Dynamics  2.37.3.2
agxOSG::Tree Class Reference

#include <Tree.h>

+ Inheritance diagram for agxOSG::Tree:

Public Member Functions

 Tree (osg::Group *root)
 
const agx::Vec4 getColor () const
 
void setColor (const agx::Vec4 &color)
 Assign color to this tree. More...
 
- Public Member Functions inherited from agxModel::Tree
 Tree ()
 Default constructor. More...
 
bool addGroupID (agx::UInt32 id)
 Add group id to all geometries in this tree. More...
 
virtual bool attach (agx::RigidBody *rb, agx::Frame *frame)
 Attach bottom branch to an object given attachment frame. More...
 
virtual void clear ()
 Remove all branches from this tree. More...
 
virtual Tree * cut (agxCollide::Geometry *geometry, const agx::Vec3 &point, agx::Real minShapeHeight=agx::Real(1E-2))
 Cut geometry (only one shape per geometry supported) given point in world and minimum shape height, after cut. More...
 
virtual Tree * cut (agxModel::Tree::Branch *branch)
 Cut at branch and get a new tree. More...
 
Branch * findBranch (const agx::RigidBody *rb) const
 Search the tree for rigid body rb. More...
 
Branch * findBranch (const agxModel::Tree::Branch *fromBranch, const agx::RigidBody *rb) const
 Search the tree for rigid body rb given start branch (i.e., whole tree if root). More...
 
agxModel::Tree::BranchEventListener * getBranchEventListener () const
 
const char * getClassName () const override
 
agx::Referenced * getCustomData () const
 
bool getEnableCollisions (const agx::RigidBody *rb) const
 
bool getEnableCollisions (const agxCollide::Geometry *geometry) const
 
agx::Material * getMaterial () const
 
Branch * getRoot () const
 
agxStream::StorageAgent * getStorageAgent () const override
 
bool hasGroupID (agx::UInt32 id) const
 
virtual bool initialize ()
 Explicit call to this method to check return value. More...
 
bool initialized () const
 
bool isStatic () const
 
bool makeDynamic ()
 Make all rigid bodies dynamic and add all constraints to the simulation. More...
 
bool makeStatic (bool wakeOnContactEvent, agxModel::Tree::TreeExecuteFilter *filter=new agxModel::Tree::TreeExecuteFilter())
 Simplify this tree. More...
 
bool removeGroupID (agx::UInt32 id)
 Removes group id from all geometries in this tree. More...
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void setBranchEventListener (agxModel::Tree::BranchEventListener *branchListener)
 Assign branch event listener. More...
 
virtual void setConstraintSolveType (agx::Constraint::SolveType solveType)
 Set new solve type for the branch connections. More...
 
void setCustomData (agx::Referenced *customData)
 Assign custom data. More...
 
bool setEnableCollisions (agx::RigidBody *rb, bool flag)
 Enable or disable collisions between this tree and a rigid body. More...
 
bool setEnableCollisions (agxCollide::Geometry *geometry, bool flag)
 Enable or disable collisions between this tree and a geometry. More...
 
virtual void setMaterial (agx::Material *material)
 Assign new material. More...
 
virtual bool setTreeExecuteFilter (agxModel::Tree::TreeExecuteFilter *filter)
 Set or change the TreeExecuteFilter on a tree that has been made static and set to wake on contact. More...
 
virtual Branch * split (agxCollide::Geometry *geometry, const agx::Vec3 &point, agx::Real minShapeHeight=agx::Real(1E-2))
 Splits this tree given geometry and point in world. More...
 
virtual void store (agxStream::OutputArchive &out) const override
 
bool wakeOnContact () const
 
- Public Member Functions inherited from agxSDK::Assembly
 Assembly ()
 Default constructor. More...
 
bool add (agx::Constraint *constraint)
 Add a constraint to the assembly. More...
 
bool add (agx::Interaction *interaction)
 Add an interaction to this assembly. More...
 
bool add (agxSDK::EventListener *listener)
 Add a listener to the assembly. More...
 
bool add (agx::RigidBody *body)
 Add a rigid body to the assembly. More...
 
bool add (agxCollide::Geometry *geometry)
 Add a geometry to the assembly. More...
 
bool add (Assembly *assembly)
 Add another assembly as child to this assembly. More...
 
bool add (agx::ContactMaterial *contactMaterial)
 Add a contact material to this assembly. More...
 
bool add (agx::Emitter *emitter)
 Add an emitter to this assembly. More...
 
bool add (agx::ObserverFrame *observerFrame)
 Add an ObserverFrame to this assembly. More...
 
bool add (agx::MergedBody *mergedBody)
 Add a MergedBody to this assembly. More...
 
bool add (agxStream::Serializable *object)
 Add an object of type serialized. More...
 
virtual void addNotification (Assembly *)
 Called when this assembly is added to another assembly. More...
 
bool empty () const
 
const AssemblyRefSetVector & getAssemblies () const
 
const agxSDK::Assembly * getAssembly (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return named Assembly. More...
 
agxSDK::Assembly * getAssembly (const agx::Name &name, bool recursive=true)
 Find (linear search) and return named Assembly. More...
 
const agxSDK::Assembly * getAssembly (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return an Assembly matching the given uuid. More...
 
agxSDK::Assembly * getAssembly (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return an Assembly matching the given uuid. More...
 
const char * getClassName () const override
 
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. More...
 
agx::Constraint * getConstraint (const agx::Uuid &uuid, bool recursive=true)
 Find and return a pointer to a Constraint with the given uuid. More...
 
const agx::Constraint * getConstraint (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return named Constraint. More...
 
agx::Constraint * getConstraint (const agx::Name &name, bool recursive=true)
 Find (linear search) and return named Constraint. More...
 
template<typename T >
T * getConstraint (const agx::Name &name, bool recursive=true)
 Find and return named Constraint of a template type, for example Hinge: More...
 
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: More...
 
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. More...
 
virtual const agx::Frame * getFrame () const
 
const agxCollide::GeometryRefSetVector & getGeometries () const
 
const agxCollide::Geometry * getGeometry (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return named collision Geometry. More...
 
agxCollide::Geometry * getGeometry (const agx::Name &name, bool recursive=true)
 Find (linear search) and return named collision Geometry. More...
 
const agxCollide::Geometry * getGeometry (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return a Geometry matching the given uuid. More...
 
agxCollide::Geometry * getGeometry (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return a Geometry matching the given uuid. More...
 
const agx::InteractionRefSetVector & getInteractions () const
 
agx::Vec3 getLocalPosition () const
 
agx::Quat getLocalRotation () const
 
const agx::AffineMatrix4x4 & getLocalTransform () const
 
const agx::MergedBodyRefSetVector & getMergedBodies () const
 
const agx::MergedBody * getMergedBody (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return an MergedBody matching the given uuid. More...
 
agx::MergedBody * getMergedBody (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return an MergedBody matching the given uuid. More...
 
agx::Name getName () const
 
const agx::ObserverFrame * getObserverFrame (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return an ObserverFrame matching the given uuid. More...
 
agx::ObserverFrame * getObserverFrame (const agx::Name &name, bool recursive=true)
 Find (linear search) and return an ObserverFrame matching the given uuid. More...
 
const agx::ObserverFrame * getObserverFrame (const agx::Uuid &uuid, bool recursive=true) const
 Find (linear search) and return an ObserverFrame matching the given uuid. More...
 
agx::ObserverFrame * getObserverFrame (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return an ObserverFrame matching the given uuid. More...
 
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. More...
 
const agx::RigidBody * getRigidBody (const agx::Name &name, bool recursive=true) const
 Find (linear search) and return named RigidBody. More...
 
agx::RigidBody * getRigidBody (const agx::Uuid &uuid, bool recursive=true)
 Find (linear search) and return a pointer to a RigidBody with the given uuid. More...
 
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. More...
 
agxSDK::Simulation * getSimulation ()
 
const agxSDK::Simulation * getSimulation () const
 
agxStream::StorageAgent * getStorageAgent () const override
 
Type getType () const
 
bool remove (agx::Constraint *constraint)
 Remove a constraint from this assembly (does not recurse down in tree). More...
 
bool remove (agx::Interaction *interaction)
 Remove an interaction from this assembly. More...
 
bool remove (EventListener *listener)
 Remove an EventListener from the assembly. More...
 
bool remove (agx::RigidBody *body, bool removeAssociatedGeometries=false, bool resetParentFrame=true)
 Remove a rigid body from this assembly (does not recurse down in tree). More...
 
bool remove (agxCollide::Geometry *geometry, bool resetParentFrame=true)
 Remove a geometry from this assembly (does not recurse down in tree). More...
 
bool remove (Assembly *assembly, bool resetParentFrame=true)
 Remove a child assembly from a parent. More...
 
bool remove (agx::ContactMaterial *contactMaterial)
 Remove a contact material from this assembly. More...
 
bool remove (agx::Emitter *emitter)
 Remove an emitter from this assembly. More...
 
bool remove (agx::ObserverFrame *observerFrame, bool resetParentFrame=true)
 Remove an ObserverFrame from this assembly. More...
 
bool remove (agx::MergedBody *mergedBody)
 Remove a MergedBody from this assembly. More...
 
virtual void removeNotification (Assembly *)
 Called when this assembly is removed from another assembly. More...
 
bool reset (bool resetParentFrame=true)
 If this assembly is not added to a simulation it will clear all added bodies etc. More...
 
virtual void setAngularVelocity (const agx::Vec3 &velocity)
 Set the angular velocity (in world frame) recursively for all rigid bodies stored in assembly. More...
 
void setLocalPosition (const agx::Vec3 &p)
 Set the position of the assembly relative to its frame's parent frame. More...
 
void setLocalPosition (agx::Real x, agx::Real y, agx::Real z)
 Set the position of the assembly relative to its frame's parent frame. More...
 
void setLocalRotation (const agx::Quat &q)
 Set the rotation of the assembly relative to its frame's parent frame. More...
 
void setLocalRotation (const agx::EulerAngles &e)
 Set the rotation of the assembly relative to its frame's parent frame. More...
 
void setLocalTransform (const agx::AffineMatrix4x4 &matrix)
 Assign the local transformation matrix for this assembly, ignoring any eventual parent transformation. More...
 
void setName (const agx::Name &name)
 Set the name of this Assembly. More...
 
bool setParentFrame (agx::Frame *frame)
 Set the parent frame of this assembly's frame. More...
 
void setPosition (const agx::Vec3 &p)
 Set the position of the frame in world coordinates. More...
 
void setPosition (agx::Real x, agx::Real y, agx::Real z)
 Set the position of the frame in world coordinates. More...
 
void setRotation (const agx::Quat &q)
 Set the rotation of the assembly relative to world frame. More...
 
void setRotation (const agx::EulerAngles &e)
 Set the rotation of the assembly relative to world frame. More...
 
void setRotation (const agx::OrthoMatrix3x3 &m)
 Set the rotation of the assembly relative to world frame. More...
 
void setTransform (const agx::AffineMatrix4x4 &matrix)
 Set the transform of the assembly. More...
 
virtual void setVelocity (const agx::Vec3 &velocity)
 Set the linear velocity (in world frame) recursively for all rigid bodies stored in assembly. More...
 
bool transfer (agxSDK::Assembly *target)
 Transfer all the content from this assembly to the target, including name and transformation. More...
 
virtual void traverse (AssemblyVisitor *visitor)
 Traverse the assembly tree recursively using a visitor. More...
 
virtual void traverse (const AssemblyVisitor *visitor) const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings. More...
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object. More...
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 

Protected Member Functions

 Tree ()
 Use agxModel::Tree instead if you intend to use this constructor. More...
 
virtual ~Tree ()
 
virtual void addNotification (agxSDK::Simulation *simulation)
 Called when this assembly is added to a simulation (given that it not already is in the simulation). More...
 
virtual Tree * clone ()
 Clone call when new tree is needed from internal methods. More...
 
- Protected Member Functions inherited from agxModel::Tree
 Tree (agxModel::Tree::Branch *root)
 
void add (Branch *branch)
 Adds rigid body, constraint etc to this tree. More...
 
void addGroupID (Branch *branch, agx::UInt32 id)
 Adds the id to the branch geometries. More...
 
virtual void checkLoad (Branch *branch)
 Checks current load. More...
 
void configure (Branch *branch)
 Traverse this tree and configures the branches. More...
 
void copyParameters (const Branch *source, Branch *destination) const
 Copy branch parameters from source to destination. More...
 
void copyParameters (const agx::Constraint *source, agx::Constraint *destination) const
 Copy constraint parameters from source to destination. More...
 
Branch * guessConnectingChild (Branch *branch) const
 Searches branch children and examines orientation etc to "guess" which of the children that is along the main/current tree branch. More...
 
virtual void post ()
 Post step event callback. More...
 
virtual void pre ()
 Pre event callback. More...
 
virtual void preCollide ()
 Pre-collide event callback. More...
 
void remove (Branch *branch)
 Removes rigid body, constraint etc associated to this tree. More...
 
void removeGroupID (Branch *branch, agx::UInt32 id)
 Removes the id from the branch geometries. More...
 
virtual void removeNotification (agxSDK::Simulation *simulation) override
 Called when this assembly is removed from a simulation. More...
 
void setConstraintSolveType (Branch *branch, agx::Constraint::SolveType solveType)
 Assign constraint solve type. More...
 
void setMaterial (Branch *branch, agx::Material *material)
 Assign material to all geometries for branch. More...
 
void simplify (Branch *branch, bool flag, agxSDK::Simulation *simulation)
 Changes motion control and adds/removes constraints depending on flag. More...
 
void split (Branch *source, Branch *destination) const
 Move from source to destination. More...
 
- Protected Member Functions inherited from agxSDK::Assembly
 Assembly (Type type)
 
virtual ~Assembly ()
 Destructor. More...
 
bool addParticleSystem (agx::ParticleSystem *particleSystem)
 Add a particle system to this assembly. More...
 
void addToSimulation (Simulation *simulation)
 
void removeFromSimulation (Simulation *simulation)
 
bool removeParticleSystem (agx::ParticleSystem *particleSystem)
 Remove a particle system from this assembly. More...
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor. More...
 
 Serializable (const Serializable &other)
 Copy constructor. More...
 
void generateUuid ()
 

Protected Attributes

osg::observer_ptr< osg::Group > m_graphicsRoot
 
TreeRendererRef m_renderer
 
- Protected Attributes inherited from agxModel::Tree
BranchEventListenerRef m_branchListener
 
agx::ref_ptr< agx::Referenced > m_customData
 
agx::UInt32 m_disabledCollisionsID
 
DisabledCollisionsGeometryContainer m_externalDisabledGeometries
 
agx::UInt32 m_geometriesID
 
GroupIdContainer m_geometryIDs
 
agx::MaterialRef m_material
 
BranchRef m_root
 
int m_state
 
TreeStepEventListenerRef m_stepListener
 
TreeContactEventListenerRef m_wakeOnContactListener
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Public Types inherited from agxModel::Tree
typedef BranchContainer::const_iterator BranchConstIterator
 
typedef agx::Vector< BranchRef > BranchContainer
 
typedef agx::ref_ptr< BranchEventListener > BranchEventListenerRef
 
typedef BranchContainer::iterator BranchIterator
 
typedef agx::observer_ptr< Branch > BranchObs
 
typedef agx::ref_ptr< Branch > BranchRef
 
typedef agx::HashVector< agxCollide::Geometry *, agx::observer_ptr< agxCollide::Geometry > > DisabledCollisionsGeometryContainer
 
typedef agx::SetVector< agx::UInt32 > GroupIdContainer
 
enum  State { INITIALIZED = (1<<0), STATIC = (1<<1), WAKE_ON_CONTACT = (1<<2), RESTORING = (1<<3) }
 
typedef agx::ref_ptr< TreeExecuteFilter > TreeExecuteFilterRef
 
- Public Types inherited from agxSDK::Assembly
enum  Type { ASSEMBLY, COLLECTION }
 Specifies the type an assembly is. More...
 
- Static Public Member Functions inherited from agxModel::Tree
static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static Tree * find (agxSDK::Simulation *simulation, const agx::Name &name)
 
static Tree * find (agxSDK::Simulation *simulation, const agx::Uuid &uuid)
 
static TreePtrVector findAll (agxSDK::Simulation *simulation, const agx::Name &name)
 
static TreePtrVector getAll (agxSDK::Simulation *simulation)
 
static const char * getConstructClassId ()
 
static void setAngularVelocityDamping (agxModel::Tree::Branch *branch, const agx::Vec3 &angularVelocityDamping)
 Utility method to set angular velocity damping for all branches. More...
 
static void setDefaultParameters (agx::Material *material)
 Sets default material parameters for a tree. More...
 
static void setLinearVelocityDamping (agxModel::Tree::Branch *branch, const agx::Vec3 &linearVelocityDamping)
 Utility method to set linear velocity damping for all branches. More...
 
- Static Public Member Functions inherited from agxSDK::Assembly
static Assembly * asAssembly (agxStream::Serializable *obj)
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static agxStream::Serializable * create ()
 
static const char * getConstructClassId ()
 
- 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. More...
 
- Protected Types inherited from agxModel::Tree
typedef agx::ref_ptr< TreeContactEventListener > TreeContactEventListenerRef
 
typedef agx::ref_ptr< TreeStepEventListener > TreeStepEventListenerRef
 
- 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. More...
 

Detailed Description

Definition at line 56 of file agxOSG/Tree.h.

Constructor & Destructor Documentation

◆ Tree() [1/2]

agxOSG::Tree::Tree ( osg::Group *  root)

◆ ~Tree()

virtual agxOSG::Tree::~Tree ( )
inlineprotectedvirtual

Reimplemented from agxModel::Tree.

Definition at line 73 of file agxOSG/Tree.h.

◆ Tree() [2/2]

agxOSG::Tree::Tree ( )
inlineprotected

Use agxModel::Tree instead if you intend to use this constructor.

Definition at line 78 of file agxOSG/Tree.h.

References agxModel::Tree::addNotification().

Member Function Documentation

◆ addNotification()

virtual void agxOSG::Tree::addNotification ( agxSDK::Simulation *  )
protectedvirtual

Called when this assembly is added to a simulation (given that it not already is in the simulation).

Reimplemented from agxModel::Tree.

◆ clone()

virtual Tree* agxOSG::Tree::clone ( )
protectedvirtual

Clone call when new tree is needed from internal methods.

Implement this if when you have your own implementation of this tree class.

Returns
new tree

Reimplemented from agxModel::Tree.

◆ getColor()

const agx::Vec4 agxOSG::Tree::getColor ( ) const
inline
Returns
color of the tree

Definition at line 70 of file agxOSG/Tree.h.

◆ setColor()

void agxOSG::Tree::setColor ( const agx::Vec4 &  color)
inline

Assign color to this tree.

Default color is white.

Parameters
color- new color

Definition at line 65 of file agxOSG/Tree.h.

Member Data Documentation

◆ m_graphicsRoot

osg::observer_ptr< osg::Group > agxOSG::Tree::m_graphicsRoot
protected

Definition at line 87 of file agxOSG/Tree.h.

◆ m_renderer

TreeRendererRef agxOSG::Tree::m_renderer
protected

Definition at line 86 of file agxOSG/Tree.h.


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