AGXDynamics  2.35.0.2
BeamStiffnessDamping.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agxModel/export.h>
20 
21 #include <agx/LockJoint.h>
22 
23 namespace agxModel
24 {
30  {
36  static BeamStiffnessDamping createDefault();
37 
43 
49 
55 
61 
68  void apply( agx::LockJoint* lock, agx::Real scale = 1.0 ) const;
69  };
70 
71  inline void BeamStiffnessDamping::apply( agx::LockJoint* lock, agx::Real scale /*= 1.0*/ ) const
72  {
73  if ( lock == nullptr )
74  return;
75 
76  constexpr agx::Real minStiffness = 1.0E-5;
77  constexpr agx::Real minDamping = 0.0;
78 
81  lock->setCompliance( 1.0 / std::max( scale * translationalStiffness.z(), minStiffness ), agx::LockJoint::TRANSLATIONAL_3 );
82 
83  lock->setCompliance( 1.0 / std::max( scale * rotationalStiffness.x(), minStiffness ), agx::LockJoint::ROTATIONAL_1 );
84  lock->setCompliance( 1.0 / std::max( scale * rotationalStiffness.y(), minStiffness ), agx::LockJoint::ROTATIONAL_2 );
85  lock->setCompliance( 1.0 / std::max( scale * rotationalStiffness.z(), minStiffness ), agx::LockJoint::ROTATIONAL_3 );
86 
90 
94  }
95 }
agxModel::BeamStiffnessDamping::rotationalStiffness
agx::Vec3 rotationalStiffness
Rotational stiffness where x and y are bend stiffness and z is torsion.
Definition: BeamStiffnessDamping.h:48
agx::Constraint::setCompliance
virtual void setCompliance(agx::Real compliance, agx::Int dof)
Set the compliance of this constraint for the i:th DOF.
agx::Real
double Real
Definition: Real.h:42
agxModel
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
agxModel::BeamStiffnessDamping::apply
void apply(agx::LockJoint *lock, agx::Real scale=1.0) const
Apply stiffness as compliance to the given lock joint.
Definition: BeamStiffnessDamping.h:71
agx::Constraint::setDamping
virtual void setDamping(agx::Real damping, agx::Int dof)
Set the damping of this constraint for the i:th DOF.
agx::LockJoint::TRANSLATIONAL_3
@ TRANSLATIONAL_3
Select DOF for the third translational axis.
Definition: LockJoint.h:73
agxModel::BeamStiffnessDamping::translationalStiffness
agx::Vec3 translationalStiffness
Translational stiffness where x and y are shear stiffness and z is stretch.
Definition: BeamStiffnessDamping.h:42
export.h
agx::Vec3T::y
T & y()
Definition: Vec3Template.h:505
agx::Vec3T::x
T & x()
Definition: Vec3Template.h:499
agx::LockJoint::TRANSLATIONAL_2
@ TRANSLATIONAL_2
Select DOF for the second translational axis.
Definition: LockJoint.h:72
agx::LockJoint
Constraint that removes all 6 DOF between two bodies, or one body and the world.
Definition: LockJoint.h:28
LockJoint.h
agx::LockJoint::ROTATIONAL_3
@ ROTATIONAL_3
Select DOF for rotation around Z-axis.
Definition: LockJoint.h:76
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition: agxModel/export.h:42
agxModel::BeamStiffnessDamping::rotationalDampingTime
agx::Vec3 rotationalDampingTime
Rotational damping time where x and y are bend damping and z is torsion.
Definition: BeamStiffnessDamping.h:60
agx::Vec3T< Real >
agxModel::BeamStiffnessDamping
Stiffness and damping data for constraints related to beam models.
Definition: BeamStiffnessDamping.h:29
agx::max
Vec3T< T > max(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Definition: Vec3Template.h:874
agxModel::BeamStiffnessDamping::translationalDampingTime
agx::Vec3 translationalDampingTime
Translational damping time where x and y are shear damping and z is stretch.
Definition: BeamStiffnessDamping.h:54
agx::LockJoint::ROTATIONAL_1
@ ROTATIONAL_1
Select DOF corresponding to the first rotational axis.
Definition: LockJoint.h:74
agx::Vec3T::z
T & z()
Definition: Vec3Template.h:511
agx::LockJoint::ROTATIONAL_2
@ ROTATIONAL_2
Select DOF corresponding to the second rotational axis.
Definition: LockJoint.h:75
agx::LockJoint::TRANSLATIONAL_1
@ TRANSLATIONAL_1
Select DOF for the first translational axis.
Definition: LockJoint.h:71