vec

package module
v0.0.0-...-73bfe46 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 3 Imported by: 1

README

go-vectors

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance[Type Number](lhs, rhs V2d[Type]) (answer float64)

Types

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

type V2d

type V2d[Type Number] struct {
	X, Y Type
}

func Add

func Add[Type Number](lhs, rhs V2d[Type]) (answer V2d[Type])

useful arithmetics

func Divide

func Divide[Type Number](lhs, rhs V2d[Type]) (answer V2d[Type])

func Multiply

func Multiply[Type Number](lhs, rhs V2d[Type]) (answer V2d[Type])

func NewVec

func NewVec[Type Number](x, y Type) *V2d[Type]

func ScalarMultiplication

func ScalarMultiplication[Type Number](lhs V2d[Type], scalar Type) (answer V2d[Type])

func Subtract

func Subtract[Type Number](lhs, rhs V2d[Type]) (answer V2d[Type])

func (*V2d[Type]) Add

func (this *V2d[Type]) Add(v V2d[Type])

func (*V2d[Type]) Divide

func (this *V2d[Type]) Divide(v V2d[Type])

func (*V2d[Type]) Multiply

func (this *V2d[Type]) Multiply(v V2d[Type])

func (*V2d[Type]) String

func (this *V2d[Type]) String() string

func (*V2d[Type]) Subtract

func (this *V2d[Type]) Subtract(v V2d[Type])

type Vf2d

type Vf2d = V2d[float64]

type Vi2d

type Vi2d = V2d[int]

some predefines

Jump to

Keyboard shortcuts

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