Skip to content

Commit fe6e43e

Browse files
author
gin
authored
Add XY function to destructure Vectors (#132)
1 parent 457906a commit fe6e43e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

features/math/vec2.go

+4
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,7 @@ func (v Vec2) Angle(other Vec2) float64 {
118118
func (v Vec2) Distance(other Vec2) float64 {
119119
return math.Sqrt(math.Pow(v.X-other.X, 2) + math.Pow(v.Y-other.Y, 2))
120120
}
121+
122+
func (v Vec2) XY() (float64, float64) {
123+
return v.X, v.Y
124+
}

0 commit comments

Comments
 (0)