|
7 | 7 |
|
8 | 8 | """
|
9 | 9 |
|
10 |
| -from typing import List, Tuple |
| 10 | +from typing import Sequence, List, Tuple |
11 | 11 | import math
|
12 | 12 | from . import BSpline
|
13 | 13 | from . import utilities
|
14 | 14 | from . import helpers
|
15 | 15 |
|
16 | 16 |
|
17 | 17 | def interpolate_curve(points, degree, **kwargs):
|
18 |
| - # type: (List[List[float]], int, **bool) -> BSpline.Curve |
| 18 | + # type: (Sequence[Sequence[float]], int, **bool) -> BSpline.Curve |
19 | 19 | """ Curve interpolation through the data points.
|
20 | 20 |
|
21 | 21 | 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):
|
56 | 56 |
|
57 | 57 |
|
58 | 58 | 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 |
60 | 60 | """ Surface interpolation through the data points.
|
61 | 61 |
|
62 | 62 | 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):
|
115 | 115 |
|
116 | 116 |
|
117 | 117 | 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 |
119 | 119 | """ Surface approximation using least squares method with fixed number of control points.
|
120 | 120 |
|
121 | 121 | 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):
|
257 | 257 |
|
258 | 258 |
|
259 | 259 | def compute_knot_vector(degree, num_points, params):
|
260 |
| - # type: (int, int, List[float]) -> List[float] |
| 260 | + # type: (int, int, Sequence[float]) -> List[float] |
261 | 261 | """ Computes a knot vector from the parameter list using averaging method.
|
262 | 262 |
|
263 | 263 | 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):
|
286 | 286 |
|
287 | 287 |
|
288 | 288 | 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] |
290 | 290 | """ Computes a knot vector ensuring that every knot span has at least one :math:`\\overline{u}_{k}`.
|
291 | 291 |
|
292 | 292 | 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):
|
321 | 321 |
|
322 | 322 |
|
323 | 323 | def compute_params_curve(points, centripetal):
|
324 |
| - # type: (List[List[float]], bool) -> List[float] |
| 324 | + # type: (Sequence[Sequence[float]], bool) -> List[float] |
325 | 325 | """ Computes :math:`\\overline{u}_{k}` for curves.
|
326 | 326 |
|
327 | 327 | 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):
|
356 | 356 |
|
357 | 357 |
|
358 | 358 | 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]] |
360 | 360 | """ Computes :math:`\\overline{u}_{k}` and :math:`\\overline{u}_{l}` for surfaces.
|
361 | 361 |
|
362 | 362 | 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):
|
409 | 409 |
|
410 | 410 |
|
411 | 411 | 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]] |
413 | 413 | """ Applies global interpolation to the set of data points to find control points.
|
414 | 414 |
|
415 | 415 | :param coeff_matrix: coefficient matrix
|
@@ -440,7 +440,7 @@ def ginterp(coeff_matrix, points):
|
440 | 440 |
|
441 | 441 |
|
442 | 442 | 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]] |
444 | 444 | """ Builds the coefficient matrix for global interpolation.
|
445 | 445 |
|
446 | 446 | 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):
|
471 | 471 |
|
472 | 472 |
|
473 | 473 | 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]] |
475 | 475 | """ Builds the coefficient matrix for global interpolation.
|
476 | 476 |
|
477 | 477 | This function uses data points and first derivatives to build the coefficient matrix. Please refer to The NURBS Book
|
|
0 commit comments