Skip to content

Commit

Permalink
Add degree elevation and reduction function template
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur Rauf Bingol committed Feb 22, 2019
1 parent 11a2a34 commit ac54c66
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions geomdl/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,62 @@ def remove_knot(obj, param, num, **kwargs):
return obj


def degree_operations(obj, param, **kwargs):
""" Applies degree elevation and degree reduction algorithms to spline geometries.
:param obj: spline geometry
:type obj: abstract.SplineGeometry
:param param: operation definition
:type param: list, tuple
:return: updated spline geometry
"""
def validate_reduction(degree):
if degree < 2:
raise GeomdlException("Input spline geometry must have degree > 1")

# Start curve degree manipulation operations
if isinstance(obj, abstract.Curve):
if param[0] is not None and param[0] != 0:

# If parameter is positive, apply degree elevation. Otherwise, apply degree reduction
if param[0] > 0:
pass

else:
# Validate degree reduction operation
validate_reduction(obj.degree)
pass

# Start surface degree manipulation operations
if isinstance(obj, abstract.Surface):
# u-direction
if param[0] is not None and param[0] != 0:

# If parameter is positive, apply degree elevation. Else, apply degree reduction
if param[0] > 0:
pass
else:
# Apply degree reduction operation
validate_reduction(obj.degree_u)

# v-direction
if param[1] is not None and param[1] != 0:

# If parameter is positive, apply degree elevation. Otherwise, apply degree reduction
if param[1] > 0:
pass
else:
# Validate degree reduction operation
validate_reduction(obj.degree_v)

# Start surface degree manipulation operations
if isinstance(obj, abstract.Volume):
raise GeomdlException("Degree manipulation operations are not available for spline volumes")

# Return updated spline geometry
return obj


def split_curve(obj, param, **kwargs):
""" Splits the curve at the input parametric coordinate.
Expand Down

0 comments on commit ac54c66

Please sign in to comment.