Skip to content

Commit

Permalink
Use math.sqrt for single numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
RedFT committed Aug 9, 2021
1 parent 1057e5d commit f5e7511
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 f5e7511

Please sign in to comment.