This repository has been archived by the owner on Apr 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
cloth_utility.h
240 lines (203 loc) · 6.1 KB
/
cloth_utility.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*
* cloth_utility.h
* sensitive couture
*
* Created by Nobuyuki Umetani on 9/17/10.
* Copyright 2010 The University of Tokyo and Columbia University. All rights reserved.
*
*/
#if !defined(CLOTH_UTILITY_H)
#define CLOTH_UTILITY_H
#include "delfem/field_world.h"
#include "contact_target.h"
#include "eqn_contact3d.h"
#include "stitch_array.h"
class CClothParam{
public:
CClothParam(){
stiff_bend = 0;
stiff_myu = 1;
stiff_lambda = 0;
rho = 1;
}
CClothParam(const CClothParam& cp){
this->stiff_bend = cp.stiff_bend;
this->stiff_myu = cp.stiff_myu;
this->stiff_lambda = cp.stiff_lambda;
this->rho = cp.rho;
}
public:
double stiff_bend;
double stiff_myu;
double stiff_lambda;
double rho;
};
class CContactParam{
public:
double myu_k;
double myu_s;
double stiff_n;
double stiff_f;
double offset;
};
bool KineticDamping(double ke0, double ke1, double ke2,
unsigned int id_field_disp, Fem::Field::CFieldWorld& world);
bool StepTime_Static
(double& dt,
double& total_energy,
double torelance_static,
bool& is_ilufrac_success,
Fem::Ls::CLinearSystem_Field& ls, LsSol::CPreconditioner_ILU& prec,
////
const CClothParam& cloth_param,
double g_x, double g_y, double g_z,
////
const CContactParam& contact_param,
const CContactTarget3D& CT,
std::vector<CFrictionPoint>& aFrictionPoint,
/////
const CStitchAry& stitch_ary,
////
unsigned int id_field_disp,
unsigned int id_field_hinge,
unsigned int id_field_disp_buffer,
Fem::Field::CFieldWorld& world);
bool GetSensitivity_fictbend
(Fem::Ls::CLinearSystem_Field& ls, LsSol::CPreconditioner_ILU& prec,
////
const CClothParam& cloth_param,
double g_x, double g_y, double g_z,
////
const CContactParam& contact_param,
const CContactTarget3D& CT,
std::vector<CFrictionPoint>& aFrictionPoint,
/////
const CStitchAry& stitch_ary,
/////
unsigned int id_field_disp,
unsigned int id_field_hinge,
////
bool is_xy,
unsigned int id_field_senseX, unsigned int id_field_senseY,
unsigned int id_field_lamX, unsigned int id_field_lamY,
Fem::Field::CFieldWorld& world);
void DrawSeamLine(unsigned int id_field_disp, unsigned int id_field_dart, const Fem::Field::CFieldWorld& world);
class CInterpBarycentric
{
public:
CInterpBarycentric(){
ino1 = 0;
ino2 = 0;
ino3 = 0;
r1_ini = 0;
r2_ini = 0;
height = 0;
r1 = 0;
r2 = 0;
}
public:
unsigned int ino1, ino2, ino3;
double r1_ini;
double r2_ini;
////
double height;
double r1;
double r2;
};
// copy id1 into id0
void CopyValueVelo(unsigned int id0, unsigned int id1, Fem::Field::CFieldWorld& world);
// copy id1 into id0
void SetDeformedValue(unsigned int id0, unsigned int id1, Fem::Field::CFieldWorld& world);
void InterpField(unsigned int id_base_to, unsigned int id_field_to,
unsigned int id_base_from, unsigned int id_field_from,
Fem::Field::CFieldWorld& world);
void FindBaseInterp(unsigned int id_base_to,
unsigned int id_base_from,
Fem::Field::CFieldWorld& world,
std::vector<CInterpBarycentric>& aInterp);
void MoveFineBaseCoord(unsigned int id_base_to,
unsigned int id_base_from,
Fem::Field::CFieldWorld& world,
const std::vector<CInterpBarycentric>& aInterp);
void MoveFineDeformedCoord(unsigned int id_field_disp_to, unsigned int id_base_to,
unsigned int id_field_disp_from, unsigned int id_base_from,
Fem::Field::CFieldWorld& world,
const std::vector<CInterpBarycentric>& aInterp);
void UpdateFineDeformedInterp(unsigned int id_field_disp_to, unsigned int id_base_to,
unsigned int id_field_disp_from, unsigned int id_base_from,
const Fem::Field::CFieldWorld& world,
std::vector<CInterpBarycentric>& aInterp);
void InitFineDeformInterp(std::vector<CInterpBarycentric>& aInterp);
//////
void NoResponse
(double mov_x, double mov_y,
unsigned int id_field_disp,
unsigned int id_field_reference,
unsigned int id_field_lamX, unsigned int id_field_lamY,
Fem::Field::CFieldWorld& world );
void NoResponse_Slider
(double mov_v,
unsigned int id_field_disp,
unsigned int id_field_reference,
unsigned int id_field_lamX,
Fem::Field::CFieldWorld& world );
void SensitiveResponse
(double mov_x, double mov_y,
unsigned int id_field_disp,
unsigned int id_field_reference,
unsigned int id_field_lamX, unsigned int id_field_lamY,
unsigned int id_field_senseX, unsigned int id_field_senseY,
Fem::Field::CFieldWorld& world );
void SensitiveResponse_Slider
(double mov_v,
unsigned int id_field_disp,
unsigned int id_field_reference,
unsigned int id_field_lamX,
unsigned int id_field_senseX,
Fem::Field::CFieldWorld& world );
class CSolutionSensitivity{
public:
CSolutionSensitivity(){
is_active = false;
is_xy = true;
obj_x = 0;
obj_y = 0;
val_slider = 0;
id_field_x = 0;
id_field_dudpx = 0;
id_field_dudpy = 0;
}
public:
bool is_active;
bool is_xy;
double obj_x;
double obj_y;
double val_slider;
unsigned int id_field_x;
unsigned int id_field_dudpx;
unsigned int id_field_dudpy;
};
void GuessSolution_GMLS
(double pre_x, double pre_y,
double pos_x, double pos_y,
unsigned int id_field_disp,
unsigned int id_field_reference,
unsigned int id_field_lamX, unsigned int id_field_lamY,
const std::vector<CSolutionSensitivity>& aSolSens,
Fem::Field::CFieldWorld& world );
void GuessSolution_GMLS_Slider
(double pre_v, double pos_v,
unsigned int id_field_disp,
unsigned int id_field_reference,
unsigned int id_field_lamX,
const std::vector<CSolutionSensitivity>& aSolSens,
Fem::Field::CFieldWorld& world );
void GuessSolution_MLS
(double pre_x, double pre_y,
double pos_x, double pos_y,
unsigned int id_field_disp,
unsigned int id_field_reference,
unsigned int id_field_lamX, unsigned int id_field_lamY,
const std::vector<CSolutionSensitivity>& aSolSens,
Fem::Field::CFieldWorld& world );
#endif