Skip to content

Commit 6d8782e

Browse files
author
Onur Rauf Bingol
committed
Update type hints in fitting module
1 parent 33a3d32 commit 6d8782e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

geomdl/fitting.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
88
"""
99

10-
from typing import List, Tuple
10+
from typing import Sequence, List, Tuple
1111
import math
1212
from . import BSpline
1313
from . import utilities
1414
from . import helpers
1515

1616

1717
def interpolate_curve(points, degree, **kwargs):
18-
# type: (List[List[float]], int, **bool) -> BSpline.Curve
18+
# type: (Sequence[Sequence[float]], int, **bool) -> BSpline.Curve
1919
""" Curve interpolation through the data points.
2020
2121
Please see Algorithm A9.1 on The NURBS Book (2nd Edition), pp.369-370 for details.
@@ -56,7 +56,7 @@ def interpolate_curve(points, degree, **kwargs):
5656

5757

5858
def interpolate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs):
59-
# type: (List[List[float]], int, int, int, int, **bool) -> BSpline.Surface
59+
# type: (Sequence[Sequence[float]], int, int, int, int, **bool) -> BSpline.Surface
6060
""" Surface interpolation through the data points.
6161
6262
Please refer to the Algorithm A9.4 on The NURBS Book (2nd Edition), pp.380 for details.
@@ -115,7 +115,7 @@ def interpolate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs):
115115

116116

117117
def approximate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs):
118-
# type: (List[List[float]], int, int, int, int, **bool) -> BSpline.Surface
118+
# type: (Sequence[Sequence[float]], int, int, int, int, **bool) -> BSpline.Surface
119119
""" Surface approximation using least squares method with fixed number of control points.
120120
121121
This algorithm interpolates the corner control points and approximates the inner control points. Please refer to
@@ -257,7 +257,7 @@ def approximate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs):
257257

258258

259259
def compute_knot_vector(degree, num_points, params):
260-
# type: (int, int, List[float]) -> List[float]
260+
# type: (int, int, Sequence[float]) -> List[float]
261261
""" Computes a knot vector from the parameter list using averaging method.
262262
263263
Please refer to the Equation 9.8 on The NURBS Book (2nd Edition), pp.365 for details.
@@ -286,7 +286,7 @@ def compute_knot_vector(degree, num_points, params):
286286

287287

288288
def compute_knot_vector2(degree, num_dpts, num_cpts, params):
289-
# type: (int, int, int, List[float]) -> List[float]
289+
# type: (int, int, int, Sequence[float]) -> List[float]
290290
""" Computes a knot vector ensuring that every knot span has at least one :math:`\\overline{u}_{k}`.
291291
292292
Please refer to the Equations 9.68 and 9.69 on The NURBS Book (2nd Edition), p.412 for details.
@@ -321,7 +321,7 @@ def compute_knot_vector2(degree, num_dpts, num_cpts, params):
321321

322322

323323
def compute_params_curve(points, centripetal):
324-
# type: (List[List[float]], bool) -> List[float]
324+
# type: (Sequence[Sequence[float]], bool) -> List[float]
325325
""" Computes :math:`\\overline{u}_{k}` for curves.
326326
327327
Please refer to the Equations 9.4 and 9.5 for chord length parametrization, and Equation 9.6 for centripetal method
@@ -356,7 +356,7 @@ def compute_params_curve(points, centripetal):
356356

357357

358358
def compute_params_surface(points, size_u, size_v, centripetal):
359-
# type: (List[List[float]], int, int, bool) -> Tuple[List[float], List[float]]
359+
# type: (Sequence[Sequence[float]], int, int, bool) -> Tuple[List[float], List[float]]
360360
""" Computes :math:`\\overline{u}_{k}` and :math:`\\overline{u}_{l}` for surfaces.
361361
362362
The data points array has a row size of ``size_v`` and column size of ``size_u`` and it is 1-dimensional. Please
@@ -409,7 +409,7 @@ def compute_params_surface(points, size_u, size_v, centripetal):
409409

410410

411411
def ginterp(coeff_matrix, points):
412-
# type: (List[List[float]], List[List[float]]) -> List[List[float]]
412+
# type: (Sequence[Sequence[float]], Sequence[Sequence[float]]) -> List[List[float]]
413413
""" Applies global interpolation to the set of data points to find control points.
414414
415415
:param coeff_matrix: coefficient matrix
@@ -440,7 +440,7 @@ def ginterp(coeff_matrix, points):
440440

441441

442442
def _build_coeff_matrix(degree, knotvector, params, points):
443-
# type: (int, List[float], List[float], List[List[float]]) -> List[List[float]]
443+
# type: (int, Sequence[float], Sequence[float], Sequence[Sequence[float]]) -> List[List[float]]
444444
""" Builds the coefficient matrix for global interpolation.
445445
446446
This function only uses data points to build the coefficient matrix. Please refer to The NURBS Book (2nd Edition),
@@ -471,7 +471,7 @@ def _build_coeff_matrix(degree, knotvector, params, points):
471471

472472

473473
def _build_coeff_matrix_ders(degree, knotvector, params, points):
474-
# type: (int, List[float], List[float], List[List[float]]) -> List[List[float]]
474+
# type: (int, Sequence[float], Sequence[float], Sequence[Sequence[float]]) -> List[List[float]]
475475
""" Builds the coefficient matrix for global interpolation.
476476
477477
This function uses data points and first derivatives to build the coefficient matrix. Please refer to The NURBS Book

0 commit comments

Comments
 (0)