physics

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box struct {
	Pos       mgl32.Vec3
	MainAxis  mgl32.Vec3
	CrossAxis mgl32.Vec3
	UpAxis    mgl32.Vec3
	MainHalf  float32
	CrossHalf float32
	UpHalf    float32
	Spheres   []Sphere
	Links     []Link
}

func NewBox

func NewBox(center mgl32.Vec3, mainAxis mgl32.Vec3, crossAxis mgl32.Vec3, upAxis mgl32.Vec3, mainLength float32, crossLength float32, upLength float32) Box

func (*Box) Accelerate

func (b *Box) Accelerate(a mgl32.Vec3)

func (*Box) Collide

func (b *Box) Collide(c Collider)

func (Box) Collider

func (Box) Collider() string

func (*Box) UpdatePosition

func (b *Box) UpdatePosition(dt float32)

type Collider

type Collider interface {
	Collider() string
}
type Link struct {
	Start  *Verlet
	End    *Verlet
	Length float32
}
func NewLink(start *Verlet, end *Verlet) Link

func (*Link) Update

func (l *Link) Update()

type Plane

type Plane struct {
	Verlet
	Normal    mgl32.Vec3
	MainAxis  mgl32.Vec3
	CrossAxis mgl32.Vec3
	MainHalf  float32
	CrossHalf float32
}

func NewPlane

func NewPlane(p1 mgl32.Vec3, p2 mgl32.Vec3, p3 mgl32.Vec3, p4 mgl32.Vec3) Plane

func (*Plane) Collide

func (p *Plane) Collide(c Collider)

func (Plane) Collider

func (p Plane) Collider() string

type Sphere

type Sphere struct {
	Verlet
	Radius float32
}

func NewSphere

func NewSphere(pos mgl32.Vec3, radius float32) Sphere

func (*Sphere) Collide

func (s *Sphere) Collide(c Collider)

func (Sphere) Collider

func (Sphere) Collider() string

type Verlet

type Verlet struct {
	Pos     mgl32.Vec3
	PrevPos mgl32.Vec3
	Accel   mgl32.Vec3
}

func NewVerlet

func NewVerlet(pos mgl32.Vec3) Verlet

func (*Verlet) Accelerate

func (v *Verlet) Accelerate(accel mgl32.Vec3)

func (*Verlet) UpdatePosition

func (v *Verlet) UpdatePosition(dt float32)

Run Verlet integration

Jump to

Keyboard shortcuts

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