summaryrefslogtreecommitdiff
path: root/src/BulletSoftBody/btDeformableContactProjection.h
blob: ea3b00f62d62fd6ced8a7603e427579978e913f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
//  btDeformableContactProjection.h
//  BulletSoftBody
//
//  Created by Xuchen Han on 7/4/19.
//

#ifndef BT_CONTACT_PROJECTION_H
#define BT_CONTACT_PROJECTION_H
#include "btCGProjection.h"
#include "btSoftBody.h"
#include "BulletDynamics/Featherstone/btMultiBodyLinkCollider.h"
#include "BulletDynamics/Featherstone/btMultiBodyConstraint.h"
#include <iostream>
class btDeformableContactProjection : public btCGProjection
{
public:
    std::unordered_map<btSoftBody::Node *, btAlignedObjectArray<DeformableContactConstraint> > m_constraints;
    std::unordered_map<btSoftBody::Node *, btAlignedObjectArray<DeformableFrictionConstraint> > m_frictions;
    
    btDeformableContactProjection(btAlignedObjectArray<btSoftBody *>& softBodies, const btScalar& dt, const std::unordered_map<btSoftBody::Node *, size_t>* indices)
    : btCGProjection(softBodies, dt, indices)
    {
    }
    
    virtual ~btDeformableContactProjection()
    {
    }
    
    // apply the constraints to the rhs
    virtual void project(TVStack& x);
    
    // apply constraints to x in Ax=b
    virtual void enforceConstraint(TVStack& x);
    
    // update the constraints
    virtual void update();
    
    virtual void setConstraints();
    
    virtual void reinitialize(bool nodeUpdated);
};
#endif /* btDeformableContactProjection_h */