MCPcopy Create free account
hub / github.com/Image-Py/imagepy / count_ns

Function count_ns

imagepy/core/myvi/util.py:6–15  ·  view source on GitHub ↗
(vts, fs)

Source from the content-addressed store, hash-verified

4from .txtmark import lib
5
6def count_ns(vts, fs):
7 dv1 = vts[fs[:,1]] - vts[fs[:,2]]
8 dv2 = vts[fs[:,1]] - vts[fs[:,0]]
9 ns = np.cross(dv1, dv2)
10 ass = np.linalg.norm(ns, axis=1)
11 ns /= np.linalg.norm(ns, axis=1).reshape((-1,1))
12 buf = np.zeros_like(vts)
13 for i in (0,1,2): np.add.at(buf, fs[:,i], ns)
14 buf /= np.linalg.norm(buf, axis=1).reshape((-1,1))
15 return buf
16
17def build_twringidx(n, offset=0):
18 idx = np.array([[0,1,n+1],[n+1,n+2,1]])

Callers 2

build_meshFunction · 0.85
on_openMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected