CGELMesh.h
Go to the documentation of this file.
1 //===========================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2016, CHAI3D.
5  (www.chai3d.org)
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions
11  are met:
12 
13  * Redistributions of source code must retain the above copyright
14  notice, this list of conditions and the following disclaimer.
15 
16  * Redistributions in binary form must reproduce the above
17  copyright notice, this list of conditions and the following
18  disclaimer in the documentation and/or other materials provided
19  with the distribution.
20 
21  * Neither the name of CHAI3D nor the names of its contributors may
22  be used to endorse or promote products derived from this software
23  without specific prior written permission.
24 
25  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  POSSIBILITY OF SUCH DAMAGE.
37 
38  \author <http://www.chai3d.org>
39  \author Francois Conti
40  \version 3.2.0 $Rev: 1869 $
41 */
42 //===========================================================================
43 
44 //---------------------------------------------------------------------------
45 #ifndef CGELMeshH
46 #define CGELMeshH
47 //---------------------------------------------------------------------------
48 #include "CGELSkeletonNode.h"
49 #include "CGELSkeletonLink.h"
50 #include "CGELLinearSpring.h"
51 #include "CGELVertex.h"
52 //---------------------------------------------------------------------------
53 #include "chai3d.h"
54 //---------------------------------------------------------------------------
55 
56 //===========================================================================
63 //===========================================================================
64 
65 //===========================================================================
74 //===========================================================================
76 {
77  //-----------------------------------------------------------------------
78  // CONSTRUCTOR & DESTRUCTOR:
79  //-----------------------------------------------------------------------
80 
81 public:
82 
84  cGELMesh(){ initialise(); };
85 
87  virtual ~cGELMesh() {};
88 
89 
90  //-----------------------------------------------------------------------
91  // METHODS:
92  //-----------------------------------------------------------------------
93 
94 public:
95 
97  void buildVertices();
98 
100  void connectVerticesToSkeleton(bool a_connectToNodesOnly);
101 
103  void updateVertexPosition();
104 
106  void clearForces();
107 
109  void clearExternalForces();
110 
112  void computeForces();
113 
115  void computeNextPose(double iTimeInterval);
116 
118  void applyNextPose();
119 
121  virtual void render(chai3d::cRenderOptions& a_options);
122 
123 
124  //-----------------------------------------------------------------------
125  // MEMBERS:
126  //-----------------------------------------------------------------------
127 
128 public:
129 
131  std::list<cGELSkeletonNode*> m_nodes;
132 
134  std::list<cGELSkeletonLink*> m_links;
135 
137  std::list<cGELLinearSpring*> m_linearSprings;
138 
140  std::vector<cGELVertex> m_gelVertices;
141 
144 
147 
150 
153 
154 
155  //-----------------------------------------------------------------------
156  // METHODS:
157  //-----------------------------------------------------------------------
158 
159 private:
160 
162  void initialise();
163 };
164 
165 //---------------------------------------------------------------------------
166 #endif
167 //---------------------------------------------------------------------------
void applyNextPose()
This method updates the position of the mesh after computation.
Definition: CGELMesh.cpp:186
std::list< cGELSkeletonLink * > m_links
List of links connecting the different nodes.
Definition: CGELMesh.h:134
void computeNextPose(double iTimeInterval)
This method updates the simulation over a time interval.
Definition: CGELMesh.cpp:158
std::list< cGELSkeletonNode * > m_nodes
List of nodes composing the skeleton.
Definition: CGELMesh.h:131
std::vector< cGELVertex > m_gelVertices
List of deformable vertices.
Definition: CGELMesh.h:140
virtual void render(chai3d::cRenderOptions &a_options)
This method renders the deformable mesh graphically.
Definition: CGELMesh.cpp:216
Implementation on a linear spring.
std::list< cGELLinearSpring * > m_linearSprings
List of linear springs connecting vertices together.
Definition: CGELMesh.h:137
bool m_useSkeletonModel
If true then use skeleton model.
Definition: CGELMesh.h:149
void clearForces()
This method sets all computed forces to zero.
Definition: CGELMesh.cpp:70
This class inherits from class cMesh and integrate a skeleton model for modelling deformations of the...
Definition: CGELMesh.h:75
bool m_useMassParticleModel
If true then use vertex mass particle model.
Definition: CGELMesh.h:152
Implementation of a vertex for deformable objects.
void updateVertexPosition()
This method updates the position of all vertices connected to the skeleton.
Definition: CGELMesh.cpp:410
bool m_showMassParticleModel
If true then display mass particle model.
Definition: CGELMesh.h:146
void clearExternalForces()
This method sets all external forces to zero.
Definition: CGELMesh.cpp:98
void buildVertices()
This method builds all dynamic vertices that describe the deformable mesh.
Definition: CGELMesh.cpp:272
virtual ~cGELMesh()
Destructor of cGELMesh.
Definition: CGELMesh.h:87
void connectVerticesToSkeleton(bool a_connectToNodesOnly)
This method connects each dynamic vertex to the skeleton.
Definition: CGELMesh.cpp:318
bool m_showSkeletonModel
If true then display skeleton.
Definition: CGELMesh.h:143
void computeForces()
This method computes all internal forces.
Definition: CGELMesh.cpp:127
cGELMesh()
Constructor of cGELMesh.
Definition: CGELMesh.h:84
Implementation of a skeleton mass node.