Documentation ¶
Index ¶
- func NewMatchRotation() solver.PairConstraint
- type Chandelier
- func (s *Chandelier) ApplyImpulses(ctx solver.Context)
- func (s *Chandelier) ApplyNudges(ctx solver.Context)
- func (s *Chandelier) Fixture() dprec.Vec3
- func (s *Chandelier) Length() float64
- func (s *Chandelier) Radius() dprec.Vec3
- func (s *Chandelier) Reset(ctx solver.Context)
- func (s *Chandelier) SetFixture(fixture dprec.Vec3) *Chandelier
- func (s *Chandelier) SetLength(length float64) *Chandelier
- func (s *Chandelier) SetRadius(radius dprec.Vec3) *Chandelier
- type ClampDirectionOffset
- func (s *ClampDirectionOffset) ApplyImpulses(ctx solver.PairContext)
- func (s *ClampDirectionOffset) ApplyNudges(ctx solver.PairContext)
- func (s *ClampDirectionOffset) Direction() dprec.Vec3
- func (s *ClampDirectionOffset) Max() float64
- func (s *ClampDirectionOffset) Min() float64
- func (s *ClampDirectionOffset) Reset(ctx solver.PairContext)
- func (s *ClampDirectionOffset) Restitution() float64
- func (s *ClampDirectionOffset) SetDirection(direction dprec.Vec3) *ClampDirectionOffset
- func (s *ClampDirectionOffset) SetMax(max float64) *ClampDirectionOffset
- func (s *ClampDirectionOffset) SetMin(min float64) *ClampDirectionOffset
- func (s *ClampDirectionOffset) SetRestitution(restitution float64) *ClampDirectionOffset
- type Coilover
- func (s *Coilover) ApplyImpulses(ctx solver.PairContext)
- func (s *Coilover) ApplyNudges(ctx solver.PairContext)
- func (s *Coilover) Damping() float64
- func (s *Coilover) Frequency() float64
- func (s *Coilover) PrimaryRadius() dprec.Vec3
- func (s *Coilover) Reset(ctx solver.PairContext)
- func (s *Coilover) SecondaryRadius() dprec.Vec3
- func (s *Coilover) SetDamping(damping float64) *Coilover
- func (s *Coilover) SetFrequency(frequency float64) *Coilover
- func (s *Coilover) SetPrimaryRadius(radius dprec.Vec3) *Coilover
- func (s *Coilover) SetSecondaryRadius(radius dprec.Vec3) *Coilover
- type Collision
- type CollisionState
- type Combined
- type CopyDirection
- func (s *CopyDirection) ApplyImpulses(ctx solver.PairContext)
- func (s *CopyDirection) ApplyNudges(ctx solver.PairContext)
- func (s *CopyDirection) PrimaryDirection() dprec.Vec3
- func (s *CopyDirection) Reset(ctx solver.PairContext)
- func (s *CopyDirection) SecondaryDirection() dprec.Vec3
- func (s *CopyDirection) SetPrimaryDirection(direction dprec.Vec3) *CopyDirection
- func (s *CopyDirection) SetSecondaryDirection(direction dprec.Vec3) *CopyDirection
- type CopyPosition
- type CopyRotation
- type Differential
- type HingedRod
- func (s *HingedRod) ApplyImpulses(ctx solver.PairContext)
- func (s *HingedRod) ApplyNudges(ctx solver.PairContext)
- func (s *HingedRod) Length() float64
- func (s *HingedRod) PrimaryRadius() dprec.Vec3
- func (s *HingedRod) Reset(ctx solver.PairContext)
- func (s *HingedRod) SecondaryRadius() dprec.Vec3
- func (s *HingedRod) SetLength(length float64) *HingedRod
- func (s *HingedRod) SetPrimaryRadius(radius dprec.Vec3) *HingedRod
- func (s *HingedRod) SetSecondaryRadius(radius dprec.Vec3) *HingedRod
- type MatchDirectionOffset
- func (s *MatchDirectionOffset) ApplyImpulses(ctx solver.PairContext)
- func (s *MatchDirectionOffset) ApplyNudges(ctx solver.PairContext)
- func (s *MatchDirectionOffset) Direction() dprec.Vec3
- func (s *MatchDirectionOffset) Offset() float64
- func (s *MatchDirectionOffset) PrimaryRadius() dprec.Vec3
- func (s *MatchDirectionOffset) Reset(ctx solver.PairContext)
- func (s *MatchDirectionOffset) SecondaryRadius() dprec.Vec3
- func (s *MatchDirectionOffset) SetDirection(direction dprec.Vec3) *MatchDirectionOffset
- func (s *MatchDirectionOffset) SetOffset(offset float64) *MatchDirectionOffset
- func (s *MatchDirectionOffset) SetPrimaryRadius(radius dprec.Vec3) *MatchDirectionOffset
- func (s *MatchDirectionOffset) SetSecondaryRadius(radius dprec.Vec3) *MatchDirectionOffset
- type MatchDirections
- func (s *MatchDirections) ApplyImpulses(ctx solver.PairContext)
- func (s *MatchDirections) ApplyNudges(ctx solver.PairContext)
- func (s *MatchDirections) PrimaryDirection() dprec.Vec3
- func (s *MatchDirections) Reset(ctx solver.PairContext)
- func (s *MatchDirections) SecondaryDirection() dprec.Vec3
- func (s *MatchDirections) SetPrimaryDirection(direction dprec.Vec3) *MatchDirections
- func (s *MatchDirections) SetSecondaryDirection(direction dprec.Vec3) *MatchDirections
- type PairCollision
- type PairCollisionState
- type PairCombined
- type StaticPosition
- type StaticRotation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMatchRotation ¶
func NewMatchRotation() solver.PairConstraint
NewMatchRotation creates a new constraint solver that keeps two bodies oriented in the same direction on all axis.
Types ¶
type Chandelier ¶
type Chandelier struct {
// 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) ApplyImpulses ¶
func (s *Chandelier) ApplyImpulses(ctx solver.Context)
ApplyImpulses applies impulses in order to keep the velocity part of the constraint satisfied.
func (*Chandelier) ApplyNudges ¶
func (s *Chandelier) ApplyNudges(ctx solver.Context)
ApplyNudges applies nudges in order to keep the positional part of the constraint satisfied.
func (*Chandelier) Fixture ¶
func (s *Chandelier) Fixture() dprec.Vec3
Fixture returns the fixture location for the chandelier hook.
func (*Chandelier) Length ¶
func (s *Chandelier) Length() float64
Length returns the chandelier length.
func (*Chandelier) Radius ¶
func (s *Chandelier) Radius() dprec.Vec3
Radius returns the radius vector of the contact point on the object.
The vector is in the object's local space.
func (*Chandelier) Reset ¶
func (s *Chandelier) Reset(ctx solver.Context)
Reset re-evaluates the constraint.
func (*Chandelier) SetFixture ¶
func (s *Chandelier) SetFixture(fixture dprec.Vec3) *Chandelier
SetFixture changes the fixture location for the chandelier hook.
func (*Chandelier) SetLength ¶
func (s *Chandelier) SetLength(length float64) *Chandelier
SetLength changes the chandelier length.
func (*Chandelier) SetRadius ¶
func (s *Chandelier) SetRadius(radius dprec.Vec3) *Chandelier
SetRadius changes the radius vector of the contact point on the object.
The vector is in the object's local space.
type ClampDirectionOffset ¶
type ClampDirectionOffset struct {
// contains filtered or unexported fields
}
ClampDirectionOffset represents the solution for a constraint which ensures that the second body is within certain min and max bounds relative to the first body along a certain direction of the first body.
func NewClampDirectionOffset ¶
func NewClampDirectionOffset() *ClampDirectionOffset
NewClampDirectionOffset creates a new ClampDirectionOffset constraint solver.
func (*ClampDirectionOffset) ApplyImpulses ¶
func (s *ClampDirectionOffset) ApplyImpulses(ctx solver.PairContext)
func (*ClampDirectionOffset) ApplyNudges ¶
func (s *ClampDirectionOffset) ApplyNudges(ctx solver.PairContext)
func (*ClampDirectionOffset) Direction ¶
func (s *ClampDirectionOffset) Direction() dprec.Vec3
Direction returns the constraint direction, which is in local space of the first body.
func (*ClampDirectionOffset) Max ¶
func (s *ClampDirectionOffset) Max() float64
Max returns the upper bounds limit.
func (*ClampDirectionOffset) Min ¶
func (s *ClampDirectionOffset) Min() float64
Min returns the lower bounds limit.
func (*ClampDirectionOffset) Reset ¶
func (s *ClampDirectionOffset) Reset(ctx solver.PairContext)
func (*ClampDirectionOffset) Restitution ¶
func (s *ClampDirectionOffset) Restitution() float64
Restitution returns the restitution to be used when adjusting the two bodies when the constraint is not met.
func (*ClampDirectionOffset) SetDirection ¶
func (s *ClampDirectionOffset) SetDirection(direction dprec.Vec3) *ClampDirectionOffset
SetDirection changes the constraint direction, which must be in local space of the first body.
func (*ClampDirectionOffset) SetMax ¶
func (s *ClampDirectionOffset) SetMax(max float64) *ClampDirectionOffset
SetMax changes the upper bounds limit.
func (*ClampDirectionOffset) SetMin ¶
func (s *ClampDirectionOffset) SetMin(min float64) *ClampDirectionOffset
SetMin changes the lower bounds limit.
func (*ClampDirectionOffset) SetRestitution ¶
func (s *ClampDirectionOffset) SetRestitution(restitution float64) *ClampDirectionOffset
SetRestitution changes the restitution to be used when adjusting the two bodies when the constraint is not met.
type Coilover ¶
type Coilover struct {
// contains filtered or unexported fields
}
Coilover represents the solution for a constraint that immitates a car coilover through a damped harmonic oscillator.
func NewCoilover ¶
func NewCoilover() *Coilover
NewCoilover creates a new Coilover constraint solver.
func (*Coilover) ApplyImpulses ¶
func (s *Coilover) ApplyImpulses(ctx solver.PairContext)
func (*Coilover) ApplyNudges ¶
func (s *Coilover) ApplyNudges(ctx solver.PairContext)
func (*Coilover) Damping ¶
Damping returns the damping ratio of the damped harmonic oscillator that represents this coilover.
func (*Coilover) Frequency ¶
Frequency returns the frequency (in Hz) of the damped harmonic oscillator that represents this coilover.
func (*Coilover) PrimaryRadius ¶
PrimaryRadius returns the radius vector of the contact point on the primary object.
The vector is in the object's local space.
func (*Coilover) Reset ¶
func (s *Coilover) Reset(ctx solver.PairContext)
func (*Coilover) SecondaryRadius ¶
SecondaryRadius returns the radius vector of the contact point on the secondary object.
The vector is in the object's local space.
func (*Coilover) SetDamping ¶
SetDamping changes the damping ratio of the damped harmonic oscillator that represents this coilover.
func (*Coilover) SetFrequency ¶
SetFrequency changes the frequency (in Hz) of the damped harmonic oscillator that represents this coilover.
func (*Coilover) SetPrimaryRadius ¶
SetPrimaryRadius changes the radius vector of the contact point on the primary object.
The vector is in the object's local space.
type Collision ¶
type Collision struct {
// contains filtered or unexported fields
}
func (*Collision) ApplyImpulses ¶
func (*Collision) ApplyNudges ¶
func (*Collision) Init ¶
func (s *Collision) Init(state CollisionState)
type CollisionState ¶
type Combined ¶
type Combined struct {
// contains filtered or unexported fields
}
Combined is a single-object solver that delegates its logic to a number of sub-solvers.
func NewCombined ¶
func NewCombined(delegates ...solver.Constraint) *Combined
NewCombined creates a new Combined solver based on the specified sub-solvers.
func (*Combined) ApplyImpulses ¶
func (*Combined) ApplyNudges ¶
type CopyDirection ¶
type CopyDirection struct {
// contains filtered or unexported fields
}
CopyDirection ensures that the second body has the same direction as the first one. This solver is immediate - it does not use impulses or nudges.
func NewCopyDirection ¶
func NewCopyDirection() *CopyDirection
NewCopyDirection creates a new CopyDirection constraint solver.
func (*CopyDirection) ApplyImpulses ¶
func (s *CopyDirection) ApplyImpulses(ctx solver.PairContext)
func (*CopyDirection) ApplyNudges ¶
func (s *CopyDirection) ApplyNudges(ctx solver.PairContext)
func (*CopyDirection) PrimaryDirection ¶
func (s *CopyDirection) PrimaryDirection() dprec.Vec3
PrimaryDirection returns the direction of the primary body.
func (*CopyDirection) Reset ¶
func (s *CopyDirection) Reset(ctx solver.PairContext)
func (*CopyDirection) SecondaryDirection ¶
func (s *CopyDirection) SecondaryDirection() dprec.Vec3
SecondaryDirection returns the direction of the secondary body.
func (*CopyDirection) SetPrimaryDirection ¶
func (s *CopyDirection) SetPrimaryDirection(direction dprec.Vec3) *CopyDirection
SetPrimaryDirection changes the direction of the primary body.
func (*CopyDirection) SetSecondaryDirection ¶
func (s *CopyDirection) SetSecondaryDirection(direction dprec.Vec3) *CopyDirection
SetSecondaryDirection changes the direction of the secondary body.
type CopyPosition ¶
type CopyPosition struct{}
CopyPosition ensures that the target object has the same position as the source one.
This solver is immediate - it converges in a single step.
func NewCopyPosition ¶
func NewCopyPosition() *CopyPosition
NewCopyPosition creates a new CopyPosition constraint solver.
func (*CopyPosition) ApplyImpulses ¶
func (s *CopyPosition) ApplyImpulses(ctx solver.PairContext)
func (*CopyPosition) ApplyNudges ¶
func (s *CopyPosition) ApplyNudges(ctx solver.PairContext)
func (*CopyPosition) Reset ¶
func (s *CopyPosition) Reset(ctx solver.PairContext)
type CopyRotation ¶
type CopyRotation struct{}
CopyRotation ensures that the target body has exactly the same rotation as the source one.
This solver is immediate - it converges in a single step.
func NewCopyRotation ¶
func NewCopyRotation() *CopyRotation
NewCopyRotation creates a new CopyRotation constraint solver.
func (*CopyRotation) ApplyImpulses ¶
func (s *CopyRotation) ApplyImpulses(ctx solver.PairContext)
func (*CopyRotation) ApplyNudges ¶
func (s *CopyRotation) ApplyNudges(ctx solver.PairContext)
func (*CopyRotation) Reset ¶
func (s *CopyRotation) Reset(ctx solver.PairContext)
type Differential ¶
type Differential struct {
// contains filtered or unexported fields
}
Differential represents the solution for a constraint that keeps two objects from rotating too much relative to one another over the local X axis.
func NewDifferential ¶
func NewDifferential() *Differential
NewDifferential creates a new Differential constraint solver.
func (*Differential) ApplyImpulses ¶
func (d *Differential) ApplyImpulses(ctx solver.PairContext)
func (*Differential) ApplyNudges ¶
func (d *Differential) ApplyNudges(ctx solver.PairContext)
func (*Differential) MaxDelta ¶
func (d *Differential) MaxDelta() float64
MaxDelta returns the maximum difference in velocity that is allowed.
func (*Differential) Reset ¶
func (d *Differential) Reset(ctx solver.PairContext)
func (*Differential) SetMaxDelta ¶
func (d *Differential) SetMaxDelta(maxDelta float64) *Differential
SetMaxDelta changes the maximum difference in velocity that is allowed.
type HingedRod ¶
type HingedRod struct {
// 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 solver.
func (*HingedRod) ApplyImpulses ¶
func (s *HingedRod) ApplyImpulses(ctx solver.PairContext)
ApplyImpulses applies impulses in order to keep the velocity part of the constraint satisfied.
func (*HingedRod) ApplyNudges ¶
func (s *HingedRod) ApplyNudges(ctx solver.PairContext)
ApplyNudges applies nudges in order to keep the positional part of the constraint satisfied.
func (*HingedRod) PrimaryRadius ¶
PrimaryRadius returns the radius vector of the contact point on the primary object.
The vector is in the object's local space.
func (*HingedRod) Reset ¶
func (s *HingedRod) Reset(ctx solver.PairContext)
Reset re-evaluates the constraint.
func (*HingedRod) SecondaryRadius ¶
SecondaryRadius returns the radius vector of the contact point on the secondary object.
The vector is in the object's local space.
func (*HingedRod) SetPrimaryRadius ¶
SetPrimaryRadius changes the attachment point of the link on the primary body.
type MatchDirectionOffset ¶
type MatchDirectionOffset struct {
// contains filtered or unexported fields
}
MatchDirectionOffset represents the solution for a constraint which ensures that the second body is at an exact distance away from the first body along some direction of the first body.
func NewMatchDirectionOffset ¶
func NewMatchDirectionOffset() *MatchDirectionOffset
NewMatchDirectionOffset creates a new MatchDirectionOffset constraint solver.
func (*MatchDirectionOffset) ApplyImpulses ¶
func (s *MatchDirectionOffset) ApplyImpulses(ctx solver.PairContext)
func (*MatchDirectionOffset) ApplyNudges ¶
func (s *MatchDirectionOffset) ApplyNudges(ctx solver.PairContext)
func (*MatchDirectionOffset) Direction ¶
func (s *MatchDirectionOffset) Direction() dprec.Vec3
Direction returns the constraint direction, which is in local space of the first body.
func (*MatchDirectionOffset) Offset ¶
func (s *MatchDirectionOffset) Offset() float64
Offset returns the directional offset.
func (*MatchDirectionOffset) PrimaryRadius ¶
func (s *MatchDirectionOffset) PrimaryRadius() dprec.Vec3
PrimaryRadius returns the radius vector of the contact point on the primary object.
The vector is in the object's local space.
func (*MatchDirectionOffset) Reset ¶
func (s *MatchDirectionOffset) Reset(ctx solver.PairContext)
func (*MatchDirectionOffset) SecondaryRadius ¶
func (s *MatchDirectionOffset) SecondaryRadius() dprec.Vec3
SecondaryRadius returns the radius vector of the contact point on the secondary object.
The vector is in the object's local space.
func (*MatchDirectionOffset) SetDirection ¶
func (s *MatchDirectionOffset) SetDirection(direction dprec.Vec3) *MatchDirectionOffset
SetDirection changes the constraint direction, which must be in local space of the first body.
func (*MatchDirectionOffset) SetOffset ¶
func (s *MatchDirectionOffset) SetOffset(offset float64) *MatchDirectionOffset
SetOffset changes the directional offset.
func (*MatchDirectionOffset) SetPrimaryRadius ¶
func (s *MatchDirectionOffset) SetPrimaryRadius(radius dprec.Vec3) *MatchDirectionOffset
SetPrimaryRadius changes the attachment point of the link on the primary body.
func (*MatchDirectionOffset) SetSecondaryRadius ¶
func (s *MatchDirectionOffset) SetSecondaryRadius(radius dprec.Vec3) *MatchDirectionOffset
SetSecondaryRadius changes the radius vector of the contact point on the secondary object.
The vector is in the object's local space.
type MatchDirections ¶
type MatchDirections struct {
// contains filtered or unexported fields
}
MatchDirections represents the solution for a constraint that keeps the direction of two bodies pointing in the same direction.
func NewMatchDirections ¶
func NewMatchDirections() *MatchDirections
NewMatchDirections creates a new MatchDirections constraint solver.
func (*MatchDirections) ApplyImpulses ¶
func (s *MatchDirections) ApplyImpulses(ctx solver.PairContext)
func (*MatchDirections) ApplyNudges ¶
func (s *MatchDirections) ApplyNudges(ctx solver.PairContext)
func (*MatchDirections) PrimaryDirection ¶
func (s *MatchDirections) PrimaryDirection() dprec.Vec3
PrimaryDirection returns the direction of the primary body that will be used in the alignment.
func (*MatchDirections) Reset ¶
func (s *MatchDirections) Reset(ctx solver.PairContext)
func (*MatchDirections) SecondaryDirection ¶
func (s *MatchDirections) SecondaryDirection() dprec.Vec3
SecondaryDirection returns the direction of the secondary body that will be used in the alignment.
func (*MatchDirections) SetPrimaryDirection ¶
func (s *MatchDirections) SetPrimaryDirection(direction dprec.Vec3) *MatchDirections
SetPrimaryDirection changes the direction of the primary body to be used in the alignment.
func (*MatchDirections) SetSecondaryDirection ¶
func (s *MatchDirections) SetSecondaryDirection(direction dprec.Vec3) *MatchDirections
SetSecondaryDirection changes the direction of the secondary body to be used in the alignment.
type PairCollision ¶
type PairCollision struct {
// contains filtered or unexported fields
}
func (*PairCollision) ApplyImpulses ¶
func (s *PairCollision) ApplyImpulses(ctx solver.PairContext)
func (*PairCollision) ApplyNudges ¶
func (s *PairCollision) ApplyNudges(ctx solver.PairContext)
func (*PairCollision) Init ¶
func (s *PairCollision) Init(state PairCollisionState)
func (*PairCollision) Reset ¶
func (s *PairCollision) Reset(ctx solver.PairContext)
type PairCollisionState ¶
type PairCollisionState struct { PrimaryNormal dprec.Vec3 PrimaryPoint dprec.Vec3 PrimaryFrictionCoefficient float64 PrimaryRestitutionCoefficient float64 SecondaryNormal dprec.Vec3 SecondaryPoint dprec.Vec3 SecondaryFrictionCoefficient float64 SecondaryRestitutionCoefficient float64 Depth float64 }
type PairCombined ¶
type PairCombined struct {
// contains filtered or unexported fields
}
PairCombined is a double-object solver that delegates its logic to a number of sub-solvers.
func NewPairCombined ¶
func NewPairCombined(delegates ...solver.PairConstraint) *PairCombined
NewPairCombined creates a new PairCombined solver based on the specified sub-solvers.
func (*PairCombined) ApplyImpulses ¶
func (s *PairCombined) ApplyImpulses(ctx solver.PairContext)
func (*PairCombined) ApplyNudges ¶
func (s *PairCombined) ApplyNudges(ctx solver.PairContext)
func (*PairCombined) Reset ¶
func (s *PairCombined) Reset(ctx solver.PairContext)
type StaticPosition ¶
type StaticPosition struct {
// contains filtered or unexported fields
}
StaticPosition represents the solution for a constraint that keeps a body positioned at the specified fixture location.
This solver is immediate - it converges in a single step.
func NewStaticPosition ¶
func NewStaticPosition() *StaticPosition
NewStaticPosition creates a new StaticPosition constraint solver.
func (*StaticPosition) ApplyImpulses ¶
func (s *StaticPosition) ApplyImpulses(ctx solver.Context)
func (*StaticPosition) ApplyNudges ¶
func (s *StaticPosition) ApplyNudges(ctx solver.Context)
func (*StaticPosition) Position ¶
func (t *StaticPosition) Position() dprec.Vec3
Position returns the location to which the body will be constrained.
func (*StaticPosition) Reset ¶
func (s *StaticPosition) Reset(ctx solver.Context)
func (*StaticPosition) SetPosition ¶
func (t *StaticPosition) SetPosition(position dprec.Vec3) *StaticPosition
SetPosition changes the location to which the body will be constrained.
type StaticRotation ¶
type StaticRotation struct {
// contains filtered or unexported fields
}
StaticRotation represents the solution for a constraint that keeps a body positioned at the specified fixture location.
This solver is immediate - it converges in a single step.
func NewStaticRotation ¶
func NewStaticRotation() *StaticRotation
NewStaticRotation creates a new StaticRotation constraint solver.
func (*StaticRotation) ApplyImpulses ¶
func (s *StaticRotation) ApplyImpulses(ctx solver.Context)
func (*StaticRotation) ApplyNudges ¶
func (s *StaticRotation) ApplyNudges(ctx solver.Context)
func (*StaticRotation) Reset ¶
func (s *StaticRotation) Reset(ctx solver.Context)
func (*StaticRotation) Rotation ¶
func (t *StaticRotation) Rotation() dprec.Quat
Rotation returns the orientation to which the body will be constrained.
func (*StaticRotation) SetRotation ¶
func (t *StaticRotation) SetRotation(rotation dprec.Quat) *StaticRotation
SetRotation changes the orientation to which the body will be constrained.