Skip to content

tonytcb/math-vector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

math-vector

This package is a mathematical vector representation written in Go, with some basic operations.

Operations

This package exports some basic operations as well:

  • Dot Product
  • Cross Product
  • Addition
  • Subtraction

How to use

$ go get github.com/tonytcb/math-vector
import "github.com/tonytcb/math-vector"

func main() {
    vector1 := vector.New(3, 5, 4)
    vector2 := vector.New(2, 7, 5)
    
    dotProduct := vector1.DotProduct(vector2)
    crossProduct := vector1.CrossProduct(vector2)
    
    vector1.Print()
    vector2.Print()
    
    fmt.Println("dotProduct:", dotProduct)
    fmt.Println("crossProduct:", crossProduct.Format())
}

Todo

  • Add addition operation
  • Add subtraction operation
  • Add more operations

References

About

Math Vector Representation in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages