From f5e7511c71eb5953cf3899e4c372b0806ec0aa02 Mon Sep 17 00:00:00 2001 From: Norbu Tsering Date: Mon, 9 Aug 2021 11:29:31 -0700 Subject: [PATCH] Use math.sqrt for single numbers --- hexy/hexy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hexy/hexy.py b/hexy/hexy.py index 8c4e6ae..7733440 100644 --- a/hexy/hexy.py +++ b/hexy/hexy.py @@ -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) @@ -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):