vector

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 3 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dot

func Dot(v V, u V) float64

func IsOrthogonal

func IsOrthogonal(v V, u V) bool

func Magnitude

func Magnitude(v V) float64

func SquaredMagnitude

func SquaredMagnitude(v V) float64

func Within

func Within(v V, u V) bool

Types

type D

type D int
const (
	// AXIS_X is a common alias for the first dimension.
	AXIS_X D = iota

	// AXIS_Y is a common alias for the second dimension.
	AXIS_Y

	// AXIS_Z is a common alias for the third dimension.
	AXIS_Z

	// AXIS_W is a common alias for the fourth dimension.
	AXIS_W
)

type V

type V []float64

V is an n-length vector.

func Add

func Add(v V, u V) V

func New

func New(xs ...float64) *V

func Scale

func Scale(c float64, v V) V

func Sub

func Sub(v V, u V) V

func Unit

func Unit(v V) V

func (V) Dimension

func (v V) Dimension() D

Dimension returns the dimension of the vector.

func (V) X

func (v V) X(i D) float64

Jump to

Keyboard shortcuts

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