solver

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chandelier

type Chandelier struct {
	*physics.SBJacobianConstraintSolver
	// contains filtered or unexported fields
}

Chandelier represents the solution for a constraint that keeps a body hanging off of a fixture location similar to a chandelier.

func NewChandelier

func NewChandelier() *Chandelier

NewChandelier creates a new Chandelier constraint solver.

func (*Chandelier) BodyAnchor

func (c *Chandelier) BodyAnchor() sprec.Vec3

BodyAnchor returns the offset from the center of mass of the body that it is wired to the chandelier.

func (*Chandelier) Fixture

func (c *Chandelier) Fixture() sprec.Vec3

Fixture returns the fixture location for the chandelier hook.

func (*Chandelier) Length

func (c *Chandelier) Length() float32

Length returns the chandelier length.

func (*Chandelier) SetBodyAnchor

func (c *Chandelier) SetBodyAnchor(anchor sprec.Vec3) *Chandelier

SetBodyAnchor changes the offset at which the body is attached to the chandelier wiring.

func (*Chandelier) SetFixture

func (c *Chandelier) SetFixture(fixture sprec.Vec3) *Chandelier

SetFixture changes the fixture location for the chandelier hook.

func (*Chandelier) SetLength

func (c *Chandelier) SetLength(length float32) *Chandelier

SetLength changes the chandelier length.

type Coilover

type Coilover struct {
	physics.NilDBConstraintSolver

	PrimaryAnchor sprec.Vec3
	FrequencyHz   float32
	DampingRatio  float32
	// contains filtered or unexported fields
}

func (*Coilover) CalculateImpulses

func (c *Coilover) CalculateImpulses(ctx physics.DBSolverContext) physics.DBImpulseSolution

func (*Coilover) Reset

func (c *Coilover) Reset(physics.DBSolverContext)

type FixedTranslation

type FixedTranslation struct {
	*physics.SBJacobianConstraintSolver
	// contains filtered or unexported fields
}

FixedTranslation represents the solution for a constraint that keeps a body positioned at the specified fixture location.

func NewFixedTranslation

func NewFixedTranslation() *FixedTranslation

NewFixedTranslation creates a new FixedTranslation constraint solver.

func (*FixedTranslation) Fixture

func (t *FixedTranslation) Fixture() sprec.Vec3

Fixture returns the location that the body will be tied to.

func (*FixedTranslation) SetFixture

func (t *FixedTranslation) SetFixture(fixture sprec.Vec3) *FixedTranslation

SetFixture changes the location to which the body will be constrained.

type HingedRod

type HingedRod struct {
	*physics.DBJacobianConstraintSolver
	// contains filtered or unexported fields
}

HingedRod represents the solution for a constraint that keeps two bodies tied together with a hard link of specific length.

func NewHingedRod

func NewHingedRod() *HingedRod

NewHingedRod creates a new HingedRod constraint solution.

func (*HingedRod) Length

func (r *HingedRod) Length() float32

Length returns the link length.

func (*HingedRod) PrimaryAnchor

func (r *HingedRod) PrimaryAnchor() sprec.Vec3

PrimaryAnchor returns the attachment point of the link on the primary body.

func (*HingedRod) SecondaryAnchor

func (r *HingedRod) SecondaryAnchor() sprec.Vec3

SecondaryAnchor returns the attachment point of the link on the secondary body.

func (*HingedRod) SetLength

func (r *HingedRod) SetLength(length float32) *HingedRod

SetLength changes the link length.

func (*HingedRod) SetPrimaryAnchor

func (r *HingedRod) SetPrimaryAnchor(anchor sprec.Vec3) *HingedRod

SetPrimaryAnchor changes the attachment point of the link on the primary body.

func (*HingedRod) SetSecondaryAnchor

func (r *HingedRod) SetSecondaryAnchor(anchor sprec.Vec3) *HingedRod

SetSecondaryAnchor changes the attachment point of the link on the secondary body.

type LimitTranslation

