Documentation
¶
Overview ¶
Package physics implements a basic physics engine.
Package physics implements a basic physics engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GaussSeidel ¶
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 ¶
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)
type ISolver ¶
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 ¶
type Solution struct {
VelocityDeltas []math32.Vector3
AngularVelocityDeltas []math32.Vector3
Iterations int
}
Solution represents a solver solution
type Solver ¶
type Solver struct {
Solution
// contains filtered or unexported fields
}
Constraint equation solver base class.
func (*Solver) AddEquation ¶
AddEquation adds an equation to the solver.
func (*Solver) ClearEquations ¶
func (s *Solver) ClearEquations()
ClearEquations removes all equations from the solver.