Documentation
¶
Index ¶
- type SimpleVector
- func (v SimpleVector) Add(other Vector) Vector
- func (v SimpleVector) Angle(other Vector) float64
- func (v SimpleVector) DotProd(other Vector) (result float64)
- func (v SimpleVector) Eq(other Vector) bool
- func (v SimpleVector) Eq2(other Vector) bool
- func (v SimpleVector) IsZero() bool
- func (v SimpleVector) Mag() (result float64)
- func (v SimpleVector) Proj(base Vector) Vector
- func (v SimpleVector) Scale(scale float64)
- func (v SimpleVector) String() string
- func (v SimpleVector) Sub(other Vector) Vector
- func (v SimpleVector) Unit() Vector
- type Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimpleVector ¶
type SimpleVector []float64
the Vector type is a slice of float64
func New ¶
func New(elems ...float64) SimpleVector
func (SimpleVector) Add ¶
func (v SimpleVector) Add(other Vector) Vector
Add returns the sum of two vectors
func (SimpleVector) Angle ¶
func (v SimpleVector) Angle(other Vector) float64
Angle calculates the angle between two vectors (Rad)
func (SimpleVector) DotProd ¶
func (v SimpleVector) DotProd(other Vector) (result float64)
DotProd calculates the dot product using sum of prudcts
func (SimpleVector) Eq ¶
func (v SimpleVector) Eq(other Vector) bool
Eq compares vector magnitude and directions
func (SimpleVector) Eq2 ¶
func (v SimpleVector) Eq2(other Vector) bool
Eq compares each vector components for equality
func (SimpleVector) Mag ¶
func (v SimpleVector) Mag() (result float64)
Mag computes the magnitude of the vector
func (SimpleVector) Proj ¶
func (v SimpleVector) Proj(base Vector) Vector
func (SimpleVector) String ¶
func (v SimpleVector) String() string
String returns a string representation of the Vector
func (SimpleVector) Sub ¶
func (v SimpleVector) Sub(other Vector) Vector
Sub returns the subtraction of a vector from another
func (SimpleVector) Unit ¶
func (v SimpleVector) Unit() Vector
Unit returns the normalization of the vector
Click to show internal directories.
Click to hide internal directories.