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

Function vIsoMatrix

cadquery/occ_impl/nurbs.py:1478–1503  ·  view source on GitHub ↗

Create a matrix that extracts the requested v isoline control points from flattened surf control points.

(surf: Surface, v: float)

Source from the content-addressed store, hash-verified

1476
1477@njit
1478def vIsoMatrix(surf: Surface, v: float) -> COO:
1479 """
1480 Create a matrix that extracts the requested v isoline control points from flattened surf control points.
1481 """
1482
1483 nu = surf.pts.shape[0]
1484 nv = surf.pts.shape[1]
1485
1486 block = designMatrix(
1487 np.atleast_1d(np.array(v)), surf.vorder, surf.vknots, surf.vperiodic
1488 )
1489
1490 shape = (nu, nu * nv)
1491
1492 n = len(block.i)
1493 N = nu * n # total number of elements
1494 i = np.empty(N, dtype=np.int64)
1495 j = np.empty(N, dtype=np.int64)
1496 vals = np.empty(N)
1497
1498 for ix in range(nu):
1499 i[ix * n : (ix + 1) * n] = ix
1500 j[ix * n : (ix + 1) * n] = block.j + ix * nv
1501 vals[ix * n : (ix + 1) * n] = block.v
1502
1503 return COO(i, j, vals, shape)
1504
1505
1506# %% construction

Callers 1

Calls 2

designMatrixFunction · 0.85
COOClass · 0.85

Tested by 1