Skip to content

Commit

Permalink
chore: add function to return a 2D vector directly
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Vieira <lucas.engen.cc@gmail.com>
  • Loading branch information
lucasvmx committed Jan 30, 2021
1 parent 9668ec0 commit f4a9110
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions utils/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ func CalculateDistance(p1, p2 Vector2D) float64 {

return math.Sqrt(dx + dy)
}

// GetVector2D function returns the 2D vector to the specified coordinates
func GetVector2D(x, y float64) Vector2D {
return Vector2D{
X: x,
Y: y,
}
}

0 comments on commit f4a9110

Please sign in to comment.