type LimitTranslation struct {
	physics.NilDBConstraintSolver

	MinY float32
	MaxY float32
}

func (*LimitTranslation) CalculateImpulses

type MatchAxis

type MatchAxis struct {
	*physics.DBJacobianConstraintSolver
	// contains filtered or unexported fields
}

MatchAxis represents the solution for a constraint that keeps the axis of two bodies pointing in the same direction.

func NewMatchAxis

func NewMatchAxis() *MatchAxis

NewMatchAxis creates a new MatchAxis constraint solver.

func (*MatchAxis) PrimaryAxis

func (a *MatchAxis) PrimaryAxis() sprec.Vec3

PrimaryAxis returns the axis of the primary body that will be used in the alignment.

func (*MatchAxis) SecondaryAxis

func (a *MatchAxis) SecondaryAxis() sprec.Vec3

SecondaryAxis returns the axis of the secondary body that will be used in the alignment.

func (*MatchAxis) SetPrimaryAxis

func (a *MatchAxis) SetPrimaryAxis(axis sprec.Vec3) *MatchAxis

SetPrimaryAxis changes the axis of the primary body to be used in alignments.

func (*MatchAxis) SetSecondaryAxis

func (a *MatchAxis) SetSecondaryAxis(axis sprec.Vec3) *MatchAxis

SetSecondaryAxis changes the axis of the secondary body to be used in alignments.

type MatchRotation

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

NewMatchRotation represents the solution for a constraint that keeps two bodies oriented in the same direction on all axis.

func NewMatchRotation

func NewMatchRotation() *MatchRotation

NewMatchRotation creates a new MatchRotation constraint solver.

func (*MatchRotation) CalculateImpulses

func (*MatchRotation) CalculateNudges

func (*MatchRotation) Reset

func (r *MatchRotation) Reset(ctx physics.DBSolverContext)

type MatchTranslation

type MatchTranslation struct {
	*physics.DBJacobianConstraintSolver
	// contains filtered or unexported fields
}

MatchTranslation represents the solution for a constraint that keeps a secondary body attached to an offset of the primary body. It is possible to disable the constraint for certain axis of the primary body.

func NewMatchTranslation

func NewMatchTranslation() *MatchTranslation

NewMatchTranslation creates a new MatchTranslation constraint solver.

func (*MatchTranslation) IgnoreX

func (t *MatchTranslation) IgnoreX() bool

IgnoreX returns whether the X dimension, relative to the primary body, will be matched.

func (*MatchTranslation) IgnoreY

func (t *MatchTranslation) IgnoreY() bool

IgnoreY returns whether the Y dimension, relative to the primary body, will be matched.

func (*MatchTranslation) IgnoreZ

func (t *MatchTranslation) IgnoreZ() bool

IgnoreZ returns whether the Z dimension, relative to the primary body, will be matched.

func (*MatchTranslation) PrimaryAnchor

func (t *MatchTranslation) PrimaryAnchor() sprec.Vec3

PrimaryAnchor returns the attachment point on the primary body to which the secondary will match.

func (*MatchTranslation) SetIgnoreX

func (t *MatchTranslation) SetIgnoreX(ignore bool) *MatchTranslation

SetIgnoreX changes whether the X dimension, relative to the primary body, will be considered.

func (*MatchTranslation) SetIgnoreY

func (t *MatchTranslation) SetIgnoreY(ignore bool) *MatchTranslation

SetIgnoreY changes whether the Y dimension, relative to the primary body, will be considered.

func (*MatchTranslation) SetIgnoreZ

func (t *MatchTranslation) SetIgnoreZ(ignore bool) *MatchTranslation

SetIgnoreZ changes whether the Z dimension, relative to the primary body, will be considered.

func (*MatchTranslation) SetPrimaryAnchor

func (t *MatchTranslation) SetPrimaryAnchor(anchor sprec.Vec3) *MatchTranslation

SetPrimaryAnchor changes the attachment point on the primary body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL