Class XPBD
Defined in File XPBD.h
Class Documentation
-
class XPBD
Public Static Functions
-
static bool solve_DistanceConstraint(const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, const Real restLength, const Real stiffness, const Real dt, Real &lambda, Vector3r &corr0, Vector3r &corr1)
Determine the position corrections for a distance constraint between two particles using XPBD:\(C(\mathbf{p}_0, \mathbf{p}_1) = \| \mathbf{p}_0 - \mathbf{p}_1\| - l_0 = 0\) More information can be found in the following papers: [12], [2], [5], [6], [10]
- Parameters
p0 – position of first particle
invMass0 – inverse mass of first particle
p1 – position of second particle
invMass1 – inverse mass of second particle
restLength – rest length of distance constraint
stiffness – stiffness coefficient
dt – Time step size
lambda – Lagrange multiplier (XPBD)
corr0 – position correction of first particle
corr1 – position correction of second particle
-
static bool solve_VolumeConstraint(const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, const Vector3r &p2, Real invMass2, const Vector3r &p3, Real invMass3, const Real restVolume, const Real stiffness, const Real dt, Real &lambda, Vector3r &corr0, Vector3r &corr1, Vector3r &corr2, Vector3r &corr3)
Determine the position corrections for a constraint that conserves the volume of single tetrahedron. Such a constraint has the form
\[\begin{equation*} C(\mathbf{p}_1, \mathbf{p}_2, \mathbf{p}_3, \mathbf{p}_4) = \frac{1}{6} \left(\mathbf{p}_{2,1} \times \mathbf{p}_{3,1}\right) \cdot \mathbf{p}_{4,1} - V_0, \end{equation*}\]where \(\mathbf{p}_1\), \(\mathbf{p}_2\), \(\mathbf{p}_3\) and \(\mathbf{p}_4\) are the four corners of the tetrahedron and \(V_0\)is its rest volume.
More information can be found in the following papers:
[12], [2], [5], [6],- Parameters
p0 – position of first particle
invMass0 – inverse mass of first particle
p1 – position of second particle
invMass1 – inverse mass of second particle
p2 – position of third particle
invMass2 – inverse mass of third particle
p3 – position of fourth particle
invMass3 – inverse mass of fourth particle
restVolume – rest angle \(V_0\)
stiffness – stiffness coefficient
dt – Time step size
lambda – Lagrange multiplier (XPBD)
corr0 – position correction of first particle
corr1 – position correction of second particle
corr2 – position correction of third particle
corr3 – position correction of fourth particle
-
static bool init_IsometricBendingConstraint(const Vector3r &p0, const Vector3r &p1, const Vector3r &p2, const Vector3r &p3, Matrix4r &Q)
Initialize the local stiffness matrix Q. The matrix is required by the solver step. It must only be recomputed if the rest shape changes.
Bending is simulated for the angle on (p2, p3) between the triangles (p0, p2, p3) and (p1, p3, p2).
- Parameters
p0 – point 0 of stencil
p1 – point 1 of stencil
p2 – point 2 of stencil
p3 – point 3 of stencil
Q – returns the local stiffness matrix which is required by the solver
-
static bool solve_IsometricBendingConstraint(const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, const Vector3r &p2, Real invMass2, const Vector3r &p3, Real invMass3, const Matrix4r &Q, const Real stiffness, const Real dt, Real &lambda, Vector3r &corr0, Vector3r &corr1, Vector3r &corr2, Vector3r &corr3)
Determine the position corrections for the isometric bending constraint using XPBD
. This constraint can be used for almost inextensible surface models.
More information can be found in:
[6], [4]- Parameters
p0 – position of first particle
invMass0 – inverse mass of first particle
p1 – position of second particle
invMass1 – inverse mass of second particle
p2 – position of third particle
invMass2 – inverse mass of third particle
p3 – position of fourth particle
invMass3 – inverse mass of fourth particle
Q – local stiffness matrix which must be initialized by calling init_IsometricBendingConstraint()
stiffness – stiffness coefficient for bending
dt – Time step size
lambda – Lagrange multiplier (XPBD)
corr0 – position correction of first particle
corr1 – position correction of second particle
corr2 – position correction of third particle
corr3 – position correction of fourth particle
-
static bool solve_FEMTetraConstraint(const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, const Vector3r &p2, Real invMass2, const Vector3r &p3, Real invMass3, const Real restVolume, const Matrix3r &invRestMat, const Real youngsModulus, const Real poissonRatio, const bool handleInversion, const Real dt, Real &lambda, Vector3r &corr0, Vector3r &corr1, Vector3r &corr2, Vector3r &corr3)
implementation of the finite element method described in
Jan Bender, Dan Koschier, Patrick Charrier and Daniel Weber,
”Position-Based Simulation of Continuous Materials”,
Computers & Graphics 44, 2014
Solve the continuum mechanical constraint defined for a tetrahedron.
-
static bool solve_DistanceConstraint(const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, const Real restLength, const Real stiffness, const Real dt, Real &lambda, Vector3r &corr0, Vector3r &corr1)