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 {
58 append(rcontact);
59 }
60
62 {
63 }
64};
65
67{
68public:
73 const btScalar& m_dt;
74 // map from node indices to node pointers
76
78 : m_softBodies(softBodies), m_dt(dt)
79 {
80 }
81
83 {
84 }
85
86 // apply the constraints
87 virtual void project(TVStack& x) = 0;
88
89 virtual void setConstraints() = 0;
90
91 // update the constraints
92 virtual btScalar update() = 0;
93
94 virtual void reinitialize(bool nodeUpdated)
95 {
96 }
97
99 {
100 m_nodes = nodes;
101 }
102};
103
104#endif /* btCGProjection_h */
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
void push_back(const T &_Val)
virtual void setConstraints()=0
const btScalar & m_dt
const btAlignedObjectArray< btSoftBody::Node * > * m_nodes
btAlignedObjectArray< btSoftBody * > & m_softBodies
btAlignedObjectArray< btAlignedObjectArray< btVector3 > > TVArrayStack
virtual void reinitialize(bool nodeUpdated)
virtual ~btCGProjection()
btAlignedObjectArray< btVector3 > TVStack
virtual btScalar update()=0
btCGProjection(btAlignedObjectArray< btSoftBody * > &softBodies, const btScalar &dt)
btAlignedObjectArray< btAlignedObjectArray< btScalar > > TArrayStack
virtual void setIndices(const btAlignedObjectArray< btSoftBody::Node * > *nodes)
virtual void project(TVStack &x)=0
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:82
btAlignedObjectArray< bool > m_static
btAlignedObjectArray< bool > m_can_be_dynamic
DeformableContactConstraint(const btSoftBody::RContact &rcontact)
btAlignedObjectArray< btVector3 > m_total_normal_dv
void replace(const btSoftBody::RContact &rcontact)
btAlignedObjectArray< const btSoftBody::RContact * > m_contact
void append(const btSoftBody::RContact &rcontact)
btAlignedObjectArray< btVector3 > m_total_tangent_dv
const btSoftBody::Node * m_node