Commits

Panagiotis Mavrogiorgos  committed 3f9cfb6

Add from __future__ imports to every file in geoalg.

  • Participants
  • Parent commits 3af93f8

Comments (0)

Files changed (22)

File geoalg/base.py

 # Purpose:
 # Created: 27.03.2010
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 import math
 
 HALF_PI = math.pi / 2.

File geoalg/bruteforce.py

 # Purpose: bruteforce algorithms
 # Created: 02.04.2010
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
+
 import math
 from random import random
 
     set2 = set(round_points(list2, prec))
     if len(list1) != len(list2):
         return False
-    return set1 == set2
+    return set1 == set2

File geoalg/circle.py

 # Created: 28.02.2010
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 import math
 
-from .ray import Ray2D
+from geoalg import Ray2D
 
 HALF_PI = math.pi / 2.
 

File geoalg/clothoid.py

 # Created: 26.03.2010
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 import sys
 # for python3
 if sys.version_info[0] > 2:

File geoalg/convexhull.py

 # Purpose: convex hull algorithm
 # Created: 28.02.2010
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __all__ = ['ConvexHull']
 
 class ConvexHull(object):

File geoalg/gauss.py

+#!/usr/bin/env python
+#coding:utf-8
+# Author:   --<>
+# Purpose:
+# Created: 27.03.2010
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __author__ = 'mozman <mozman@gmx.at>'
 
 __all__ = ["gaussian_elimination"]

File geoalg/line.py

 # Purpose: line
 # Created: 31.03.2010
 
-from .ray import Ray2D, ParallelRaysError
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
+from geoalg import Ray2D, ParallelRaysError
 
 __all__ = ['Line2D', 'ccw', 'do_intersect']
 

File geoalg/matrix44.py

 # module belongs to package geoalg
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 from math import sin, cos, tan
 from array import array
 
-from .vector3d import Vec3
+from geoalg import Vec3
 
 class Matrix44(object):
     _identity = (

File geoalg/nurbs/bezier.py

 # Created: 2012.01.02
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __author__ = 'mozman <mozman@gmx.at>'
 __all__ = ['Bezier', 'DBezier']
 

File geoalg/nurbs/bezier4p.py

 # Purpose: Bezier Curve optimized for 4 control points
 # Created: 26.03.2010
 # License: GPLv3
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __author__ = "mozman <mozman@gmx.at>"
 __all__ = ['Bezier4P']
 

File geoalg/nurbs/cspline.py

 # Created: 26.03.2010
 # License: GPLv3
 # Source: http://www-lehre.informatik.uni-osnabrueck.de/~cg/2000/skript/7_2_Splines.html
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __author__ = "mozman <mozman@gmx.at>"
 __all__ = ['CubicSpline']
 

File geoalg/nurbs/spline.py

 # Created: 2012.01.03
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __author__ = 'mozman <mozman@gmx.at>'
 __all__ = ['BSpline', 'BSplineU', 'DBSpline', 'DBSplineU', 'RBSpline', 'RBSplineU']
 
-from .bezier import to3d
+from geoalg.nurbs.bezier import to3d
 
 def one_based_array(values, decor=lambda x:x):
     newlist = [0.0]

File geoalg/nurbs/surfaces.py

 # Created: 2012.01.07
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __author__ = 'mozman <mozman@gmx.at>'
 
-from .bezier import bernstein_basis
+from geoalg.nurbs import bernstein_basis
 
 class BezierSurface(object):
     def __init__(self, defpoints):

File geoalg/plane.py

 # Created: 28.02.2010
 # License: GPL
 
-from .vector3d import Vec3
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
+from geoalg import Vec3
 
 class Plane(object):
     def __init__(self, dist=0, vector=(0., 0., 1.)):

File geoalg/polybezier.py

 #!/usr/bin/env python
 #coding:utf-8
-# Purpose: 
+# Purpose:
 # Created: 02.08.12
 # Copyright (C) 2012, Manfred Moitzi
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __author__ = "mozman <mozman@gmx.at>"
 
-from .nurbs import Bezier4P
-from .vector2d import Vec2, NULLVEC
-from .util import almost_equal_vectors
-from .ray import Ray2D
 import math
 
+from geoalg.nurbs import Bezier4P
+from geoalg.vector2d import Vec2, NULLVEC
+from geoalg.util import almost_equal_vectors
+from geoalg import Ray2D
+
 class PolyBezier(object):
     def __init__(self, points, start_angle=None, end_angle=None):
         self.start_angle = start_angle
 
     def find_part(self, position):
         """ Find bezier curve part associated to curve position.
-        
+
         :param float position: in range [0 .. self.length]
-        :returns tuple: (bezier_part, t) t in range of [0 .. 1] 
+        :returns tuple: (bezier_part, t) t in range of [0 .. 1]
         """
         end_of_part = 0.0
         for part_num, part_length in enumerate(self.bezier_part_lengths):
                 t = (position - start_of_part) / part_length
                 return self.bezier_part(part_num), min(t, 1.0)
         raise ValueError('position out of range')
-    
+
     def get_point(self, position):
         """ Get curve point at position.
-        
+
         :param float position: in range [0 .. self.length]
         :returns: Vec2
         """
 
     def get_tangent(self, position):
         """Get curve tangent at point position.
-        
+
         :param float position: in range [0 .. self.length]
         :returns: Vec2
         """

File geoalg/polyline.py

 # Purpose: polylines
 # Created: 31.03.2010
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 class Polyline(list):
     def __init__(self, points=[], closed=False):
         super(Polyline, self).__init__(points)

File geoalg/ray.py

 y(x) = y0 + x * slope in a cartesian coordinate system
 """
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 import math
 
 __all__ = ['Ray2D', 'ParallelRaysError']

File geoalg/sweep.py

 # Purpose: variouse sweep algorithms
 # Created: 28.03.2010
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 from heapq import heappush, heappop
 
 DEBUG = False

File geoalg/util.py

 # Created: 28.02.2010
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 import math
 
 HALF_PI = math.pi / 2.

File geoalg/vector2d.py

 # Copyright (C) 2010, Manfred Moitzi
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 import math
 
 __all__= ['Vec2']

File geoalg/vector3d.py

 # Copyright (C) 2010, Manfred Moitzi
 # License: GPLv3
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 __all__= ['Vec3']
 
 X, Y, Z = (0, 1, 2)

File geoalg/voronoi.py

 #  Python code refactoring by mozman
 #  April, 2010
 
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import absolute_import
+
 import math
 
 __all__ = ['voronoi']