Skip to content

Instantly share code, notes, and snippets.

View FantasyVR's full-sized avatar
🎯
Focusing

pengyu FantasyVR

🎯
Focusing
  • Taichi Graphics
  • Beijing
View GitHub Profile
@FantasyVR
FantasyVR / gist:e5e24706531c885c287236629ad4850a
Created May 27, 2021 09:26 — forked from erwincoumans/gist:6666160
Example how to create the A matrix and b vector and solve the LCP using Projected Gauss Seidel for Bullet 2.x. Requires Eigen lib and Bullet 2.82.Note that one of the differences between plain projected Gauss Seidel and the Bullet iterative solver is that the friction limits are computed at each iterations, from the related normal force. (This d…
//#include "Eigen/Dense"
#include "Eigen/Sparse"
static Eigen::VectorXf Solve_GaussSeidel (Eigen::MatrixXf & A, Eigen::VectorXf & b, Eigen::VectorXf & lo,Eigen::VectorXf & hi,int kMax = 5)
{
//A is a m-n matrix, m rows, n columns
if (A.rows() != b.rows())
return b;
int i, j, n = A.rows();