objects

package
v0.0.0-...-e180675 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ElasticCollision

func ElasticCollision(o1, o2 *Object) error

ElasticCollision updates velocity of two objects Objects are assumed to have equal mass

Types

type Object

type Object struct {
	X vector.Vector
	V vector.Vector
}

Object consist of position, velocity

func New

func New(x, y, vx, vy float64) (*Object, error)

New is a constructur of type Object

func (*Object) Position

func (o *Object) Position(dt float64) error

Position updates position of an object based on current velocity

func (*Object) Velocity

func (o *Object) Velocity(ax, ay, dt float64) error

Velocity updates velocity of an object based on provided acceleration

Jump to

Keyboard shortcuts

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