physics

package
v0.0.0-...-9c8945c Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	G = 8.8e-1
)

Variables

This section is empty.

Functions

func AttractionForceImpulse

func AttractionForceImpulse(p1, p2 internal.Vector, m1, m2 float64, timestep float64) internal.Vector

func AttractionForceVector

func AttractionForceVector(p1, p2 internal.Vector, m1, m2 float64, force float64) internal.Vector

func Colliding

func Colliding(o1, o2 Object) (float64, bool)

func CollisionTime

func CollisionTime(n1, n2 Object) float64

CollisionTime calculates the timestep at which the two objects will collide

func Reflect

func Reflect(o1, o2 *Object)

Types

type Object

type Object struct {
	P internal.Vector
	V internal.Vector
	R float64
	M float64
}

func (*Object) BoundingBox

func (o *Object) BoundingBox() internal.BoundingBox

func (*Object) KineticEnergy

func (o *Object) KineticEnergy() float64

func (*Object) ReflectBounds

func (o *Object) ReflectBounds(bb internal.BoundingBox)

func (*Object) Step

func (o *Object) Step(timestep float64)

Jump to

Keyboard shortcuts

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