Documentation
¶
Index ¶
- Variables
- type Composite
- type Constraint
- type Material
- type Particle
- func (p *Particle) Accelerate(rate shapes.Point)
- func (p *Particle) ApplyForce(force shapes.Point)
- func (p *Particle) ApplyImpulse(impulse shapes.Point)
- func (p *Particle) ResetForces()
- func (p *Particle) Restrain(border shapes.Border, dimensions int)
- func (p *Particle) SetMaterial(material Material)
- func (p *Particle) Simulate(worldDelta float64)
- type World
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFoundAttachedParticle = errors.New("not found attache particle")
)
All kind of errors
Functions ¶
This section is empty.
Types ¶
type Composite ¶
type Composite struct {
Particles []*Particle
Constraints []*Constraint
}
Composite describe complex object with multiple particles and constraints
func (*Composite) AddConstraints ¶
AddConstraints create constraint between two particles
func (*Composite) AddParticle ¶
AddParticle add particle
func (*Composite) GetParticle ¶
GetParticle get particle by index
func (*Composite) SetMaterial ¶
SetMaterial set material to all particles
type Constraint ¶
type Constraint struct {
Particle1 *Particle
Particle2 *Particle
Target float64
Stiff float64
Damp float64
}
Constraint describe relation between two particles
func NewConstraint ¶
func NewConstraint(p1, p2 *Particle, springConstant, distanceConstraint float64) *Constraint
NewConstraint return new constraint
type Particle ¶
type Particle struct {
Material Material
Position shapes.Point
Previous shapes.Point
Velocity shapes.Point
Acceleration shapes.Point
}
Particle describe particle
func NewParticle ¶
NewParticle create new particle
func (*Particle) Accelerate ¶
Accelerate apply acceleration
func (*Particle) ApplyForce ¶
ApplyForce apply force
func (*Particle) ApplyImpulse ¶
ApplyImpulse immediately change position
func (*Particle) SetMaterial ¶
SetMaterial set material
Click to show internal directories.
Click to hide internal directories.