MCPcopy Index your code
hub / github.com/CadQuery/cadquery / normal

Method normal

cadquery/occ_impl/nurbs.py:309–322  ·  view source on GitHub ↗

Evaluate surface normals.

(self, u: Array, v: Array)

Source from the content-addressed store, hash-verified

307 )
308
309 def normal(self, u: Array, v: Array) -> Tuple[Array, Array]:
310 """
311 Evaluate surface normals.
312 """
313
314 ders = self.der(u, v, 1)
315
316 du = ders[:, 1, 0, :].squeeze()
317 dv = ders[:, 0, 1, :].squeeze()
318
319 rv = np.atleast_2d(np.cross(du, dv))
320 rv /= np.linalg.norm(rv, axis=1)[:, np.newaxis]
321
322 return rv, ders[:, 0, 0, :].squeeze()
323
324 def isoline(self, param: float, dir: Literal["u", "v"] = "u") -> Curve:
325 """

Callers 4

test_surfaceFunction · 0.95
_getAxisMethod · 0.45
_getPlnMethod · 0.45
testNormalMethod · 0.45

Calls 2

derMethod · 0.95
crossMethod · 0.80

Tested by 2

test_surfaceFunction · 0.76
testNormalMethod · 0.36