Skip to content

Commit

Permalink
Add XY function to destructure Vectors (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
imthatgin authored Apr 7, 2024
1 parent 457906a commit fe6e43e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions features/math/vec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ func (v Vec2) Angle(other Vec2) float64 {
func (v Vec2) Distance(other Vec2) float64 {
return math.Sqrt(math.Pow(v.X-other.X, 2) + math.Pow(v.Y-other.Y, 2))
}

func (v Vec2) XY() (float64, float64) {
return v.X, v.Y
}

0 comments on commit fe6e43e

Please sign in to comment.