Bullet Collision Detection & Physics Library
btCGProjection.h
Go to the documentation of this file.
1 /*
2  Written by Xuchen Han <xuchenhan2015@u.northwestern.edu>
3 
4  Bullet Continuous Collision Detection and Physics Library
5  Copyright (c) 2019 Google Inc. http://bulletphysics.org
6  This software is provided 'as-is', without any express or implied warranty.
7  In no event will the authors be held liable for any damages arising from the use of this software.
8  Permission is granted to anyone to use this software for any purpose,
9  including commercial applications, and to alter it and redistribute it freely,
10  subject to the following restrictions:
11  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13  3. This notice may not be removed or altered from any source distribution.
14  */
15 
16 #ifndef BT_CG_PROJECTION_H
17 #define BT_CG_PROJECTION_H
18 
19 #include "btSoftBody.h"
22 
24 {
31 
33  {
34  append(rcontact);
35  }
36 
38  {
39  m_contact.push_back(NULL);
40  }
41 
42  void append(const btSoftBody::RContact& rcontact)
43  {
44  m_contact.push_back(&rcontact);
47  m_static.push_back(false);
49  }
50 
51  void replace(const btSoftBody::RContact& rcontact)
52  {
53  m_contact.clear();
56  m_static.clear();
58  append(rcontact);
59  }
60 
62  {
63  }
64 };
65 
67 {
68 public:
73  const btScalar& m_dt;
74  // map from node indices to node pointers
76 
78  : m_softBodies(softBodies)
79  , m_dt(dt)
80  {
81  }
82 
83  virtual ~btCGProjection()
84  {
85  }
86 
87  // apply the constraints
88  virtual void project(TVStack& x) = 0;
89 
90  virtual void setConstraints() = 0;
91 
92  // update the constraints
93  virtual btScalar update() = 0;
94 
95  virtual void reinitialize(bool nodeUpdated)
96  {
97  }
98 
100  {
101  m_nodes = nodes;
102  }
103 };
104 
105 
106 #endif /* btCGProjection_h */
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btCGProjection::m_nodes
const btAlignedObjectArray< btSoftBody::Node * > * m_nodes
Definition: btCGProjection.h:75
btCGProjection::setIndices
virtual void setIndices(const btAlignedObjectArray< btSoftBody::Node * > *nodes)
Definition: btCGProjection.h:99
btAlignedObjectArray::clear
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
Definition: btAlignedObjectArray.h:176
DeformableContactConstraint::m_node
const btSoftBody::Node * m_node
Definition: btCGProjection.h:25
DeformableContactConstraint::m_total_tangent_dv
btAlignedObjectArray< btVector3 > m_total_tangent_dv
Definition: btCGProjection.h:28
btSoftBody::Node
Definition: btSoftBody.h:255
DeformableContactConstraint
Definition: btCGProjection.h:23
btSoftBody::RContact
Definition: btSoftBody.h:318
btCGProjection::update
virtual btScalar update()=0
btMultiBodyLinkCollider.h
DeformableContactConstraint::m_static
btAlignedObjectArray< bool > m_static
Definition: btCGProjection.h:29
btCGProjection::setConstraints
virtual void setConstraints()=0
DeformableContactConstraint::m_total_normal_dv
btAlignedObjectArray< btVector3 > m_total_normal_dv
Definition: btCGProjection.h:27
DeformableContactConstraint::DeformableContactConstraint
DeformableContactConstraint(const btSoftBody::RContact &rcontact)
Definition: btCGProjection.h:32
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:80
DeformableContactConstraint::~DeformableContactConstraint
~DeformableContactConstraint()
Definition: btCGProjection.h:61
btCGProjection::btCGProjection
btCGProjection(btAlignedObjectArray< btSoftBody * > &softBodies, const btScalar &dt)
Definition: btCGProjection.h:77
btAlignedObjectArray< const btSoftBody::RContact * >
btCGProjection::m_softBodies
btAlignedObjectArray< btSoftBody * > & m_softBodies
Definition: btCGProjection.h:72
DeformableContactConstraint::m_can_be_dynamic
btAlignedObjectArray< bool > m_can_be_dynamic
Definition: btCGProjection.h:30
btCGProjection::~btCGProjection
virtual ~btCGProjection()
Definition: btCGProjection.h:83
DeformableContactConstraint::m_contact
btAlignedObjectArray< const btSoftBody::RContact * > m_contact
Definition: btCGProjection.h:26
btCGProjection::TVArrayStack
btAlignedObjectArray< btAlignedObjectArray< btVector3 > > TVArrayStack
Definition: btCGProjection.h:70
btCGProjection::TVStack
btAlignedObjectArray< btVector3 > TVStack
Definition: btCGProjection.h:69
btCGProjection::project
virtual void project(TVStack &x)=0
btMultiBodyConstraint.h
btCGProjection::m_dt
const btScalar & m_dt
Definition: btCGProjection.h:73
btCGProjection
Definition: btCGProjection.h:66
DeformableContactConstraint::DeformableContactConstraint
DeformableContactConstraint()
Definition: btCGProjection.h:37
btCGProjection::TArrayStack
btAlignedObjectArray< btAlignedObjectArray< btScalar > > TArrayStack
Definition: btCGProjection.h:71
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:257
DeformableContactConstraint::append
void append(const btSoftBody::RContact &rcontact)
Definition: btCGProjection.h:42
DeformableContactConstraint::replace
void replace(const btSoftBody::RContact &rcontact)
Definition: btCGProjection.h:51
btSoftBody.h
btCGProjection::reinitialize
virtual void reinitialize(bool nodeUpdated)
Definition: btCGProjection.h:95