10 #ifdef IMPLICIT_SOLVER_EIGEN
13 # define USE_EIGEN_CONSTRAINED_CG
16 # pragma GCC diagnostic push
21 # ifndef IMPLICIT_ENABLE_EIGEN_DEBUG
23 # define IMPLICIT_NDEBUG
28 # include <Eigen/Sparse>
29 # include <Eigen/src/Core/util/DisableStupidWarnings.h>
31 # ifdef USE_EIGEN_CONSTRAINED_CG
35 # ifndef IMPLICIT_ENABLE_EIGEN_DEBUG
36 # ifndef IMPLICIT_NDEBUG
39 # undef IMPLICIT_NDEBUG
44 # pragma GCC diagnostic pop
70 static float I[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
75 class fVector :
public Eigen::Vector3f {
83 fVector(
const ctype &
v)
85 for (
int k = 0; k < 3; k++) {
92 for (
int k = 0; k < 3; k++) {
107 class fMatrix :
public Eigen::Matrix3f {
109 typedef float (*ctype)[3];
115 fMatrix(
const ctype &
v)
117 for (
int k = 0; k < 3; k++) {
118 for (
int l = 0;
l < 3;
l++) {
119 coeffRef(
l, k) =
v[k][
l];
126 for (
int k = 0; k < 3; k++) {
127 for (
int l = 0;
l < 3;
l++) {
128 coeffRef(
l, k) =
v[k][
l];
136 return (ctype)
data();
143 class lVector :
public Eigen::VectorXf {
145 typedef Eigen::VectorXf base_t;
157 float *v3(
int vertex)
159 return &coeffRef(3 * vertex);
162 const float *v3(
int vertex)
const
164 return &coeffRef(3 * vertex);
168 typedef Eigen::Triplet<Scalar>
Triplet;
171 typedef Eigen::SparseMatrix<Scalar>
lMatrix;
189 void reserve(
int numverts)
192 m_trips.reserve(numverts * 9);
195 void add(
int i,
int j,
const fMatrix &m)
199 for (
int k = 0; k < 3; k++) {
200 for (
int l = 0;
l < 3;
l++) {
201 m_trips.push_back(
Triplet(i + k, j +
l, m.coeff(
l, k)));
206 void sub(
int i,
int j,
const fMatrix &m)
210 for (
int k = 0; k < 3; k++) {
211 for (
int l = 0;
l < 3;
l++) {
212 m_trips.push_back(
Triplet(i + k, j +
l, -m.coeff(
l, k)));
217 inline void construct(
lMatrix &m)
219 m.setFromTriplets(m_trips.begin(), m_trips.end());
227 # ifdef USE_EIGEN_CORE
228 typedef Eigen::ConjugateGradient<lMatrix, Eigen::Lower, Eigen::DiagonalPreconditioner<Scalar>>
231 # ifdef USE_EIGEN_CONSTRAINED_CG
235 Eigen::DiagonalPreconditioner<Scalar>>
238 using Eigen::ComputationInfo;
242 for (
int i = 0; i <
v.rows(); i++) {
243 if (i > 0 && i % 3 == 0) {
247 printf(
"%f,\n",
v[i]);
253 for (
int j = 0; j < m.rows(); j++) {
254 if (j > 0 && j % 3 == 0) {
258 for (
int i = 0; i < m.cols(); i++) {
259 if (i > 0 && i % 3 == 0) {
271 m.reserve(Eigen::VectorXi::Constant(m.cols(), num));
276 return v.data() + 3 * vertex;
281 return v.data() + 3 * vertex;
289 for (
int l = 0;
l < 3;
l++) {
290 for (
int k = 0; k < 3; k++) {
291 tlist.push_back(
Triplet(i + k, j +
l, m[k][
l]));
300 for (
int l = 0;
l < 3;
l++) {
301 for (
int k = 0; k < 3; k++) {
302 tlist.push_back(
Triplet(i + k, j +
l, m[k][
l] * factor));
310 t.setFromTriplets(tlist.begin(), tlist.end());
317 t.setFromTriplets(tlist.begin(), tlist.end());
324 t.setFromTriplets(tlist.begin(), tlist.end());
358 r[0][0] += m[0][0] * f;
359 r[0][1] += m[0][1] * f;
360 r[0][2] += m[0][2] * f;
361 r[1][0] += m[1][0] * f;
362 r[1][1] += m[1][1] * f;
363 r[1][2] += m[1][2] * f;
364 r[2][0] += m[2][0] * f;
365 r[2][1] += m[2][1] * f;
366 r[2][2] += m[2][2] * f;
371 r[0][0] =
a[0][0] +
b[0][0] * f;
372 r[0][1] =
a[0][1] +
b[0][1] * f;
373 r[0][2] =
a[0][2] +
b[0][2] * f;
374 r[1][0] =
a[1][0] +
b[1][0] * f;
375 r[1][1] =
a[1][1] +
b[1][1] * f;
376 r[1][2] =
a[1][2] +
b[1][2] * f;
377 r[2][0] =
a[2][0] +
b[2][0] * f;
378 r[2][1] =
a[2][1] +
b[2][1] * f;
379 r[2][2] =
a[2][2] +
b[2][2] * f;
383 typedef std::vector<fMatrix> fMatrixVector;
390 void resize(
int numverts)
392 this->numverts = numverts;
393 int tot = 3 * numverts;
397 dFdX.resize(tot, tot);
398 dFdV.resize(tot, tot);
400 tfm.resize(numverts,
I);
414 iM.reserve(numverts);
415 idFdX.reserve(numverts);
416 idFdV.reserve(numverts);
417 iS.reserve(numverts);
443 lMatrixCtor idFdX, idFdV;
500 # ifdef USE_EIGEN_CORE
503 # ifdef USE_EIGEN_CONSTRAINED_CG
504 typedef ConstraintConjGrad solver_t;
513 cg.setMaxIterations(100);
514 cg.setTolerance(0.01f);
516 # ifdef USE_EIGEN_CONSTRAINED_CG
517 cg.filter() =
data->S;
525 # ifdef IMPLICIT_PRINT_SOLVER_INPUT_OUTPUT
526 printf(
"==== A ====\n");
528 printf(
"==== z ====\n");
530 printf(
"==== B ====\n");
532 printf(
"==== S ====\n");
536 # ifdef USE_EIGEN_CORE
539 # ifdef USE_EIGEN_CONSTRAINED_CG
543 # ifdef IMPLICIT_PRINT_SOLVER_INPUT_OUTPUT
544 printf(
"==== dV ====\n");
546 printf(
"========\n");
555 case Eigen::NoConvergence:
558 case Eigen::InvalidInput:
561 case Eigen::NumericalIssue:
566 result->iterations = cg.iterations();
567 result->error = cg.error();
569 return cg.info() == Eigen::Success;
591 data->iM.add(index, index, m);
596 # ifdef CLOTH_ROOT_FRAME
653 int numverts =
data->numverts;
654 for (
int i = 0; i < numverts; i++) {
655 data->iS.add(i, i,
I);
662 data->iS.sub(index, index,
I);
668 Implicit_Data *
data,
int index,
const float c1[3],
const float c2[3],
const float dV[3])
670 float m[3][3], p[3], q[3], u[3], cmat[3][3];
681 data->iS.sub(index, index, m);
693 float m[3][3], p[3], u[3], cmat[3][3];
699 data->iS.sub(index, index, m);
709 data->dFdX.setZero();
710 data->dFdV.setZero();
715 const float acceleration[3],
716 const float omega[3],
717 const float domega_dt[3],
720 # ifdef CLOTH_ROOT_FRAME
721 float acc[3],
w[3], dwdt[3];
722 float f[3], dfdx[3][3], dfdv[3][3];
723 float euler[3], coriolis[3], centrifugal[3], rotvel[3];
724 float deuler[3][3], dcoriolis[3][3], dcentrifugal[3][3], drotvel[3][3];
757 data->idFdX.add(index, index, dfdx);
758 data->idFdV.add(index, index, dfdv);
780 int numverts =
data->numverts;
781 for (
int i = 0; i < numverts; i++) {
789 data->idFdV.add(i, i, tmp);
794 struct Implicit_Data *
data,
int i,
const float f[3],
float dfdx[3][3],
float dfdv[3][3])
796 float tf[3], tdfdx[3][3], tdfdv[3][3];
802 data->idFdX.add(i, i, tdfdx);
803 data->idFdV.add(i, i, tdfdv);
825 const float effector_scale = 0.02f;
831 factor = effector_scale *
area / 3.0f;
845 const float effector_scale = 0.01;
899 return (-11.541f *
powf(
x, 4) + 34.193f *
powf(
x, 3) - 39.083f *
powf(
x, 2) + 23.116f *
x -
907 return (-46.164f *
powf(
x, 3) + 102.579f *
powf(
x, 2) - 78.166f *
x + 23.116f);
913 float fbstar_fl = cb * (
length -
L);
915 if (tempfb_fl < fbstar_fl) {
927 float fbstar_fl = cb * (
length -
L);
929 if (tempfb_fl < fbstar_fl) {
948 *r_length =
len_v3(r_extent);
953 if ((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) &&
954 (((
length -
L) * 100.0f /
L) > clmd->sim_parms->maxspringlen)) {
956 s->flags |= CSPRING_FLAG_DEACTIVATE;
971 Implicit_Data *
data,
int i,
int j,
const float f[3],
float dfdx[3][3],
float dfdv[3][3])
976 data->idFdX.add(i, i, dfdx);
977 data->idFdX.add(j, j, dfdx);
978 data->idFdX.sub(i, j, dfdx);
979 data->idFdX.sub(j, i, dfdx);
981 data->idFdV.add(i, i, dfdv);
982 data->idFdV.add(j, j, dfdv);
983 data->idFdV.sub(i, j, dfdv);
984 data->idFdV.sub(j, i, dfdv);
999 float extent[3],
length, dir[3], vel[3];
1004 if (
length > restlen || no_compress) {
1005 float stretch_force, f[3], dfdx[3][3], dfdv[3][3];
1007 stretch_force = stiffness * (
length - restlen);
1008 if (clamp_force > 0.0f && stretch_force > clamp_force) {
1009 stretch_force = clamp_force;
1060 float extent[3],
length, dir[3], vel[3];
1066 float f[3], dfdx[3][3], dfdv[3][3];
1112 Implicit_Data *
data,
int i,
int j,
float edge[3],
float dir[3],
float grad_dir[3][3])
1133 const float goal[3],
1141 float edge_ij[3], dir_ij[3];
1142 float edge_jk[3], dir_jk[3];
1143 float vel_ij[3], vel_jk[3], vel_ortho[3];
1144 float f_bend[3], f_damp[3];
1204 const float goal[3],
1210 const float delta = 0.00001f;
1211 float dvec_null[3][3], dvec_pos[3][3], dvec_neg[3][3];
1223 for (
a = 0;
a < 3;
a++) {
1224 spring_angbend_forces(
1225 data, i, j, k, goal, stiffness, damping, q, dvec_pos[
a], dvec_null[
a], f);
1228 spring_angbend_forces(
1229 data, i, j, k, goal, stiffness, damping, q, dvec_neg[
a], dvec_null[
a], f);
1232 for (
b = 0;
b < 3;
b++) {
1233 dfdx[
a][
b] /= delta;
1243 const float goal[3],
1249 const float delta = 0.00001f;
1250 float dvec_null[3][3], dvec_pos[3][3], dvec_neg[3][3];
1262 for (
a = 0;
a < 3;
a++) {
1263 spring_angbend_forces(
1264 data, i, j, k, goal, stiffness, damping, q, dvec_null[
a], dvec_pos[
a], f);
1267 spring_angbend_forces(
1268 data, i, j, k, goal, stiffness, damping, q, dvec_null[
a], dvec_neg[
a], f);
1271 for (
b = 0;
b < 3;
b++) {
1272 dfdv[
a][
b] /= delta;
1284 const float target[3],
1290 float dfj_dxi[3][3], dfj_dxj[3][3], dfk_dxi[3][3], dfk_dxj[3][3], dfk_dxk[3][3];
1291 float dfj_dvi[3][3], dfj_dvj[3][3], dfk_dvi[3][3], dfk_dvj[3][3], dfk_dvk[3][3];
1293 const float vecnull[3] = {0.0f, 0.0f, 0.0f};
1297 spring_angbend_forces(
data, i, j, k, goal, stiffness, damping, k, vecnull, vecnull, fk);
1300 spring_angbend_estimate_dfdx(
data, i, j, k, goal, stiffness, damping, i, dfk_dxi);
1301 spring_angbend_estimate_dfdx(
data, i, j, k, goal, stiffness, damping, j, dfk_dxj);
1302 spring_angbend_estimate_dfdx(
data, i, j, k, goal, stiffness, damping, k, dfk_dxk);
1308 spring_angbend_estimate_dfdv(
data, i, j, k, goal, stiffness, damping, i, dfk_dvi);
1309 spring_angbend_estimate_dfdv(
data, i, j, k, goal, stiffness, damping, j, dfk_dvj);
1310 spring_angbend_estimate_dfdv(
data, i, j, k, goal, stiffness, damping, k, dfk_dvk);
1321 data->idFdX.add(j, j, dfj_dxj);
1322 data->idFdX.add(k, k, dfk_dxk);
1324 data->idFdX.add(i, j, dfj_dxi);
1325 data->idFdX.add(j, i, dfj_dxi);
1326 data->idFdX.add(j, k, dfk_dxj);
1327 data->idFdX.add(k, j, dfk_dxj);
1328 data->idFdX.add(i, k, dfk_dxi);
1329 data->idFdX.add(k, i, dfk_dxi);
1331 data->idFdV.add(j, j, dfj_dvj);
1332 data->idFdV.add(k, k, dfk_dvk);
1334 data->idFdV.add(i, j, dfj_dvi);
1335 data->idFdV.add(j, i, dfj_dvi);
1336 data->idFdV.add(j, k, dfk_dvj);
1337 data->idFdV.add(k, j, dfk_dvj);
1338 data->idFdV.add(i, k, dfk_dvi);
1339 data->idFdV.add(k, i, dfk_dvi);
1346 float edge_ij[3], dir_ij[3], grad_dir_ij[3][3];
1347 float edge_jk[3], dir_jk[3], grad_dir_jk[3][3];
1348 float dist[3], vel_jk[3], vel_jk_ortho[3], projvel[3];
1351 float fi[3], fj[3], fk[3];
1352 float dfi_dxi[3][3], dfj_dxi[3][3], dfj_dxj[3][3], dfk_dxi[3][3], dfk_dxj[3][3], dfk_dxk[3][3];
1394 madd_m3_m3fl(dfk_dxi, grad_dir_ij, stiffness * restlen);
1396 madd_m3_m3fl(dfk_dxj, grad_dir_ij, -stiffness * restlen);
1433 const float goal_x[3],
1434 const float goal_v[3],
1441 float root_goal_x[3], root_goal_v[3], extent[3],
length, dir[3], vel[3];
1442 float f[3], dfdx[3][3], dfdv[3][3];
1463 data->idFdX.add(i, i, dfdx);
1464 data->idFdV.add(i, i, dfdv);
typedef float(TangentPoint)[2]
void sub_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
void negate_m3(float R[3][3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void unit_m3(float m[3][3])
void mul_m3_fl(float R[3][3], float f)
void add_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
void zero_m3(float m[3][3])
void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], float f)
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
void transpose_m3(float R[3][3])
void mul_transposed_m3_v3(const float M[3][3], float r[3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
int SIM_mass_spring_solver_numvert(struct Implicit_Data *id)
@ SIM_SOLVER_INVALID_INPUT
@ SIM_SOLVER_NUMERICAL_ISSUE
@ SIM_SOLVER_NO_CONVERGENCE
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
btGeneric6DofConstraint & operator=(btGeneric6DofConstraint &other)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
A conjugate gradient solver for sparse self-adjoint problems with additional constraints.
BLI_INLINE void madd_m3_m3fl(float r[3][3], const float m[3][3], float f)
SyclQueue void void size_t num_bytes void
Eigen::ConjugateGradient< lMatrix, Eigen::Lower, Eigen::DiagonalPreconditioner< Scalar > > ConjugateGradient
std::vector< Triplet > TripletList
BLI_INLINE void print_lmatrix(const lMatrix &m)
Eigen::SparseMatrix< Scalar > lMatrix
BLI_INLINE void print_lvector(const lVector3f &v)
Eigen::Triplet< Scalar > Triplet
void SIM_mass_spring_add_constraint_ndof1(struct Implicit_Data *data, int index, const float c1[3], const float c2[3], const float dV[3])
void SIM_mass_spring_get_motion_state(struct Implicit_Data *data, int index, float x[3], float v[3])
void SIM_mass_spring_add_constraint_ndof0(struct Implicit_Data *data, int index, const float dV[3])
void SIM_mass_spring_force_reference_frame(struct Implicit_Data *data, int index, const float acceleration[3], const float omega[3], const float domega_dt[3], float mass)
void SIM_mass_spring_force_edge_wind(struct Implicit_Data *data, int v1, int v2, float radius1, float radius2, const float(*winvec)[3])
void SIM_mass_spring_set_new_velocity(struct Implicit_Data *data, int index, const float v[3])
bool SIM_mass_spring_force_spring_goal(struct Implicit_Data *data, int i, const float goal_x[3], const float goal_v[3], float stiffness, float damping)
void SIM_mass_spring_set_vertex_mass(struct Implicit_Data *data, int index, float mass)
void SIM_mass_spring_set_motion_state(struct Implicit_Data *data, int index, const float x[3], const float v[3])
bool SIM_mass_spring_force_spring_linear(struct Implicit_Data *data, int i, int j, float restlen, float stiffness_tension, float damping_tension, float stiffness_compression, float damping_compression, bool resist_compress, bool new_compress, float clamp_force)
bool SIM_mass_spring_force_spring_bending(struct Implicit_Data *data, int i, int j, float restlen, float kb, float cb)
void SIM_mass_spring_apply_result(struct Implicit_Data *data)
void SIM_mass_spring_set_position(struct Implicit_Data *data, int index, const float x[3])
void SIM_mass_spring_add_constraint_ndof2(struct Implicit_Data *data, int index, const float c1[3], const float dV[3])
BLI_INLINE void implicit_print_matrix_elem(float v)
void SIM_mass_spring_force_face_wind(struct Implicit_Data *data, int v1, int v2, int v3, const float(*winvec)[3])
void SIM_mass_spring_get_position(struct Implicit_Data *data, int index, float x[3])
bool SIM_mass_spring_solve_velocities(struct Implicit_Data *data, float dt, struct ImplicitSolverResult *result)
void SIM_mass_spring_force_drag(struct Implicit_Data *data, float drag)
void SIM_mass_spring_clear_constraints(struct Implicit_Data *data)
bool SIM_mass_spring_solve_positions(struct Implicit_Data *data, float dt)
void SIM_mass_spring_get_new_velocity(struct Implicit_Data *data, int index, float v[3])
void SIM_mass_spring_set_velocity(struct Implicit_Data *data, int index, const float v[3])
void SIM_mass_spring_force_extern(struct Implicit_Data *data, int i, const float f[3], float dfdx[3][3], float dfdv[3][3])
void SIM_mass_spring_force_gravity(struct Implicit_Data *data, int index, float mass, const float g[3])
void SIM_mass_spring_set_rest_transform(struct Implicit_Data *data, int index, float tfm[3][3])
void SIM_mass_spring_clear_forces(struct Implicit_Data *data)
BLI_INLINE void apply_spring(Implicit_Data *data, int i, int j, const float f[3], const float dfdx[3][3], const float dfdv[3][3])
BLI_INLINE float fbstar_jacobi(float length, float L, float kb, float cb)
DO_INLINE void mul_fvectorT_fvector(float to[3][3], const float vectorA[3], const float vectorB[3])
BLI_INLINE void cross_m3_v3m3(float r[3][3], const float v[3], const float m[3][3])
BLI_INLINE float fb(float length, float L)
DO_INLINE void mul_fmatrix_S(float matrix[3][3], float scalar)
Implicit_Data * SIM_mass_spring_solver_create(int numverts, int numsprings)
BLI_INLINE float fbderiv(float length, float L)
BLI_INLINE bool spring_length(Implicit_Data *data, int i, int j, float r_extent[3], float r_dir[3], float *r_length, float r_vel[3])
BLI_INLINE void root_to_world_m3(Implicit_Data *data, int index, float r[3][3], const float m[3][3])
void SIM_mass_spring_solver_free(Implicit_Data *id)
BLI_INLINE void cross_v3_identity(float r[3][3], const float v[3])
BLI_INLINE void outerproduct(float r[3][3], const float a[3], const float b[3])
DO_INLINE void sub_fmatrix_fmatrix(float to[3][3], const float matrixA[3][3], const float matrixB[3][3])
struct Implicit_Data Implicit_Data
BLI_INLINE void dfdx_spring(float to[3][3], const float dir[3], float length, float L, float k)
BLI_INLINE void spring_grad_dir(Implicit_Data *data, int i, int j, float edge[3], float dir[3], float grad_dir[3][3])
static float calc_nor_area_tri(float nor[3], const float v1[3], const float v2[3], const float v3[3])
BLI_INLINE void root_to_world_v3(Implicit_Data *data, int index, float r[3], const float v[3])
BLI_INLINE void world_to_root_m3(Implicit_Data *data, int index, float r[3][3], const float m[3][3])
BLI_INLINE float fbstar(float length, float L, float kb, float cb)
BLI_INLINE void world_to_root_v3(Implicit_Data *data, int index, float r[3], const float v[3])
BLI_INLINE void dfdv_damp(float to[3][3], const float dir[3], float damping)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool reset
clear internal cached data and reset random seed
bool add(void *owner, const AttributeIDRef &attribute_id, eAttrDomain domain, eCustomDataType data_type, const AttributeInit &initializer)
static void area(int d1, int d2, int e1, int e2, float weights[2])
T length(const vec_base< T, Size > &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)