func (v Vector) Add(v2 Vector) Vector {
	return Vector{v.X + v2.X, v.Y + v2.Y}
}
Add returns a vector whose components are component-wise additions of v and v2.
package twodeeparticles
import (
	"errors"
	"math"
)
var (
	ZeroVector = Vector{0.0, 0.0}
	OneVector = Vector{1.0, 1.0}
)
var errNormalizeZeroVector = errors.New("normalize zero vector")
type Vector struct {
	X float64
	Y float64
}
func (v Vector) Magnitude() float64 {
	return math.Sqrt(v.X*v.X + v.Y*v.Y)
}
func (v Vector) Normalize() Vector {
	n, ok := v.TryNormalize()
	if !ok {
		panic(errNormalizeZeroVector)
	}
	return n
}
func (v Vector) TryNormalize() (Vector, bool) {
	m := v.Magnitude()
	if m == 0 {
		return v, false
	}
	return Vector{v.X / m, v.Y / m}, true
}