Skip to content

Commit

Permalink
Merge pull request #20 from RedFT/dev
Browse files Browse the repository at this point in the history
Use math.sqrt for single numbers
  • Loading branch information
RedFT authored Aug 9, 2021
2 parents 1057e5d + f5e7511 commit 436784b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hexy/hexy.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import math
import numpy as np


# Matrix for converting axial coordinates to pixel coordinates
axial_to_pixel_mat = np.array([[np.sqrt(3), np.sqrt(3) / 2], [0, 3 / 2.]])
axial_to_pixel_mat = np.array([[math.sqrt(3), math.sqrt(3) / 2], [0, 3 / 2.]])

# Matrix for converting pixel coordinates to axial coordinates
pixel_to_axial_mat = np.linalg.inv(axial_to_pixel_mat)
Expand Down Expand Up @@ -43,7 +44,7 @@ def radius_from_hexes(hexes):
type(hexes)
)
)
return np.ceil(np.sqrt((hexes - 1) / 3 + 1 / 4) - 1 / 2)
return np.ceil(math.sqrt((hexes - 1) / 3 + 1 / 4) - 1 / 2)


def get_cube_distance(hex_start, hex_end):
Expand Down

0 comments on commit 436784b

Please sign in to comment.