math

package
v0.0.0-...-b36fbdc Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertDirectionVectorToRadians

func ConvertDirectionVectorToRadians(vector Vector) float64

func GetDirectionDifference

func GetDirectionDifference(d1 float64, d2 float64) float64

GetDirectionDifference gets the difference between angels (in radians)

Important context: Radians range from 0 to 2PI

There should be a small difference between a value close to 2PI and a value close to 0 because if drawn on a circle they would be close.

Examples: 1PI - 1.5PI = 0.5PI, 1.75PI - 0.25PI = 0.5PI, 1.99PI - 0.01 = 0.02PI

func GetDistanceBetweenTwoPoints

func GetDistanceBetweenTwoPoints(point1 Vector, point2 Vector) float64

func GetRadiansBetweenTwoVectors

func GetRadiansBetweenTwoVectors(v1 Vector, v2 Vector) float64

Types

type Vector

type Vector struct {
	A, B float64
}

func ConvertRadiansToDirectionVector

func ConvertRadiansToDirectionVector(radians float64) Vector

func RotatePoint

func RotatePoint(point Vector, center Vector, angle float64) Vector

func (*Vector) Add

func (v1 *Vector) Add(v2 Vector) Vector

func (*Vector) GetLength

func (v *Vector) GetLength() float64

func (*Vector) GetUnitVector

func (v *Vector) GetUnitVector() Vector

func (*Vector) Multiply

func (v *Vector) Multiply(n float64) Vector

func (*Vector) ToString

func (v *Vector) ToString() string

Jump to

Keyboard shortcuts

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