gridphysics

package
v0.0.0-...-8ad53de Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 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 AngleVector

type AngleVector struct {
	// Direction is the direction of motion.
	Direction RadianAngle

	// Magnitude is the multiplier to determine distance traveled in one unit of
	// time.
	Magnitude float64
}

AngleVector = Magnitude * Direction

func (AngleVector) LinearVelocity

func (v AngleVector) LinearVelocity() (xVel, yVel float64)

LinearVelocity returns a vector's velocity in both the x and y directions.

type CoordVector

type CoordVector [2]Coordinate

CoordVector = (x, y), (m, n)

type Coordinate

type Coordinate [2]float64

Coordinate represents the (x, y) coordinates on a grid. These coordinates represent points in space that may not actually be displayed in the grid.

func (Coordinate) Move

func (c Coordinate) Move(v AngleVector) Coordinate

Move returns the next coordinate given an angle vector.

func (Coordinate) ToDiscreteCoordinate

func (c Coordinate) ToDiscreteCoordinate() DiscreteCoord

ToDiscreteCoordinate rounds an imaginary coordinate to a discrete coordinate.

type DegreeAngle

type DegreeAngle float64

DegreeAngle is an angle in degrees

func (DegreeAngle) ToRadians

func (d DegreeAngle) ToRadians() (rad RadianAngle)

ToRadians converts degrees to radians

type DiscreteCoord

type DiscreteCoord [2]int64

DiscreteCoord represents whole number (x, y) coordinates on a grid. These are coordinates where something can be displayed.

type RadianAngle

type RadianAngle float64

RadianAngle is an angle in radians

Jump to

Keyboard shortcuts

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