Helper for handling periodicity. This function extends the knot vector, wraps the parameters and calculates the delta span.
(
u: Array, order: int, knots: Array, periodic: bool
)
| 356 | |
| 357 | @njiti |
| 358 | def _preprocess( |
| 359 | u: Array, order: int, knots: Array, periodic: bool |
| 360 | ) -> Tuple[Array, Array, Optional[int], Optional[int], int]: |
| 361 | """ |
| 362 | Helper for handling periodicity. This function extends the knot vector, |
| 363 | wraps the parameters and calculates the delta span. |
| 364 | """ |
| 365 | |
| 366 | # handle periodicity |
| 367 | if periodic: |
| 368 | period = knots[-1] - knots[0] |
| 369 | u_ = u % period |
| 370 | knots_ext = extendKnots(order, knots) |
| 371 | minspan = 0 |
| 372 | maxspan = len(knots) - 1 |
| 373 | deltaspan = order - 1 |
| 374 | else: |
| 375 | u_ = u |
| 376 | knots_ext = knots |
| 377 | minspan = order |
| 378 | maxspan = knots.shape[0] - order - 1 |
| 379 | deltaspan = 0 |
| 380 | |
| 381 | return u_, knots_ext, minspan, maxspan, deltaspan |
| 382 | |
| 383 | |
| 384 | @njiti |
no test coverage detected