NewtonSetSolverIterations

From Newton Wiki
Jump to: navigation, search

NewtonSetSolverIterations

void NewtonSetSolverIterations (const NewtonWorld* const newtonWorld, int model)

Usage

This function allows the application to configure the Newton solver to work in one of two different modes.

Parameters

const NewtonWorld *newtonWorld :Pointer to the Newton world for which we wish to set the solver model. int model : Solver model value (see below).

Return

  • (Procedure)

Remarks

This function allows you to set the accuracy of Newton physics solver. The solver model value can be one of the following:

  • 0 is the exact solver (default). This is a one pass solver that calculates regular and frictional forces at the same time. Use this model if you require a high degree of accuracy in your simulation.
  • n ( > 0 ) is the linear solver. This is a complete iterative solver which peform n iterations per update. Increasing the number of iterations will improve accuracy at the cost of solver speed. Use this model if you require speed over accuracy in your simulation.

The adaptive friction model combined with the linear solver model make for the fastest possible configuration of the Newton solver. This setup is best for games. If you need the best realistic behavior, we recommend the use of the exact solver and exact friction model which are the defaults.

Also note that the exact solver model may be faster than the linear solver in certain special cases, for example, a perfectly aligned stack of boxes. However, The exact solver can become vastly slower when an element of randomness is introduced, such as when the stack of boxes start toppling. For a more complete explanation see this forum post.

  • n: the solve will execute a maximum of n iteration per cluster of connected joints and will terminate regardless of the joint residual acceleration.
  • If it happen that the joints residual acceleration fall below the minimum tolerance 1.0e-5 then the solve will terminate before the number of iteration reach N.

See also

NewtonSetFrictionModel