MCPcopy
hub / github.com/CadQuery/cadquery / _preprocess

Function _preprocess

cadquery/occ_impl/nurbs.py:358–381  ·  view source on GitHub ↗

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
)

Source from the content-addressed store, hash-verified

356
357@njiti
358def _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

Callers 7

nbCurveFunction · 0.85
nbCurveDerFunction · 0.85
nbSurfaceFunction · 0.85
nbSurfaceDerFunction · 0.85
designMatrixFunction · 0.85
designMatrix2DFunction · 0.85
penaltyMatrix2DFunction · 0.85

Calls 1

extendKnotsFunction · 0.85

Tested by

no test coverage detected