olinox 9 years ago
parent
commit
4ea719a296
3 changed files with 10 additions and 14 deletions
  1. 9 12
      core/Grid.py
  2. 0 1
      core/geometry/gtriangle.py
  3. 1 1
      tests/test_grid.py

+ 9 - 12
core/Grid.py

@@ -5,7 +5,7 @@ Created on 7 nov. 2016
 '''
 from core.Cell import Cell
 from core.constants import GRID_GEOMETRIES
-from core import geometry
+from core.geometry import gline, gzone, gtriangle, grectangle
 from core.pathfinder import pathfinder
 
 
@@ -52,9 +52,6 @@ class Grid(object):
             raise ValueError("'width' has to be a strictly positive integer")
         self._height = height    
     
-    
-    
-    
     def cell(self, coord):
         # temporary
         try:
@@ -74,25 +71,25 @@ class Grid(object):
         return (x > 0 and x <= self._width and y > 0 and y <= self._height)
     
     def line(self, x1, y1, x2, y2):
-        return geometry.gline.line2d(self.geometry, x1, y1, x2, y2)
+        return gline.line2d(self.geometry, x1, y1, x2, y2)
     
     def line3d(self, x1, y1, z1, x2, y2, z2):
-        return geometry.gline.line3d(self.geometry, x1, y1, z1, x2, y2, z2)
+        return gline.line3d(self.geometry, x1, y1, z1, x2, y2, z2)
     
-    def zone(self, x, y):
-        return geometry.gzone.zone(self.geometry, x, y)
+    def zone(self, x, y, radius):
+        return gzone.zone(self.geometry, x, y, radius)
     
     def triangle(self, xa, ya, xh, yh, iAngle):
-        return geometry.gtriangle.triangle(self.geometry, xa, ya, xh, yh, iAngle)
+        return gtriangle.triangle(self.geometry, xa, ya, xh, yh, iAngle)
     
     def triangle3d(self, xa, ya, za, xh, yh, zh, iAngle):
-        return geometry.gtriangle.triangle3d(self.geometry, xa, ya, za, xh, yh, zh, iAngle)
+        return gtriangle.triangle3d(self.geometry, xa, ya, za, xh, yh, zh, iAngle)
 
     def rect(self, x1, y1, x2, y2):
-        return geometry.grectangle.rect(x1, y1, x2, y2)
+        return grectangle.rect(x1, y1, x2, y2)
     
     def hollow_rect(self, x1, y1, x2, y2):
-        return geometry.grectangle.hollow_rect(x1, y1, x2, y2)
+        return grectangle.hollow_rect(x1, y1, x2, y2)
 
     def path(self, x1, y1, x2, y2):
         return pathfinder.path( self, (x1, y1), (x2,y2) )

+ 0 - 1
core/geometry/gtriangle.py

@@ -7,7 +7,6 @@ Created on 8 nov. 2016
 from math import sqrt
 
 from core import constants
-from core.geometry import line
 from core.geometry.cube_coords import cv_off_cube, cube_round, cv_cube_off
 
 

+ 1 - 1
tests/test_grid.py

@@ -94,7 +94,7 @@ class Test(unittest.TestCase):
         
         grid = HexGrid(10,10)
         zone = grid.zone( 0, 0, 0 )
-        self.assertEqual(zone, [(0,0,0)])
+        self.assertEqual(zone, [(0,0)])
 
 
 if __name__ == "__main__":