engine: github.com/g3n/engine/experimental/physics/solver Index | Files

package solver

import "github.com/g3n/engine/experimental/physics/solver"

Package physics implements a basic physics engine.

Package physics implements a basic physics engine.

Index

Package Files

gs.go solver.go

type GaussSeidel Uses

type GaussSeidel struct {
    Solver
    // 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 Uses

func NewGaussSeidel() *GaussSeidel

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

func (*GaussSeidel) Reset Uses

func (gs *GaussSeidel) Reset(numBodies int)

func (*GaussSeidel) Solve Uses

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

Solve

type ISolver Uses

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

ISolver is the interface type for all constraint solvers.

type Solution Uses

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

Solution represents a solver solution

type Solver Uses

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

Constraint equation solver base class.

func (*Solver) AddEquation Uses

func (s *Solver) AddEquation(eq equation.IEquation)

AddEquation adds an equation to the solver.

func (*Solver) ClearEquations Uses

func (s *Solver) ClearEquations()

ClearEquations removes all equations from the solver.

func (*Solver) RemoveEquation Uses

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

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

Package solver imports 2 packages (graph) and is imported by 1 packages. Updated 2018-07-24. Refresh now. Tools for package owners.