geometry2d

package
v0.0.0-...-d637fd6 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RotateAtCenter

func RotateAtCenter(renderPos *ebiten.GeoM, rotation float64, width, height float64)

RotateAtCenter totates a matrix on its center

Parameters:

  • `renderPos`: matrix to rotate
  • `rotation`: rotation in radians
  • `width`: width of the sprite
  • `height`: height of the sprite
  • `position`: position of the sprite

Types

type Vector2D

type Vector2D struct {
	X, Y float64
}

Vector2D represents a simple 2D vector

func (Vector2D) Add

func (v1 Vector2D) Add(v2 Vector2D) Vector2D

Add adds two vectors and return the result as a new vector

func (Vector2D) GetDirVector

func (v1 Vector2D) GetDirVector(v2 Vector2D) Vector2D

GetDirVector gets the directional vector of two vectors

func (Vector2D) GetUnitVector

func (v1 Vector2D) GetUnitVector() Vector2D

GetUnitVector calculates the unit vector

func (Vector2D) GetVectorLength

func (v1 Vector2D) GetVectorLength() float64

GetVectorLength calculates the length of a given vector

func (Vector2D) Sub

func (v1 Vector2D) Sub(v2 Vector2D) Vector2D

Sub subtracts two vectors and return a new Vector2D

Jump to

Keyboard shortcuts

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