diff options
author | over0219 <over0219@umn.edu> | 2020-06-03 07:26:39 +0300 |
---|---|---|
committer | over0219 <over0219@umn.edu> | 2020-06-03 07:26:39 +0300 |
commit | 9ceb298156044e616bcea97b3c82f1c416ec4385 (patch) | |
tree | 3fdbfc815f87334f3e545201566aaf325582db2f /extern/softbody/src/admmpd_collision.cpp | |
parent | 9ba5c8b90aa6245c569f7e66b0cd472beb59b5a5 (diff) |
still pretty buggy. The solver should be working, but lattice is too lousy to see. The interface between blender and solver needs work too, doesn't seem to reset as often as I think it should be?
Diffstat (limited to 'extern/softbody/src/admmpd_collision.cpp')
-rw-r--r-- | extern/softbody/src/admmpd_collision.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/extern/softbody/src/admmpd_collision.cpp b/extern/softbody/src/admmpd_collision.cpp new file mode 100644 index 00000000000..2bce56fa9f0 --- /dev/null +++ b/extern/softbody/src/admmpd_collision.cpp @@ -0,0 +1,33 @@ + + +#include "admmpd_collision.h" + +namespace admmpd { + +void FloorCollider::detect(const Eigen::MatrixXd *x) +{ + (void)(x); + // Can just do detection in jacobian I guess. +} + +void FloorCollider::jacobian( + const Eigen::MatrixXd *x, + std::vector<Eigen::Triplet<double> > *trips_x, + std::vector<Eigen::Triplet<double> > *trips_y, + std::vector<Eigen::Triplet<double> > *trips_z, + std::vector<double> *l) +{ + int nx = x->rows(); + for (int i=0; i<nx; ++i) + { + Eigen::Vector3d p = x->row(i); + if (p[2]>0) + continue; + + int c_idx = l->size(); + trips_z->emplace_back(c_idx,i,1.0); + l->emplace_back(0); + } +} // end floor collider Jacobian + +} // namespace admmpd
\ No newline at end of file |