newton.solvers.Style3DSolver#

class newton.solvers.Style3DSolver(model, iterations=10, drag_spring_stiff=1e2, enable_mouse_dragging=False, integrate_with_external_rigid_solver=False, friction_epsilon=1e-2)[source]#

Bases: SolverBase

Projective dynamic based cloth simulator.

Ref[1]. Large Steps in Cloth Simulation, Baraff & Witkin. Ref[2]. Fast Simulation of Mass-Spring Systems, Tiantian Liu etc.

Implicit-Euler method solves the following non-linear equation:

(M / dt^2 + H(x)) * dx = (M / dt^2) * (x_prev + v_prev * dt - x) + f_ext(x) + f_int(x)
                       = (M / dt^2) * (x_prev + v_prev * dt + (dt^2 / M) * f_ext(x) - x) + f_int(x)
                       = (M / dt^2) * (x_inertia - x) + f_int(x)
Notations:

M: mass matrix x: unsolved particle position H: hessian matrix (function of x) P: PD-approximated hessian matrix (constant) A: M / dt^2 + H(x) or M / dt^2 + P rhs: Right hand side of the equation: (M / dt^2) * (inertia_x - x) + f_int(x) res: Residual: rhs - A * dx_init, or rhs if dx_init == 0

__init__(model, iterations=10, drag_spring_stiff=1e2, enable_mouse_dragging=False, integrate_with_external_rigid_solver=False, friction_epsilon=1e-2)#
Parameters:
  • model (Style3DModel) – The Style3DModel to integrate.

  • iterations – Number of non-linear iterations per step.

  • drag_spring_stiff (float) – The stiffness of spring connecting barycentric-weighted drag-point and target-point.

  • enable_mouse_dragging (bool) – Enable/disable dragging kernel.

step(state_in, state_out, control, contacts, dt)#
update_drag_info(index, pos, bary_coord)#

Should be invoked when state changed.