Skip to content

Commit 1d572d8

Browse files
author
Onur Rauf Bingol
committed
Major refactoring
1 parent 55b3237 commit 1d572d8

File tree

11 files changed

+485
-430
lines changed

11 files changed

+485
-430
lines changed

geomdl/BSpline.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
"""
22
.. module:: BSpline
33
:platform: Unix, Windows
4-
:synopsis: Provides data storage and evaluation functionality for B-spline curves and surfaces
4+
:synopsis: Provides data storage and evaluation functionality for B-spline geometries
55
66
.. moduleauthor:: Onur Rauf Bingol <orbingol@gmail.com>
77
88
"""
99

1010
import pickle
11+
1112
from . import abstract
12-
from . import utilities
1313
from . import evaluators
1414
from . import operations
1515
from . import tessellate
16-
from ._utilities import export
16+
from . import _utilities as utl
1717
from .exceptions import GeomdlException
1818

1919

20-
@export
20+
@utl.export
2121
class Curve(abstract.Curve):
2222
""" Data storage and evaluation class for n-variate B-spline (non-rational) curves.
2323
@@ -150,7 +150,7 @@ def evaluate(self, **kwargs):
150150

151151
# Check parameters
152152
if self._kv_normalize:
153-
if not utilities.check_params([start, stop]):
153+
if not utl.check_params([start, stop]):
154154
raise GeomdlException("Parameters should be between 0 and 1")
155155

156156
# Clean up the curve points
@@ -177,7 +177,7 @@ def evaluate_single(self, param):
177177

178178
# Check parameters
179179
if self._kv_normalize:
180-
if not utilities.check_params([param]):
180+
if not utl.check_params([param]):
181181
raise GeomdlException("Parameters should be between 0 and 1")
182182

183183
# Evaluate the curve point
@@ -203,7 +203,7 @@ def evaluate_list(self, param_list):
203203
res = []
204204
for prm in param_list:
205205
if self._kv_normalize:
206-
if utilities.check_params([prm]):
206+
if utl.check_params([prm]):
207207
res.append(self.evaluate_single(prm))
208208
else:
209209
res.append(self.evaluate_single(prm))
@@ -241,7 +241,7 @@ def insert_knot(self, param, **kwargs):
241241

242242
# Check parameters are correct
243243
if self._kv_normalize:
244-
if not utilities.check_params([param]):
244+
if not utl.check_params([param]):
245245
raise GeomdlException("Parameters should be between 0 and 1")
246246

247247
# Get keyword arguments
@@ -273,7 +273,7 @@ def remove_knot(self, param, **kwargs):
273273

274274
# Check param parameters are correct
275275
if self._kv_normalize:
276-
if not utilities.check_params([param]):
276+
if not utl.check_params([param]):
277277
raise GeomdlException("Parameters should be between 0 and 1")
278278

279279
# Get keyword arguments
@@ -355,7 +355,7 @@ def binormal(self, parpos, **kwargs):
355355
return operations.binormal(self, parpos, **kwargs)
356356

357357

358-
@export
358+
@utl.export
359359
class Surface(abstract.Surface):
360360
""" Data storage and evaluation class for B-spline (non-rational) surfaces.
361361
@@ -656,7 +656,7 @@ def evaluate(self, **kwargs):
656656

657657
# Check parameters
658658
if self._kv_normalize:
659-
if not utilities.check_params([start_u, stop_u, start_v, stop_v]):
659+
if not utl.check_params([start_u, stop_u, start_v, stop_v]):
660660
raise GeomdlException("Parameters should be between 0 and 1")
661661

662662
# Clean up the surface points
@@ -706,7 +706,7 @@ def evaluate_list(self, param_list):
706706
res = []
707707
for prm in param_list:
708708
if self._kv_normalize:
709-
if utilities.check_params(prm):
709+
if utl.check_params(prm):
710710
res.append(self.evaluate_single(prm))
711711
else:
712712
res.append(self.evaluate_single(prm))
@@ -755,7 +755,7 @@ def insert_knot(self, u=None, v=None, **kwargs):
755755

756756
# Check if the parameter values are correctly defined
757757
if self._kv_normalize:
758-
if not utilities.check_params([u, v]):
758+
if not utl.check_params([u, v]):
759759
raise GeomdlException("Parameters should be between 0 and 1")
760760

761761
# Get keyword arguments
@@ -791,7 +791,7 @@ def remove_knot(self, u=None, v=None, **kwargs):
791791

792792
# Check if the parameter values are correctly defined
793793
if self._kv_normalize:
794-
if not utilities.check_params([u, v]):
794+
if not utl.check_params([u, v]):
795795
raise GeomdlException("Parameters should be between 0 and 1")
796796

797797
# Get keyword arguments
@@ -855,7 +855,7 @@ def normal(self, parpos, **kwargs):
855855
return operations.normal(self, parpos, **kwargs)
856856

857857

858-
@export
858+
@utl.export
859859
class Volume(abstract.Volume):
860860
""" Data storage and evaluation class for B-spline (non-rational) volumes.
861861
@@ -981,7 +981,7 @@ def evaluate(self, **kwargs):
981981

982982
# Check if all the input parameters are in the range
983983
if self._kv_normalize:
984-
if not utilities.check_params([start_u, stop_u, start_v, stop_v, start_w, stop_w]):
984+
if not utl.check_params([start_u, stop_u, start_v, stop_v, start_w, stop_w]):
985985
raise GeomdlException("Parameters should be between 0 and 1")
986986

987987
# Clean up the evaluated points
@@ -1008,7 +1008,7 @@ def evaluate_single(self, param):
10081008

10091009
# Check if all parameters are in the range
10101010
if self._kv_normalize:
1011-
if not utilities.check_params(param):
1011+
if not utl.check_params(param):
10121012
raise GeomdlException("Parameters should be between 0 and 1")
10131013

10141014
# Evaluate the volume point
@@ -1035,7 +1035,7 @@ def evaluate_list(self, param_list):
10351035
res = []
10361036
for prm in param_list:
10371037
if self._kv_normalize:
1038-
if utilities.check_params(prm):
1038+
if utl.check_params(prm):
10391039
res.append(self.evaluate_single(prm))
10401040
else:
10411041
res.append(self.evaluate_single(prm))
@@ -1061,7 +1061,7 @@ def insert_knot(self, u=None, v=None, w=None, **kwargs):
10611061

10621062
# Check if the parameter values are correctly defined
10631063
if self._kv_normalize:
1064-
if not utilities.check_params([u, v, w]):
1064+
if not utl.check_params([u, v, w]):
10651065
raise GeomdlException("Parameters should be between 0 and 1")
10661066

10671067
# Get keyword arguments
@@ -1101,7 +1101,7 @@ def remove_knot(self, u=None, v=None, w=None, **kwargs):
11011101

11021102
# Check if the parameter values are correctly defined
11031103
if self._kv_normalize:
1104-
if not utilities.check_params([u, v, w]):
1104+
if not utl.check_params([u, v, w]):
11051105
raise GeomdlException("Parameters should be between 0 and 1")
11061106

11071107
# Get keyword arguments

geomdl/NURBS.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
.. module:: NURBS
33
:platform: Unix, Windows
4-
:synopsis: Provides data storage and evaluation functionality for NURBS curves and surfaces
4+
:synopsis: Provides data storage and evaluation functionality for NURBS geometries
55
66
.. moduleauthor:: Onur Rauf Bingol <orbingol@gmail.com>
77

0 commit comments

Comments
 (0)