Skip to content

Commit e28fba2

Browse files
author
Onur Rauf Bingol
committed
Removed deprecated functionality to maintain compatibility
1 parent 0c1bd73 commit e28fba2

File tree

3 files changed

+14
-175
lines changed

3 files changed

+14
-175
lines changed

geomdl/BSpline.py

Lines changed: 13 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -284,65 +284,40 @@ def remove_knot(self, param, **kwargs):
284284
def tangent(self, parpos, **kwargs):
285285
""" Evaluates the tangent vector of the curve at the given parametric position(s).
286286
287-
The ``parpos`` argument can be
287+
.. deprecated: 5.3.0
288288
289-
* a float value for evaluation at a single parametric position
290-
* a list of float values for evaluation at the multiple parametric positions
291-
292-
The return value will be in the order of the input parametric position list.
293-
294-
This method accepts the following keyword arguments:
295-
296-
* ``normalize``: normalizes the output vector. Default value is *True*.
289+
Please use :func:`operations.tangent` instead.
297290
298291
:param parpos: parametric position(s) where the evaluation will be executed
299292
:type parpos: float, list or tuple
300293
:return: tangent vector as a tuple of the origin point and the vector components
301294
:rtype: tuple
302295
"""
303-
return operations.tangent(self, parpos, **kwargs)
296+
return tuple()
304297

305298
def normal(self, parpos, **kwargs):
306299
""" Evaluates the normal to the tangent vector of the curve at the given parametric position(s).
307300
308-
The ``parpos`` argument can be
309-
310-
* a float value for evaluation at a single parametric position
311-
* a list of float values for evaluation at the multiple parametric positions
312-
313-
The return value will be in the order of the input parametric position list.
314-
315-
This method accepts the following keyword arguments:
316-
317-
* ``normalize``: normalizes the output vector. Default value is *True*.
301+
.. deprecated: 5.3.0
318302
319303
:param parpos: parametric position(s) where the evaluation will be executed
320304
:type parpos: float, list or tuple
321305
:return: normal vector as a tuple of the origin point and the vector components
322306
:rtype: tuple
323307
"""
324-
return operations.normal(self, parpos, **kwargs)
308+
return tuple()
325309

326310
def binormal(self, parpos, **kwargs):
327311
""" Evaluates the binormal vector of the curve at the given parametric position(s).
328312
329-
The ``parpos`` argument can be
330-
331-
* a float value for evaluation at a single parametric position
332-
* a list of float values for evaluation at the multiple parametric positions
333-
334-
The return value will be in the order of the input parametric position list.
335-
336-
This method accepts the following keyword arguments:
337-
338-
* ``normalize``: normalizes the output vector. Default value is *True*.
313+
.. deprecated: 5.3.0
339314
340315
:param parpos: parametric position(s) where the evaluation will be executed
341316
:type parpos: float, list or tuple
342317
:return: binormal vector as a tuple of the origin point and the vector components
343318
:rtype: tuple
344319
"""
345-
return operations.binormal(self, parpos, **kwargs)
320+
return tuple()
346321

347322

348323
@utl.export
@@ -777,46 +752,30 @@ def remove_knot(self, u=None, v=None, **kwargs):
777752
def tangent(self, parpos, **kwargs):
778753
""" Evaluates the tangent vectors of the surface at the given parametric position(s).
779754
780-
The ``param`` argument can be
781-
782-
* a float value for evaluation at a single parametric position
783-
* a list of float values for evaluation at the multiple parametric positions
784-
785-
The parametric positions should be a pair of (u,v) values. The return value will be in the order of the input
786-
parametric position list.
755+
.. deprecated: 5.3.0
787756
788-
This method accepts the following keyword arguments:
789-
790-
* ``normalize``: normalizes the output vector. Default value is *True*.
757+
Please use :func:`operations.tangent` instead.
791758
792759
:param parpos: parametric position(s) where the evaluation will be executed
793760
:type parpos: list or tuple
794761
:return: an array containing "point" and "vector"s on u- and v-directions, respectively
795762
:rtype: tuple
796763
"""
797-
return operations.tangent(self, parpos, **kwargs)
764+
return tuple()
798765

799766
def normal(self, parpos, **kwargs):
800767
""" Evaluates the normal vector of the surface at the given parametric position(s).
801768
802-
The ``param`` argument can be
803-
804-
* a float value for evaluation at a single parametric position
805-
* a list of float values for evaluation at the multiple parametric positions
806-
807-
The parametric positions should be a pair of (u,v) values. The return value will be in the order of the input
808-
parametric position list.
809-
810-
This method accepts the following keyword arguments:
769+
.. deprecated: 5.3.0
811770
812-
* ``normalize``: normalizes the output vector. Default value is *True*.
771+
Please use :func:`operations.normal` instead.
813772
814773
:param parpos: parametric position(s) where the evaluation will be executed
815774
:type parpos: list or tuple
816775
:return: an array containing "point" and "vector" pairs
817776
:rtype: tuple
818777
"""
819-
return operations.normal(self, parpos, **kwargs)
778+
return tuple()
820779

821780

822781
@utl.export

geomdl/_operations.py

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -57,99 +57,6 @@ def tangent_curve_single_list(obj, param_list, normalize):
5757
return tuple(ret_vector)
5858

5959

