vector

package
v0.0.0-...-1ebc2e8 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: LGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Vec2d

type Vec2d struct {
	X, Y float64
}

func MidPoint

func MidPoint(v1 Vec2d, v2 Vec2d) Vec2d

MidPoint returns the midpoint as a vector of the given two vectors

func (*Vec2d) Add

func (v *Vec2d) Add(other Vec2d) Vec2d

Add adds vector other from v

func (*Vec2d) Rotate

func (v *Vec2d) Rotate(theta float64) Vec2d
 Rotate rotates the vector x,y by theta (rad) clockwise, see https://ebitengine.org/en/documents/matrix.html#Rotating

	|cos,-sin| * |X|	=	|cos*X - sin*Y|
	|sin, cos|   |Y|		|sin*X + cos*Y|

func (*Vec2d) Subtract

func (v *Vec2d) Subtract(other Vec2d) Vec2d

Subtract subtracts vector other from v

func (*Vec2d) XY

func (v *Vec2d) XY() (float64, float64)

XY returns the X, Y values as a pair of vector

Jump to

Keyboard shortcuts

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