# solver

package
v0.2.0 Latest Latest

Go to latest
Published: Aug 19, 2021 License: BSD-2-Clause

## Documentation ¶

### Overview ¶

Package physics implements a basic physics engine.

Package physics implements a basic physics engine.

### Constants ¶

This section is empty.

### Variables ¶

This section is empty.

### Functions ¶

This section is empty.

### Types ¶

#### type GaussSeidel ¶

type GaussSeidel struct {
// contains filtered or unexported fields
}

GaussSeidel equation solver. See https://en.wikipedia.org/wiki/Gauss-Seidel_method. The number of solver iterations determines the quality of the solution. More iterations yield a better solution but require more computation.

#### func NewGaussSeidel ¶

func NewGaussSeidel() *GaussSeidel

NewGaussSeidel creates and returns a pointer to a new GaussSeidel constraint equation solver.

#### func (*GaussSeidel) Reset ¶

func (gs *GaussSeidel) Reset(numBodies int)

#### func (*GaussSeidel) Solve ¶

func (gs *GaussSeidel) Solve(dt float32, nBodies int) *Solution

Solve

#### type ISolver ¶

type ISolver interface {
Solve(dt float32, nBodies int) *Solution // Solve should return the number of iterations performed
RemoveEquation(eq equation.IEquation) bool
ClearEquations()
}

ISolver is the interface type for all constraint solvers.

#### type Solution ¶

type Solution struct {
VelocityDeltas        []math32.Vector3
AngularVelocityDeltas []math32.Vector3
Iterations            int
}

Solution represents a solver solution

#### type Solver ¶

type Solver struct {
// contains filtered or unexported fields
}

Constraint equation solver base class.

#### func (*Solver) ClearEquations ¶

func (s *Solver) ClearEquations()

ClearEquations removes all equations from the solver.

#### func (*Solver) RemoveEquation ¶

func (s *Solver) RemoveEquation(eq equation.IEquation) bool

RemoveEquation removes the specified equation from the solver. Returns true if found, false otherwise.