60-
def normal_curve_single(obj, u, normalize):
61-
""" Evaluates the vector normal to the tangent vector at the input parameter, u.
62-
63-
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
64-
65-
:param obj: input curve
66-
:type obj: abstract.Curve
67-
:param u: parameter
68-
:type u: float
69-
:param normalize: if True, the returned vector is converted to a unit vector
70-
:type normalize: bool
71-
:return: a list containing "point" and "vector" pairs
72-
:rtype: tuple
73-
"""
74-
# Find 1st derivative
75-
ders = obj.derivatives(u, 1)
76-
77-
# Apply fix on https://github.com/orbingol/NURBS-Python/pull/50#issuecomment-499354073
78-
t = ders[1]
79-
tn = [0.0, 0.0, 1.0]
80-
n = linalg.vector_cross(t, tn)
81-
82-
# Normalize the vector component
83-
vector = linalg.vector_normalize(n) if normalize else n
84-
point = ders[0]
85-
86-
return tuple(point), tuple(vector)
87-
88-
89-
def normal_curve_single_list(obj, param_list, normalize):
90-
""" Evaluates the curve normal vectors at the given list of parameter values.
91-
92-
:param obj: input curve
93-
:type obj: abstract.Curve
94-
:param param_list: parameter list
95-
:type param_list: list or tuple
96-
:param normalize: if True, the returned vector is converted to a unit vector
97-
:type normalize: bool
98-
:return: a list containing "point" and "vector" pairs
99-
:rtype: tuple
100-
"""
101-
ret_vector = []
102-
for param in param_list:
103-
temp = normal_curve_single(obj, param, normalize)
104-
ret_vector.append(temp)
105-
return tuple(ret_vector)
106-
107-
108-
def binormal_curve_single(obj, u, normalize):
109-
""" Evaluates the curve binormal vector at the given u parameter.
110-
111-
Curve binormal is the cross product of the normal and the tangent vectors.
112-
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
113-
114-
:param obj: input curve
115-
:type obj: abstract.Curve
116-
:param u: parameter
117-
:type u: float
118-
:param normalize: if True, the returned vector is converted to a unit vector
119-
:type normalize: bool
120-
:return: a list containing "point" and "vector" pairs
121-
:rtype: tuple
122-
"""
123-
# Cross product of tangent and normal vectors gives binormal vector
124-
tan_vector = tangent_curve_single(obj, u, normalize)
125-
norm_vector = normal_curve_single(obj, u, normalize)
126-
127-
point = tan_vector[0]
128-
vector = linalg.vector_cross(tan_vector[1], norm_vector[1])
129-
vector = linalg.vector_normalize(vector) if normalize else vector
130-
131-
return tuple(point), tuple(vector)
132-
133-
134-
def binormal_curve_single_list(obj, param_list, normalize):
135-
""" Evaluates the curve binormal vectors at the given list of parameter values.
136-
137-
:param obj: input curve
138-
:type obj: abstract.Curve
139-
:param param_list: parameter list
140-
:type param_list: list or tuple
141-
:param normalize: if True, the returned vector is converted to a unit vector
142-
:type normalize: bool
143-
:return: a list containing "point" and "vector" pairs
144-
:rtype: tuple
145-
"""
146-
ret_vector = []
147-
for param in param_list:
148-
temp = binormal_curve_single(obj, param, normalize)
149-
ret_vector.append(temp)
150-
return tuple(ret_vector)
151-
152-
15360
def tangent_surface_single(obj, uv, normalize):
15461
""" Evaluates the surface tangent vector at the given (u,v) parameter pair.
15562

geomdl/operations.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,41 +1421,14 @@ def normal(obj, params, **kwargs):
14211421
"""
14221422
normalize = kwargs.get('normalize', True)
14231423
if isinstance(obj, abstract.Curve):
1424-
if isinstance(params, (list, tuple)):
1425-
return ops.normal_curve_single_list(obj, params, normalize)
1426-
else:
1427-
return ops.normal_curve_single(obj, params, normalize)
1424+
raise GeomdlException("Not implemented for curves")
14281425
if isinstance(obj, abstract.Surface):
14291426
if isinstance(params[0], float):
14301427
return ops.normal_surface_single(obj, params, normalize)
14311428
else:
14321429
return ops.normal_surface_single_list(obj, params, normalize)
14331430

14341431

1435-
@export
1436-
def binormal(obj, params, **kwargs):
1437-
""" Evaluates the binormal vector of the curves or surfaces at the input parameter values.
1438-
1439-
This function is designed to evaluate binormal vectors of the B-Spline and NURBS shapes at single or
1440-
multiple parameter positions.
1441-
1442-
:param obj: input shape
1443-
:type obj: abstract.Curve or abstract.Surface
1444-
:param params: parameters
1445-
:type params: float, list or tuple
1446-
:return: a list containing "point" and "vector" pairs
1447-
:rtype: tuple
1448-
"""
1449-
normalize = kwargs.get('normalize', True)
1450-
if isinstance(obj, abstract.Curve):
1451-
if isinstance(params, (list, tuple)):
1452-
return ops.binormal_curve_single_list(obj, params, normalize)
1453-
else:
1454-
return ops.binormal_curve_single(obj, params, normalize)
1455-
if isinstance(obj, abstract.Surface):
1456-
raise GeomdlException("Binormal vector evaluation for the surfaces is not implemented!")
1457-
1458-
14591432
@export
14601433
def translate(obj, vec, **kwargs):
14611434
""" Translates curves, surface or volumes by the input vector.

0 commit comments

Comments
 (0)