vector

package
Version: v0.0.0-...-93e07d4 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(v1, v2 Vector) float32

Distance is the distance between the two vectors

func DistanceSquared

func DistanceSquared(v1, v2 Vector) float32

DistanceSquared is the sum of the square of the given vectors

Types

type Vector

type Vector struct {
	X, Y, Z float32
}

Vector represents a 3D vector

func Add

func Add(v1, v2 Vector) Vector

Add adds the two given vectors

func Multiply

func Multiply(v Vector, factor float32) Vector

Multiply is the dot product of the two given vectors

func Normalize

func Normalize(v Vector) Vector

Normalize the given vector i.e convert it into a unit vector

func (Vector) Length

func (v Vector) Length() float32

Length returns the length/magnitude of the vector

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL